}
/** function that writes the procmailrc.
+ * @param &$procmail the string containing the procmail filter
+ * @param $filename the base filename of the procmailrc filter
* @return true if all is ok
*/
- function write_procmailrc() {
- // TODO
+ function write_procmailrc(&$procmail, $filename) {
+ $file = $philter->config['path']['spool']."/".$filename;
+ $f = fopen($file.".tmp", "w");
+ fwrite($f, $procmail, strlen($procmail));
+ fclose($f);
+ rename($file.".tmp", $file);
return true;
}
$res = ($this->block ? ":0\n" : ":0 c\n");
foreach($this->matches as $match)
- $res .= $philter->['config']['match_plugins'][$match[0]]->to_string($match);
+ $res .= $philter->config['match_plugins'][$match[0]]->to_string($match);
$res.= "{\n";
foreach($this->actions as $action)
- $res .= $philter->['config']['actioh_plugins'][$action[0]]->to_string($action);
+ $res .= $philter->config['actioh_plugins'][$action[0]]->to_string($action);
$res.= "}\n\n";
return $res;
if(isset($_POST['filter_valid']) && $philter->is_advanced()) {
$philter->del_advanced();
to_main(get_user_id());
+ $PHILTER_HAS_TO_BE_WRITTEN=true;
}
if(isset($_POST['filter_cancel']) && $philter->is_advanced()) {
$mail_pool = new EmailPool(get_user_id());
$filter = new Filter(get_user_id());
+if(isset($PHILTER_HAS_TO_BE_WRITTEN) && $PHILTER_HAS_TO_BE_WRITTEN) {
+ unset($PHILTER_HAS_TO_BE_WRITTEN);
+ $philter->write_procmailrc($filter->to_string(), get_filename());
+}
+
if($philter->is_advanced())
require("include/form_filter.inc.php");
else
return false;
}
+function get_filename() { return get_user_id(); };
+
session_start();
?>