[pLog-svn] r7068 - plugins/branches/lifetype-1.2/moderate

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Oct 15 10:19:35 EDT 2010


Author: jondaley
Date: 2010-10-15 10:19:35 -0400 (Fri, 15 Oct 2010)
New Revision: 7068

Modified:
   plugins/branches/lifetype-1.2/moderate/pluginmoderate.class.php
Log:
don't check blank ips (I guess our ip checker must sometimes return null?) and also only bypass commenters that have previously approved comments, not any comments... duh

Modified: plugins/branches/lifetype-1.2/moderate/pluginmoderate.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moderate/pluginmoderate.class.php	2010-10-08 22:01:18 UTC (rev 7067)
+++ plugins/branches/lifetype-1.2/moderate/pluginmoderate.class.php	2010-10-15 14:19:35 UTC (rev 7068)
@@ -18,7 +18,7 @@
 			$this->desc = "Provides moderation of comments";
 			$this->author = "The LifeType Project";
 			$this->locales = Array( "en_UK", "zh_TW", "es_ES", "fr_FR", "ca_ES" );
-            $this->version = "20101008";
+            $this->version = "20101015";
 
 			if( $source == "admin" )
 				$this->initAdmin();
@@ -53,18 +53,23 @@
             $comment = $params["comment"];
                             
             if($blogSettings->getValue("plugin_moderate_bypass_by_ip")){
-                    // if this ip has previously been used for a validated comment,
-                    // don't moderate it
+                $ip = $comment->getClientIp();
+                    // Only check if this IP is valid
+                if($ip){
+                        // if this ip has previously been used for a validated comment,
+                        // don't moderate it
 
-                lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
-                $this->db =& Db::getDb();
-                $dbPrefix = Db::getPrefix();
-                $query = "SELECT id FROM ${dbPrefix}articles_comments WHERE ".
-                    "client_ip = '".$comment->getClientIp()."' LIMIT 1";
-
-                $result = $this->db->Execute($query);
-                if($result && $result->RecordCount())
-                    return true;
+                    lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
+                    $this->db =& Db::getDb();
+                    $dbPrefix = Db::getPrefix();
+                    $query = "SELECT id FROM ${dbPrefix}articles_comments WHERE ".
+                        "status != ".COMMENT_STATUS_UNMODERATED." AND ".
+                        "client_ip = '$ip' LIMIT 1";
+                    
+                    $result = $this->db->Execute($query);
+                    if($result && $result->RecordCount())
+                        return true;
+                }
             }
 
                 // set the comment as moderated:



More information about the pLog-svn mailing list