spamBee: If core spam plugin was not installed, the check for required

fiels was rejecting trackbacks sometimes.
This commit is contained in:
Grischa Brockhaus 2012-08-16 14:06:16 +02:00
parent a4679e7bcb
commit c06bf44a7e
2 changed files with 21 additions and 18 deletions

View file

@ -1,3 +1,6 @@
Version 1.2.3
* Fixed: If core spam plugin was not installed, the check for required fiels was rejecting trackbacks sometimes.
Version 1.2.2
* Simplified settings by removing obfuscation option. This is now turned on by default.
* Fixed regular expression matching.

View file

@ -106,7 +106,7 @@ class serendipity_event_spamblock_bee extends serendipity_event
'php' => '4.1.0'
));
$propbag->add('version', '1.2.2');
$propbag->add('version', '1.2.3');
$propbag->add('event_hooks', array(
'frontend_comment' => true,
@ -426,26 +426,27 @@ class serendipity_event_spamblock_bee extends serendipity_event
return $isCorrect;
}
}
// AntiSpam check, the general spamblock supports, too: Only if spamblock is not installed.
if (!class_exists('serendipity_event_spamblock')) {
// Check for required fields. Don't log but tell the user about the fields.
$required_fields = $this->get_config('required_fields', '');
if (!empty($required_fields)) {
$required_field_list = explode(',', $required_fields);
foreach($required_field_list as $required_field) {
$required_field = trim($required_field);
if (empty($addData[$required_field])) {
$this->reject($eventData, $addData, sprintf(PLUGIN_EVENT_SPAMBLOCK_BEE_REASON_REQUIRED_FIELD, $required_field));
return false;
}
}
}
}
}
// AntiSpam check, the general spamblock supports, too: Only if spamblock is not installed.
if (!class_exists('serendipity_event_spamblock')) {
// Check for required fields. Don't log but tell the user about the fields.
$spamdetected = false;
$required_fields = $this->get_config('required_fields', '');
if (!empty($required_fields)) {
$required_field_list = explode(',', $required_fields);
foreach($required_field_list as $required_field) {
$required_field = trim($required_field);
if (empty($addData[$required_field])) {
$this->reject($eventData, $addData, sprintf(PLUGIN_EVENT_SPAMBLOCK_BEE_REASON_REQUIRED_FIELD, $required_field));
$spamdetected = true;
}
}
}
if ($spamdetected) return false;
// 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) {
@ -479,7 +480,6 @@ class serendipity_event_spamblock_bee extends serendipity_event
}
}
if ($spamdetected) return false;
}
return true;