]> git.mjollnir.org Git - s9y.git/commitdiff
* The spamblock plugin now continues to check any comment/trackback
authorgarvinhicking <garvinhicking>
Mon, 10 Apr 2006 13:45:19 +0000 (13:45 +0000)
committergarvinhicking <garvinhicking>
Mon, 10 Apr 2006 13:45:19 +0000 (13:45 +0000)
     set to MODERATE if maybe other rules override the status to
     REJECTED. This should reduce the amount of moderation mails that
     definitely are spam. (Bug #1467707) (garvinhicking)

docs/NEWS
plugins/serendipity_event_spamblock/serendipity_event_spamblock.php

index acdbd2120560559ccc8027b3553d548cac5020e8..45de02825852a71ec9fb040ddea5e62ad3ec6837 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 1.0 ()
 ------------------------------------------------------------------------
 
+   * The spamblock plugin now continues to check any comment/trackback
+     set to MODERATE if maybe other rules override the status to
+     REJECTED. This should reduce the amount of moderation mails that
+     definitely are spam. (Bug #1467707) (garvinhicking)
+     
    * Fix UTF-8 encoding of $i18n_filename_* variables for building
      permalinks (Bug #1461754, Thanks to Kim Sullivan) (garvinhicking)
 
index 019ed864d9fe3f006daa6a909dae127c91f51161..5c78d8e3489c0a52fc4857eb1e96bf02b1c90075 100644 (file)
@@ -34,7 +34,7 @@ var $filter_defaults;
             'smarty'      => '2.6.7',
             'php'         => '4.1.0'
         ));
-        $propbag->add('version',       '1.33');
+        $propbag->add('version',       '1.40');
         $propbag->add('event_hooks',    array(
             'frontend_saveComment' => true,
             'external_plugin'      => true,
@@ -350,16 +350,16 @@ var $filter_defaults;
         global $serendipity;
 
         $checkgroups = explode('^', $this->get_config('hide_for_authors'));
-        
+
         if (!isset($serendipity['authorid']) || !is_array($checkgroups)) {
             return false;
         }
-        
+
         $mygroups =& serendipity_getGroups($serendipity['authorid'], true);
         if (!is_array($mygroups)) {
             return false;
         }
-        
+
         foreach($checkgroups AS $key => $groupid) {
             if ($groupid == 'all') {
                 return true;
@@ -367,7 +367,7 @@ var $filter_defaults;
                 return true;
             }
         }
-        
+
         return false;
     }
 
@@ -432,7 +432,7 @@ var $filter_defaults;
                                 }
                             }
                         }
-                        
+
                         // Check whether to allow comments from registered authors
                         if (serendipity_userLoggedIn() && $this->inGroup()) {
                             return true;
@@ -461,15 +461,15 @@ var $filter_defaults;
                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_API, $addData);
                                 $eventData = array('allow_comments' => false);
                                 $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_REASON_API;
+                                return false;
                             } elseif ($this->get_config('disable_api_comments') == 'moderate') {
                                 $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_REASON_API, $addData);
                                 $eventData['moderate_comments'] = true;
                                 $serendipity['csuccess']        = 'moderate';
                                 $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_REASON_API;
                             }
-                            return false;
                         }
-                        
+
                         // Check Trackback URLs?
                         if ($addData['type'] == 'TRACKBACK' && serendipity_db_bool($this->get_config('trackback_check_url'))) {
                             require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
@@ -513,7 +513,6 @@ var $filter_defaults;
                                             $eventData['moderate_comments'] = true;
                                             $serendipity['csuccess']        = 'moderate';
                                             $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
-                                            return false;
                                         } else {
                                             $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS, $addData);
                                             $eventData = array('allow_comments' => false);
@@ -537,7 +536,6 @@ var $filter_defaults;
                                             $eventData['moderate_comments'] = true;
                                             $serendipity['csuccess']        = 'moderate';
                                             $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
-                                            return false;
                                         } else {
                                             $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_URLS, $addData);
                                             $eventData = array('allow_comments' => false);
@@ -560,7 +558,6 @@ var $filter_defaults;
                                                 $eventData['moderate_comments'] = true;
                                                 $serendipity['csuccess']        = 'moderate';
                                                 $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
-                                                return false;
                                             } else {
                                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS, $addData);
                                                 $eventData = array('allow_comments' => false);
@@ -589,7 +586,6 @@ var $filter_defaults;
                                                 $eventData['moderate_comments'] = true;
                                                 $serendipity['csuccess']        = 'moderate';
                                                 $serendipity['moderate_reason'] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
-                                                return false;
                                             } else {
                                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_BLOGG_SPAMLIST . ': ' . $domain, $addData);
                                                 $eventData = array('allow_comments' => false);
@@ -633,7 +629,6 @@ var $filter_defaults;
                             $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
@@ -642,7 +637,6 @@ var $filter_defaults;
                             $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.
@@ -675,8 +669,13 @@ var $filter_defaults;
                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL, $addData);
                                 $eventData = array('allow_comments' => false);
                                 $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL;
+                                return false;
                             }
                         }
+
+                        if ($eventData['moderate_comments'] == true) {
+                            return false;
+                        }
                     }
 
                     return true;
@@ -790,7 +789,7 @@ var $filter_defaults;
                             $pos_x = $pos_x + $size + 2;
 
                         }
-                        
+
                         if ($_captchas === 'scramble') {
                             $line_diff = mt_rand(5, 15);
                             $pixel_col = imagecolorallocate($image, trim($bgcolors[0])-mt_rand(10,50), trim($bgcolors[1])-mt_rand(10,50), trim($bgcolors[2])-mt_rand(10,50));