[pLog-svn] r2305 - plog/branches/plog-1.0.2/class/security

pwestbro at devel.plogworld.net pwestbro at devel.plogworld.net
Tue Jul 12 21:08:46 GMT 2005


Author: pwestbro
Date: 2005-07-12 21:08:45 +0000 (Tue, 12 Jul 2005)
New Revision: 2305

Modified:
   plog/branches/plog-1.0.2/class/security/pipeline.class.php
Log:
Fixed bug 627.  Now the bayesian filter is forced to run last.  This will
prevent the case where a comment is trained incorrect as non-spam right
before it is deleted by a different filter.


Modified: plog/branches/plog-1.0.2/class/security/pipeline.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/security/pipeline.class.php	2005-07-12 21:08:28 UTC (rev 2304)
+++ plog/branches/plog-1.0.2/class/security/pipeline.class.php	2005-07-12 21:08:45 UTC (rev 2305)
@@ -146,10 +146,27 @@
             	return new PipelineResult( true );
             }
 
+			// boolean to indicate whether we should run the bayesian filter
+			// This is a hack.  We don't want to run the bayesian filter on 
+			// a message that will be rejected by another filter.  The only way
+			// to know this is to run after all of the other filters have run.
+			//
+			// Ideally, once a message is rejected, we would want to let all
+			// of the filters know about it.  This way they could do something
+			// interesting (i.e. train the message as spam, report the ip address
+			// and urls to dnsbl services)
+			
+			// default it to false.
+			$runBayesianFilter = false;
+			
             // if enabled, then check all the filters
         	foreach( $_pLogPipelineRegisteredFilters as $filterClass ) {
+				if ( strcmp( $filterClass, "BayesianFilter" ) == 0 ) {
+					$runBayesianFilter = true;
+				}
         	    // create an instance of the filter
         	    $pipelineRequest = new PipelineRequest( $this->_httpRequest, $this->_blogInfo );
+
         	    $filter = new $filterClass( $pipelineRequest );
         	    // and execute it...       	    
             	$result = $filter->filter();
@@ -161,7 +178,17 @@
                 	return $result;
                 }
             }
+            
+            if ( $runBayesianFilter )
+            {
+        	    // create an instance of the filter
+        	    $pipelineRequest = new PipelineRequest( $this->_httpRequest, $this->_blogInfo );
 
+        	    $filter = new BayesianFilter( $pipelineRequest );
+        	    // and execute it...       	    
+            	$result = $filter->filter();
+            }
+
             $this->_result = $result;
             return $result;
         }




More information about the pLog-svn mailing list