diff --git a/serendipity_event_spamblock_bee/ChangeLog b/serendipity_event_spamblock_bee/ChangeLog index c0a83e44..4fe0c68a 100644 --- a/serendipity_event_spamblock_bee/ChangeLog +++ b/serendipity_event_spamblock_bee/ChangeLog @@ -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. diff --git a/serendipity_event_spamblock_bee/serendipity_event_spamblock_bee.php b/serendipity_event_spamblock_bee/serendipity_event_spamblock_bee.php index 49c09194..5f044ea3 100644 --- a/serendipity_event_spamblock_bee/serendipity_event_spamblock_bee.php +++ b/serendipity_event_spamblock_bee/serendipity_event_spamblock_bee.php @@ -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; } }