trying maildrop
[old-projects.git] / philter / philter / include / plugin_bogofilter.inc.php
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 _i18n('1_bogo'); }
14
15 /* the plugin is only global */
16 function is_global() { return true; }
17
18 function to_string($_data) {
19 global $philter;
20 $bogo = $philter->config['path']['bogofilter'];
21
22 if($_data[1]==1)
23 return "xfilter \"$bogo -u -e -p\"\n\n";
24
25 if($_data[1]==2)
26 return "xfilter \"$bogo -u -e -p\"\n"
27 . "if (/^X-Bogosity: Yes, tests=bogofilter/)\n"
28 . " exit\n\n";
29
30 return "";
31 }
32
33 function to_form($_data) {
34 $res = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n"
35 . "<tr><th width=\"25%\">"._i18n('1_bogo')."</th>\n";
36
37 $res .= "<td><input type='hidden' name='global[1][0]' value='1' />\n"
38 . " <input type='radio' name='global[1][1]' value='0' "
39 . ($_data[1]==0 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_off')."<br />\n"
40 . " <input type='radio' name='global[1][1]' value='1' "
41 . ($_data[1]==1 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_on')."<br />\n"
42 . " <input type='radio' name='global[1][1]' value='2' "
43 . ($_data[1]==2 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_drop')."<br />\n"
44 . "</td>\n";
45
46 $res .= "</tr>\n"
47 . "</table>\n";
48
49 return $res;
50 }
51 }
52
53 /********************************************************************************
54 * $Id$
55 * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
56 ********************************************************************************/
57 ?>