some bugfixes
[old-projects.git] / philter / philter / include / rule.inc.php
index 41514b4..6bb70f4 100644 (file)
@@ -87,7 +87,17 @@ class Rule {
     }
 
     function to_string() {
-        return "";
+        global $philter;
+        
+        $res = ($this->block ? ":0\n" : ":0 c\n");
+        foreach($this->matches as $match)
+            $res .= $philter->['config']['match_plugins'][$match[0]]->to_string($match);
+        $res.= "{\n";
+        foreach($this->actions as $action)
+            $res .= $philter->['config']['actioh_plugins'][$action[0]]->to_string($action);
+        $res.= "}\n\n";
+
+        return $res;
     }
 
     function sql_clean($_uid, $_rid) {
@@ -96,10 +106,12 @@ class Rule {
         mysql_query("DELETE FROM ".bd()."rules WHERE uid='$_uid' AND rid='$_rid'");
         mysql_query("DELETE FROM ".bd()."actions WHERE uid='$_uid' AND rid='$_rid'");
         mysql_query("DELETE FROM ".bd()."matches WHERE uid='$_uid' AND rid='$_rid'");
+        /*
         foreach($philter->config['action_plugins'] as $plug)
             $plug->sql_clean($_uid, $_rid);
         foreach($philter->config['match_plugins'] as $plug)
             $plug->sql_clean($_uid, $_rid);
+        */
     }
     
     function sql_store($_uid, $_rid) {