Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2604
Modified Files:
serendipity_event_spamblock.php
Log Message:
Reverted parts of nohns commit when reordering spamblock methods:
First try to execute REJECT mechanisms, after that comes MODERATE.
Everything we want rejected should be rejected and not put into MODERATE
state because of some irrelevant "force moderation after X days". If you had
this activated, every comment that got no valid captcha would be put into
MODERATE state. Now every comment is checked for its captcha first before
auto-moderation kicks in.
Index: serendipity_event_spamblock.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- serendipity_event_spamblock.php 1 Feb 2005 13:23:45 -0000 1.46
+++ serendipity_event_spamblock.php 3 Feb 2005 16:29:21 -0000 1.47
@@ -507,15 +507,6 @@
}
}
- // Check for forced moderation
- if ($forcemoderation > 0 && $eventData['timestamp'] < (time() - ($forcemoderation * 60 * 60 * 24))) {
- $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION, $addData);
- $eventData['moderate_comments'] = true;
- $serendipity['csuccess'] = 'moderate';
- $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION;
- return false;
- }
-
// Check for maximum number of links before rejecting
$link_count = substr_count(strtolower($addData['comment']), 'http://');
if ($links_reject > 0 && $link_count > $links_reject) {
@@ -525,15 +516,6 @@
return false;
}
- // Check for maximum number of links before forcing moderation
- if ($links_moderate > 0 && $link_count > $links_moderate) {
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_MODERATE, $addData);
- $eventData['moderate_comments'] = true;
- $serendipity['csuccess'] = 'moderate';
- $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_MODERATE;
- return false;
- }
-
// Captcha checking
if ($show_captcha && $addData['type'] == 'NORMAL') {
if (!isset($_SESSION['spamblock']['captcha']) || !isset($serendipity['POST']['captcha']) || strtolower($serendipity['POST']['captcha']) != strtolower($_SESSION['spamblock']['captcha'])) {
@@ -541,7 +523,31 @@
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_CAPTCHAS;
return false;
+ } else {
+// DEBUG
+// $this->log($logfile, $eventData['id'], 'REJECTED', 'Captcha passed: ' . $serendipity['POST']['captcha'] . ' / ' . $_SESSION['spamblock']['captcha'] . ' // Source: ' . $_SERVER['REQUEST_URI'], $addData);
}
+ } else {
+// DEBUG
+// $this->log($logfile, $eventData['id'], 'REJECTED', 'Captcha not needed: ' . $serendipity['POST']['captcha'] . ' / ' . $_SESSION['spamblock']['captcha'] . ' // Source: ' . $_SERVER['REQUEST_URI'], $addData);
+ }
+
+ // Check for forced moderation
+ if ($forcemoderation > 0 && $eventData['timestamp'] < (time() - ($forcemoderation * 60 * 60 * 24))) {
+ $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION, $addData);
+ $eventData['moderate_comments'] = true;
+ $serendipity['csuccess'] = 'moderate';
+ $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION;
+ return false;
+ }
+
+ // Check for maximum number of links before forcing moderation
+ if ($links_moderate > 0 && $link_count > $links_moderate) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_MODERATE, $addData);
+ $eventData['moderate_comments'] = true;
+ $serendipity['csuccess'] = 'moderate';
+ $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_MODERATE;
+ return false;
}
// Check for identical comments. We allow to bypass trackbacks from our server to our own blog.
|