global $mail_pool,$philter;
$res = "# generated by philter\n"
. "# vim:set syntax=procmail:\n"
- . "\n"
- . ":0 f\n"
- . "|formail -I'X-Philter-Or'\n"
. "\n";
foreach($this->rules as $id=>$rule)
function Philter() {
$this->config = array(
'db' => array('host', 'name', 'user', 'pwd', 'link'),
- 'path' => array('procmail', 'spool'),
+ 'path' => array('spool'),
'match_plugins' => array(),
'action_plugins' => array(),
'global_plugins' => array(),
fwrite($f, $procmail, strlen($procmail));
fclose($f);
rename($file.".tmp", $file);
+ echo "<pre>\n";
+ echo $procmail;
+ echo "</pre>\n";
return true;
}
$uid = get_user_id();
$text = explode("\n",$_data[1]);
$res = " :0 hc\n"
- . " *X-Philter-Autoreply: $uid"
- . " | ( formail -rA'X-Philter-Autoreply: $uid; \ \n";
+ . " * !^FROM_DAEMON\n"
+ . " * !^X-Philter-Autoreply: $uid\n"
+ . " | ( formail -rI'Precedence: junk' -A'X-Philter-Autoreply: $uid; \ \n";
foreach($text as $line)
- $res .= " echo ".escapeshellarg($line)."; \ \n";
+ $res .= " echo ".escapeshellarg(chop($line))."; \ \n";
$res.= " ) | $"."SENDMAIL -oi -t\n";
return $res;
}
function is_global() { return true; }
function to_string($_data) {
- $res = "\n";
- return $res;
+ global $philter;
+ $bogo = $philter->config['path']['bogofilter'];
+ if($_data[1]==1)
+ return ":0 fw\n"
+ . "| $bogo -u -e -p\n"
+ . ":0 e\n"
+ . "{ EXITCODE=75 HOST }\n"
+ . "\n";
+
+ if($_data[1]==2)
+ return ":0 HB:\n"
+ . "* ? $bogo\n"
+ . "/dev/null\n";
+
+ return "";
}
function to_form($_data) {
function to_string() {
global $philter;
+ $bloc = "{\n";
+ foreach($this->actions as $action)
+ $bloc .= $philter->config['action_plugins'][$action[0]]->to_string($action);
+ $bloc.= " :0\n"
+ . " /dev/null\n"
+ . "}\n";
+
$res = $this->block ? ":0\n" : ":0 c\n";
if($this->all) {
foreach($this->matches as $match)
$res .= $philter->config['match_plugins'][$match[0]]->to_string($match);
+ $res .= $bloc;
} else {
$i = 0; $res = '';
foreach($this->matches as $match) {
- $res .= (empty($i) ? ":0 f\n" : ":0 fE\n");
+ $res .= (empty($i) ? ":0\n" : ":0 E\n");
$res .= $philter->config['match_plugins'][$match[0]]->to_string($match);
- $res .= "| formail -I'X-Philter-Or: yes'\n";
+ $res .= $bloc;
$i++;
}
-
- $res.= ":0 f\n"
- . "* ^X-Philter-Or: yes\n"
- . "| formail -I'X-Philter-Or'\n"
- . ($this->block ? ":0 A\n" : ":0 Ac\n");
}
- $res.= "{\n";
- foreach($this->actions as $action)
- $res .= $philter->config['action_plugins'][$action[0]]->to_string($action);
- $res.= " :0\n"
- . " /dev/null\n"
- . "}\n\n";
-
- return $res;
+ return $res."\n";
}
function sql_clean($_uid, $_rid) {
* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-
$philter = new Philter();
/********** LOCALE **********/
/********** PATHS **********/
-$philter->config['path']['procmail'] = "/usr/bin/procmail";
-$philter->config['path']['spool'] = "/var/spool/philter";
+$philter->config['path']['bogofilter'] = "/usr/bin/bogfilter -d /var/mail/.bogofilter";
+$philter->config['path']['spool'] = "/var/spool/philter";
/********** PLUGINS **********/