procmail generation TODO: implement each plugin. plugins : forward, header,
[old-projects.git] / philter / philter / include / plugin_bogofilter.inc.php
index cb0243a..e50488d 100644 (file)
 class BogoPlugin extends MatchPlugin {
     function BogoPlugin($_glob=false) { $this->MatchPlugin($_glob); }
     function rtti() { return 1; }
-    function name() { return "AntiSpam"; }
+    function name() { return _i18n('1_bogo'); }
 
     /* the plugin is only global */
     function is_global() { return true; }
 
-    function sql_store($_uid, $_rid, $_data) {
-        return "INSERT INTO matches SET uid='$_uid',rid='$_rid',pid='".$this->rtti()."',data='{$_data['data']}';\n";
-    }
-
     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";
-
+        $res = "\n";
         return $res;
     }
 
-    function to_form() {
+    function to_form($_data) {
         $res =  "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n"
-            .   "<tr><th width=\"25%\">BogoFilter</th>\n";
-
-        $res .= "<td>TODO</td>\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' "
+            .   ($_data[1]==0 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_off')."<br />\n"
+            .   "    <input type='radio' name='global[1][1]' value='1' "
+            .   ($_data[1]==1 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_on')."<br />\n"
+            .   "    <input type='radio' name='global[1][1]' value='2' "
+            .   ($_data[1]==2 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_drop')."<br />\n"
+            .   "</td>\n";
 
         $res .= "</tr>\n"
             .   "</table>\n";