Author Topic: Quotes give you credits. Would like to disable this.  (Read 5219 times)

Offline Pure

Quotes give you credits. Would like to disable this.
« on: February 16, 2007, 12:16:23 am »
As the title says, quotes from other members are counted as your own words so you earn credits for them. People have found this out and are quoting when not necessary. Any chance this could be disabled?

Peace, Lance

Offline Basil Beard

Re: Quotes give you credits. Would like to disable this.
« Reply #1 on: February 16, 2007, 11:57:07 am »
This is the code in question

Code: [Select]
// Now, on to bonuses.
// Strip out all BBCode
$plaintext = preg_replace('[\[(.*?)\]]', ' ', $_POST['message']);
// Convert all newlines into spaces
$plaintext = str_replace(array('<br />', "\r", "\n"), ' ', $plaintext);
// Convert multiple successive spaces into a single space
$plaintext = preg_replace('/\s+/', ' ', $plaintext);

// The bonus for each word...
$points += ($modSettings['shopPointsPerWord'] * str_word_count($plaintext));
// ...and bonus for each letter
$points += ($modSettings['shopPointsPerChar'] * strlen($plaintext));

As you can see, it has no way of knowing what is in quotes and what is not. The only way to do that would be for it to search for [quote] tags before it strips the bbc code. Remove everything between [quote] tags. And go from there. My string magic is rusty. But I think it would look something like 
Code: [Select]
$plaintext = preg_replace('[QUOTE](.*?)[/QUOTE]', ' ', $_POST['message']);
You would then want
Code: [Select]
$plaintext = preg_replace('[\[(.*?)\]]', ' ', $plaintext);
instead of
Code: [Select]
$plaintext = preg_replace('[\[(.*?)\]]', ' ', $_POST['message']);

But you really should learn how those string magical commands work. Because I think mine is wrong. Basically, you want to find the string "[quote]", and then contain everything that lies between it and the string [/quote]. Right now, that thing finds "[" and nukes everything between it an "]". So you need to kill the quotes before you kill the BBCode.

Regardless. I hope this helps. Sorry I donno string magic(which is totally the wrong term) any better.

Edited by Daniel15: Fixed formatting
« Last Edit: February 17, 2007, 08:46:23 am by Daniel15 »
Arrrrr!

Offline Daniel15

Re: Quotes give you credits. Would like to disable this.
« Reply #2 on: February 17, 2007, 08:49:28 am »
Basil Beard, good to see you back :D
What Basil Beard has said is basically correct. I haven't tested it, but it looks like it should work properly ;)

Quote
My string magic is rusty
It's called Regular Expressions (this is PCRE, or Perl-compatible Regular Expressions. It's based off the regular expressions in Perl). There's a really good tutorial at http://www.regular-expressions.info/quickstart.html :)


Offline CRONUS

Re: Quotes give you credits. Would like to disable this.
« Reply #3 on: February 19, 2007, 05:33:34 pm »
but now it gives only for new post ::) and nothing for words

Offline bfeo

Re: Quotes give you credits. Would like to disable this.
« Reply #4 on: October 17, 2008, 02:56:04 am »
does this work?