Fixed additional spam checks not being executed due to premature return statement. Also added some more flexibility on entry title spam detection by including the blog name.

This commit is contained in:
Janek Bevendorff 2012-08-12 17:46:56 +02:00 committed by Janek Bevendorff
parent 50acf7d56b
commit 56dfcb8f85

View file

@ -417,9 +417,8 @@ 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 ]");
return $isCorrect;
}
return $isCorrect;
}
}
@ -443,9 +442,17 @@ class serendipity_event_spamblock_bee extends serendipity_event
// Check if entry title is the same as comment body
$spamHandle = $this->get_config('entrytitle', PLUGIN_EVENT_SPAMBLOCK_SWTCH_REJECT);
if (PLUGIN_EVENT_SPAMBLOCK_SWTCH_OFF!=$spamHandle && trim($eventData['title']) == trim($addData['comment'])) {
$this->processComment($spamHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_BODY, "BEE Body the same as title");
return false;
if (PLUGIN_EVENT_SPAMBLOCK_SWTCH_OFF != $spamHandle) {
// Remove the blog name from the comment which might be in <title>
$comment = str_replace($serendipity['blogTitle'], '', $addData['comment']);
$comment = preg_replace('/^[\s\-_:\(\)]*/', '', $comment);
$comment = preg_replace('/[\s\-_:\(\)]*$/', '', $comment);
// Compare what's left to the entry title.
if (trim($eventData['title']) == $comment) {
$this->processComment($spamHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_BODY, "BEE Body the same as title");
return false;
}
}
// This check loads from DB, so do it last!