trying maildrop
[old-projects.git] / philter / philter / include / plugin_bogofilter.inc.php
CommitLineData
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
10class BogoPlugin extends MatchPlugin {
11 function BogoPlugin($_glob=false) { $this->MatchPlugin($_glob); }
12 function rtti() { return 1; }
de47756d 13 function name() { return _i18n('1_bogo'); }
dd8de1ec
PH
14
15 /* the plugin is only global */
16 function is_global() { return true; }
17
dd8de1ec 18 function to_string($_data) {
fd96b13f
PH
19 global $philter;
20 $bogo = $philter->config['path']['bogofilter'];
fd96b13f 21
5534b9a9
PH
22 if($_data[1]==1)
23 return "xfilter \"$bogo -u -e -p\"\n\n";
24
fd96b13f 25 if($_data[1]==2)
5534b9a9
PH
26 return "xfilter \"$bogo -u -e -p\"\n"
27 . "if (/^X-Bogosity: Yes, tests=bogofilter/)\n"
28 . " exit\n\n";
29
fd96b13f 30 return "";
dd8de1ec
PH
31 }
32
de47756d 33 function to_form($_data) {
86b5093c 34 $res = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n"
fe9450a2 35 . "<tr><th width=\"25%\">"._i18n('1_bogo')."</th>\n";
dd8de1ec 36
de47756d
PH
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";
dd8de1ec
PH
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?>