more modules
[old-projects.git] / philter / philter / include / plugin_bogofilter.inc.php
index 54b02d4..a8b6fa8 100644 (file)
@@ -16,30 +16,26 @@ class BogoPlugin extends MatchPlugin {
     function is_global() { return true; }
 
     function to_string($_data) {
-        if($_data['data']=='off')
-            return "";
-
-        $res = ":0 HB\n"
-            .  "* ? bogofilter\n"
-            .  "{\n"
-            .  "    :0 c\n"
-            .  "    /var/mail/spam/\n"
-            .  "    :0 h\n"
-            .  "    SUBJECT=| formail -xSubject:\n"
-            .  "    :0 fhW\n"
-            .  "    | formail -I \"X-Spam-Flag: YES\" -i \"Subject: [Xorg:SPAM]$"."SUBJECT\"\n"
-            . ($_data["data"] == "drop" ? "    :0\n    /dev/null\n" : "")
-            .  "}\n"
-            .  ":0 Ec\n"
-            .  "/var/mail/nonspam/\n"
-            .  "\n";
-
-        return $res;
+        global $philter;
+        $bogo = $philter->config['path']['bogofilter'];
+        if($_data[1]==1)
+            return ":0 fw\n"
+                .  "| $bogo -u -e -p\n"
+                .  ":0 e\n"
+                .  "{ EXITCODE=75 HOST }\n"
+                .  "\n";
+        
+        if($_data[1]==2)
+            return ":0 HB:\n"
+                .  "* ? $bogo\n"
+                .  "/dev/null\n";
+            
+        return "";
     }
 
     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' "