SpamBee: Fixed spam log message for wrong Captcha answer, truncated Captcha answer in spam log after 40 characters.

This commit is contained in:
Janek Bevendorff 2012-08-17 13:30:35 +02:00
parent 58b008ff41
commit 1b1f080623
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Version 1.2.4
* Fixed: Spam log entry for wrong Captcha answer
* Truncated Captcha answer in spam log if it is longer than 40 characters
Version 1.2.3
* Fixed: If core spam plugin was not installed, the check for required fiels was rejecting trackbacks sometimes.
* Fixed: Rejecting comments having entry title as body only works for most blogs having the blogtitle as title, too.

View file

@ -106,7 +106,7 @@ class serendipity_event_spamblock_bee extends serendipity_event
'php' => '4.1.0'
));
$propbag->add('version', '1.2.3');
$propbag->add('version', '1.2.4');
$propbag->add('event_hooks', array(
'frontend_comment' => true,
@ -391,7 +391,7 @@ class serendipity_event_spamblock_bee extends serendipity_event
// If provided answer is longer than 1000 characters and RegExp matching is on,
// reject comment for security reasons (minimize risk of ReDoS)
if ($this->useRegularExpressions && strlen($answer) > 1000) {
if ($this->useRegularExpressions && mb_strlen($answer) > 1000) {
$this->processComment($this->hiddenCaptchaHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_HCAPTCHA, "BEE HiddenCaptcha [ Captcha input too long ]");
return false;
}
@ -422,7 +422,10 @@ class serendipity_event_spamblock_bee extends serendipity_event
}
if (!$isCorrect) {
$this->processComment($this->hiddenCaptchaHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_HCAPTCHA, "BEE HiddenCaptcha [ $correct != $answer ]");
if (mb_strlen($answer) > 40) {
$answer = substr($answer, 0, 40) . '…';
}
$this->processComment($this->hiddenCaptchaHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_HCAPTCHA, "BEE HiddenCaptcha [ $correctAnswer[answer] != $answer ]");
return $isCorrect;
}
}