[pLog-svn] r3197 - in plog/trunk: class/security locale

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Apr 6 11:49:20 GMT 2006


Author: jondaley
Date: 2006-04-06 11:49:20 +0000 (Thu, 06 Apr 2006)
New Revision: 3197

Modified:
   plog/trunk/class/security/bayesianfilter.class.php
   plog/trunk/locale/locale_en_UK.php
Log:
localize comment spam error, as well as let the user know that his comment was moderated (if it was), so he won't keep posting the same comment over and over again.

Modified: plog/trunk/class/security/bayesianfilter.class.php
===================================================================
--- plog/trunk/class/security/bayesianfilter.class.php	2006-04-06 07:50:29 UTC (rev 3196)
+++ plog/trunk/class/security/bayesianfilter.class.php	2006-04-06 11:49:20 UTC (rev 3197)
@@ -92,7 +92,11 @@
             
             if ($spamicity >= $config->getValue("bayesian_filter_spam_probability_treshold"))
             {
-                $result = new PipelineResult(false, HIGH_SPAM_PROBABILITY, "You cannot post this message. Anti-spam filter has blocked it.");
+                    // need this to get the locale
+                $plr = $this->getPipelineRequest();
+                $bi = $plr->getBlogInfo();
+                $locale = $bi->getLocale();
+                
                 // now we need to check what we have to do with this comment... either throw it away
                 // or keep it in the database
 
@@ -101,6 +105,7 @@
                 // still be added but marked as spam and so on... sometimes breaking a few
                 // rules makes things easier :)
                 if( $config->getValue( "bayesian_filter_spam_comments_action" ) == BAYESIAN_FILTER_KEEP_COMMENT_ACTION ) {
+                    $result = new PipelineResult(false, HIGH_SPAM_PROBABILITY, $locale->tr("error_comment_spam_keep" ));
                     $comments = new ArticleComments();
                     $clientIp = Client::getIp();
                     $comment = new UserComment( $articleId, $blogInfo->getId(), $parentId, $commentTopic, $commentText,
@@ -118,6 +123,7 @@
                 }
                 else {
                     // nothing to do here, simply throw the comment away
+                    $result = new PipelineResult(false, HIGH_SPAM_PROBABILITY, $locale->tr("error_comment_spam_throw_away" ));
                 }
                 $spam = true;
             }

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2006-04-06 07:50:29 UTC (rev 3196)
+++ plog/trunk/locale/locale_en_UK.php	2006-04-06 11:49:20 UTC (rev 3197)
@@ -1008,4 +1008,9 @@
 $messages['help_http_cache_lifetime'] = 'Lifetime in seconds of the client side cache (browsers will not return to the server for this long, and pages will be served from the local cache.  This greatly speeds up the browsing experience, but will delay post and comment visibility. [Default = 1800]';
 
 $messages['trackbacks_no_trackback'] = 'Sending a trackback to the following URL failed: ';
+
+$messages['error_comment_spam_throw_away'] = 'You cannot post this message. Anti-spam filter has blocked it.';
+$messages['error_comment_spam_keep'] = 'The anti-spam filter has put your comment in the moderation queue and it will have to be approved by the blog owner.';
+
+
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list