X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=philter%2Fphilter%2Finclude%2Fplugin_bogofilter.inc.php;h=6abe3782dbd70d7fd4d77de01dc4bdde2c28ecd1;hb=refs%2Ftags%2FEKIT_0_9G;hp=cb0243ab4e13c39eb49a08c9387e3f5726e441fc;hpb=86b5093c27b4c24bf77edd715ed30967e89ff08f;p=old-projects.git diff --git a/philter/philter/include/plugin_bogofilter.inc.php b/philter/philter/include/plugin_bogofilter.inc.php index cb0243a..6abe378 100644 --- a/philter/philter/include/plugin_bogofilter.inc.php +++ b/philter/philter/include/plugin_bogofilter.inc.php @@ -10,42 +10,38 @@ 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"; - - return $res; + global $philter; + $bogo = $philter->config['path']['bogofilter']; + + if($_data[1]==1) + return "xfilter \"$bogo -u -e -p\"\n\n"; + + if($_data[1]==2) + return "xfilter \"$bogo -u -e -p\"\n" + . "if (/^X-Bogosity: Yes, tests=bogofilter/)\n" + . " exit\n\n"; + + return ""; } - function to_form() { + function to_form($_data) { $res = "\n" - . "\n"; - - $res .= "\n"; + . "\n"; + + $res .= "\n"; $res .= "\n" . "
BogoFilterTODO
"._i18n('1_bogo')."\n" + . " "._i18n('1_bogo_off')."
\n" + . " "._i18n('1_bogo_on')."
\n" + . " "._i18n('1_bogo_drop')."
\n" + . "
\n";