Commit | Line | Data |
---|---|---|
dd8de1ec PH |
1 | <?php |
2 | /******************************************************************************** | |
3 | * include/plugin_bogofilter.inc.php : A Match Plugin using bogofilter | |
4 | * --------------------------------- | |
5 | * | |
6 | * This file is part of the philter distribution | |
7 | * Copyright: See COPYING files that comes with this distribution | |
8 | ********************************************************************************/ | |
9 | ||
10 | class BogoPlugin extends MatchPlugin { | |
11 | function BogoPlugin($_glob=false) { $this->MatchPlugin($_glob); } | |
12 | function rtti() { return 1; } | |
13 | function name() { return "AntiSpam"; } | |
14 | ||
15 | /* the plugin is only global */ | |
16 | function is_global() { return true; } | |
17 | ||
18 | function sql_store($_uid, $_rid, $_data) { | |
19 | return "INSERT INTO matches SET uid='$_uid',rid='$_rid',pid='".$this->rtti()."',data='{$_data['data']}';\n"; | |
20 | } | |
21 | ||
22 | function to_string($_data) { | |
23 | if($_data['data']=='off') | |
24 | return ""; | |
25 | ||
26 | $res = ":0 HB\n" | |
27 | . "* ? bogofilter\n" | |
28 | . "{\n" | |
29 | . " :0 c\n" | |
30 | . " /var/mail/spam/\n" | |
31 | . " :0 h\n" | |
32 | . " SUBJECT=| formail -xSubject:\n" | |
33 | . " :0 fhW\n" | |
34 | . " | formail -I \"X-Spam-Flag: YES\" -i \"Subject: [Xorg:SPAM]$"."SUBJECT\"\n" | |
35 | . ($_data["data"] == "drop" ? " :0\n /dev/null\n" : "") | |
36 | . "}\n" | |
37 | . ":0 Ec\n" | |
38 | . "/var/mail/nonspam/\n" | |
39 | . "\n"; | |
40 | ||
41 | return $res; | |
42 | } | |
43 | ||
44 | function to_form() { | |
45 | $res = "<table width=\"100%\">\n" | |
46 | . "<tr><th width=\"25%\">BogoFilter</th>\n"; | |
47 | ||
48 | $res .= "<td>TODO</td>\n"; | |
49 | ||
50 | $res .= "</tr>\n" | |
51 | . "</table>\n"; | |
52 | ||
53 | return $res; | |
54 | } | |
55 | } | |
56 | ||
57 | /******************************************************************************** | |
58 | * $Id$ | |
59 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: | |
60 | ********************************************************************************/ | |
61 | ?> |