Merge pull request #19 from Manko10/master

SpamBee: Little spam log message fixes
This commit is contained in:
Grischa Brockhaus 2012-08-17 13:38:27 -07:00
commit 53930b39aa
2 changed files with 16 additions and 5 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,
@ -376,8 +376,12 @@ class serendipity_event_spamblock_bee extends serendipity_event
if ("NORMAL" == $addData['type']) { // only supported for normal comments
// Check for Honey Pot:
if ($this->useHoneyPot && (!empty($serendipity['POST']['phone']) || $serendipity['POST']['phone']=='0') ) {
$this->spamlog($eventData['id'], 'REJECTED', "BEE Honeypot [" . $serendipity['POST']['phone'] . "]", $addData);
$phone = $serendipity['POST']['phone'];
if ($this->useHoneyPot && (!empty($phone) || $phone == '0') ) {
if (mb_strlen($phone) > 40) {
$phone = mb_substr($phone, 0, 40) . '…';
}
$this->spamlog($eventData['id'], 'REJECTED', "BEE Honeypot [" . $phone . "]", $addData);
$eventData = array('allow_comments' => false);
return false;
}
@ -391,7 +395,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 +426,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 = mb_substr($answer, 0, 40) . '…';
}
$this->processComment($this->hiddenCaptchaHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_HCAPTCHA, "BEE HiddenCaptcha [ $correctAnswer[answer] != $answer ]");
return $isCorrect;
}
}