spamBee: Rejecting comments having entry title as body only works for

most blogs having the blogtitle as title, too.
This commit is contained in:
Grischa Brockhaus 2012-08-16 21:56:25 +02:00
parent c06bf44a7e
commit 2e14f12365
2 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,6 @@
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.
Version 1.2.2
* Simplified settings by removing obfuscation option. This is now turned on by default.

View file

@ -452,11 +452,14 @@ class serendipity_event_spamblock_bee extends serendipity_event
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) {
$comment = str_replace($eventData['title'], '', $comment);
// Now blog- and entry title was stripped from comment.
// Remove special letters, that might have been between them:
$comment = trim(preg_replace('@[\s\-_:\(\)\|/]*@', '', $comment));
$comment = trim($comment);
// Now that we stripped blog and entry title: Do we have an empty comment?
if (empty($comment)) {
$this->processComment($spamHandle, $eventData, $addData, PLUGIN_EVENT_SPAMBLOCK_BEE_ERROR_BODY, "BEE Body the same as title");
return false;
}