[pLog-svn] r3378 - plugins/trunk/contentfilter/class/security

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed May 10 14:31:28 GMT 2006


Author: oscar
Date: 2006-05-10 14:31:27 +0000 (Wed, 10 May 2006)
New Revision: 3378

Modified:
   plugins/trunk/contentfilter/class/security/contentfilter.class.php
Log:
this allows the contentfilter to filter trackbacks as well


Modified: plugins/trunk/contentfilter/class/security/contentfilter.class.php
===================================================================
--- plugins/trunk/contentfilter/class/security/contentfilter.class.php	2006-05-10 14:31:03 UTC (rev 3377)
+++ plugins/trunk/contentfilter/class/security/contentfilter.class.php	2006-05-10 14:31:27 UTC (rev 3378)
@@ -37,8 +37,8 @@
             }
 
             // we only have to filter the contents if the user is posting a comment
-            // so there's no point in doing anything else if that's not the case
-            if( $request->getValue( "op" ) != "AddComment" ) {
+            // or trackback so there's no point in doing anything else if that's not the case
+            if( $request->getValue( "op" ) != "AddComment" && $request->getValue( "op" ) != "AddTrackback" ) {
             	$result = new PipelineResult();
                 return $result;
             }
@@ -50,12 +50,23 @@
             if ( $this->_pipelineRequest->getRejectedState() )
                 return new PipelineResult();
                             
-            // text and topic of the comment
-            $commentText = $request->getValue( "commentText" );
-            $commentTopic = $request->getValue( "commentTopic" );
-            $userName = $request->getValue( "userName" );
-            $userEmail = $request->getValue( "userEmail" );
-            $userUrl = $request->getValue( "userUrl" );
+            // text and topic of the comment or trackback
+            if( $request->getValue( "op") == "AddTrackback" ) {
+                include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );            
+                $tf = new TextFilter();
+                $userName     = $tf->filterAllHTML( $request->getValue( "blog_name" ));
+                $commentText  = $tf->filterAllHTML( $request->getValue( "excerpt" ));
+                $commentTopic = $tf->filterAllHTML( $request->getValue( "title" ));
+                $userUrl      = $tf->filterAllHTML( $request->getValue( "url" ));            
+                $userEmail    = "";                
+            }
+            else {
+                $commentText = $request->getValue( "commentText" );
+                $commentTopic = $request->getValue( "commentTopic" );
+                $userName = $request->getValue( "userName" );
+                $userEmail = $request->getValue( "userEmail" );
+                $userUrl = $request->getValue( "userUrl" );
+            }
 
             //
             // get the list of filtered content for this blog, including global data
@@ -63,8 +74,6 @@
             $filteredContents = new FilteredContents();            
             $blogFilteredContents = $filteredContents->getBlogFilteredContents( $blogInfo->getId(), true );
             
-            print_r($blogFilteredContents);
-            
             foreach( $blogFilteredContents as $blogFilteredContent ) {
             	//_debug("regexp = ".$blogFilteredContent->getRegExp()."<br/>");
             	if( preg_match( $blogFilteredContent->getRegExp(), $commentText )) {



More information about the pLog-svn mailing list