some tweaks and bugfixes
authorPierre Habouzit <madcoder@debian.org>
Wed, 10 Sep 2003 22:48:21 +0000 (22:48 +0000)
committerPierre Habouzit <madcoder@debian.org>
Wed, 10 Sep 2003 22:48:21 +0000 (22:48 +0000)
philter/philter/include/emails.inc.php
philter/philter/include/plugin.inc.php
philter/philter/include/plugin_bogofilter.inc.php
philter/philter/include/rule.inc.php

index 0ee1afa..b7905f2 100644 (file)
@@ -37,6 +37,8 @@ class Email {
      * @return  true if the string is a valid email, false else
      */
     function Check($_string) {
+        if(function_exists('isvalid_email_redirection'))
+            return isvalid_email_redirection($_string);
         return preg_match("/^[\w\-.]+(\+[\w\-.]+)?@[\w\-.]+\.[a-zA-Z]{2,44}$/", $_string);
     }
 
index 066b8e8..1f3bdfc 100644 (file)
@@ -82,9 +82,9 @@ class MatchPlugin extends Plugin {
 
     function sql_store($_uid, $_rid, $_data) {
         if($this->global)
-            mysql_query("INSERT INTO actions SET uid='$_uid',rid='0',pid='{$_data[0]}',data='{$_data[1]}'");
+            mysql_query("INSERT INTO matches SET uid='$_uid',rid='0',pid='{$_data[0]}',data='{$_data[1]}'");
         else
-            mysql_query("INSERT INTO actions SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='{$_data[1]}'");
+            mysql_query("INSERT INTO matches SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='{$_data[1]}'");
     }
 
     /** true if the plugin is used as global rule
index 54b02d4..fd90fa5 100644 (file)
@@ -39,7 +39,7 @@ class BogoPlugin extends MatchPlugin {
 
     function to_form($_data) {
         $res =  "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n"
-            .   "<tr><th width=\"25%\">BogoFilter</th>\n";
+            .   "<tr><th width=\"25%\">"._i18n('1_bogo')."</th>\n";
 
         $res .= "<td><input type='hidden' name='global[1][0]' value='1' />\n"
             .   "    <input type='radio' name='global[1][1]' value='0' "
index 726b070..9123b29 100644 (file)
@@ -66,9 +66,13 @@ class Rule {
             $left_joins .= $plug->sql_get();
         
         $sql = mysql_query("SELECT * FROM matches WHERE matches.uid='$_uid' AND matches.rid='$_rid' ".$left_joins);
-        
-        while($t = mysql_fetch_assoc($sql))
-            $this->matches[] = $philter->config['match_plugins'][$t['pid']]->sql_to_data($t);
+       
+        if($_rid)
+            while($t = mysql_fetch_assoc($sql))
+                $this->matches[] = $philter->config['match_plugins'][$t['pid']]->sql_to_data($t);
+        else
+            while($t = mysql_fetch_assoc($sql))
+                $this->matches[] = $philter->config['global_plugins'][$t['pid']]->sql_to_data($t);
     }
 
     function move_to($_new_rank, $_uid, $_rid) {