more modules
[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'];
21 if($_data[1]==1)
22 return ":0 fw\n"
23 . "| $bogo -u -e -p\n"
24 . ":0 e\n"
25 . "{ EXITCODE=75 HOST }\n"
26 . "\n";
27
28 if($_data[1]==2)
29 return ":0 HB:\n"
30 . "* ? $bogo\n"
31 . "/dev/null\n";
32
33 return "";
dd8de1ec
PH
34 }
35
de47756d 36 function to_form($_data) {
86b5093c 37 $res = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n"
fe9450a2 38 . "<tr><th width=\"25%\">"._i18n('1_bogo')."</th>\n";
dd8de1ec 39
de47756d
PH
40 $res .= "<td><input type='hidden' name='global[1][0]' value='1' />\n"
41 . " <input type='radio' name='global[1][1]' value='0' "
42 . ($_data[1]==0 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_off')."<br />\n"
43 . " <input type='radio' name='global[1][1]' value='1' "
44 . ($_data[1]==1 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_on')."<br />\n"
45 . " <input type='radio' name='global[1][1]' value='2' "
46 . ($_data[1]==2 ? 'checked="checked "' : '')."/>"._i18n('1_bogo_drop')."<br />\n"
47 . "</td>\n";
dd8de1ec
PH
48
49 $res .= "</tr>\n"
50 . "</table>\n";
51
52 return $res;
53 }
54}
55
56/********************************************************************************
57* $Id$
58* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
59********************************************************************************/
60?>