Commit d907c0ce authored by Till Brehm's avatar Till Brehm
parent 8fa8ed5a
......@@ -137,41 +137,69 @@ class mail_user_filter_plugin {
$content .= '### BEGIN FILTER_ID:'.$page_form->id."\n";
//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
$content .= 'if header :regex ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
$searchterm = preg_quote($page_form->dataRecord["searchterm"]);
$searchterm = str_replace(
array(
'"',
'\\[',
'\\]'
),
array(
'\\"',
'\\\\[',
'\\\\]'
), $searchterm);
if($page_form->dataRecord["op"] == 'contains') {
$content .= ".*".$searchterm;
} elseif ($page_form->dataRecord["op"] == 'is') {
$content .= "^".$searchterm."$";
} elseif ($page_form->dataRecord["op"] == 'begins') {
$content .= " ".$searchterm."";
} elseif ($page_form->dataRecord["op"] == 'ends') {
$content .= ".*".$searchterm."$";
if($page_form->dataRecord["op"] == 'domain') {
$content .= 'if address :domain :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n";
} elseif ($page_form->dataRecord["op"] == 'localpart') {
$content .= 'if address :localpart :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n";
} elseif ($page_form->dataRecord["source"] == 'Size') {
if(substr(trim($page_form->dataRecord["searchterm"]),-1) == 'k' || substr(trim($page_form->dataRecord["searchterm"]),-1) == 'K') {
$unit = 'k';
} else {
$unit = 'm';
}
$content .= 'if size :over '.intval($page_form->dataRecord["searchterm"]).$unit.' {'."\n";
} else {
if($page_form->dataRecord["source"] == 'Header') {
$parts = explode(':',trim($page_form->dataRecord["searchterm"]));
$page_form->dataRecord["source"] = trim($parts[0]);
unset($parts[0]);
$page_form->dataRecord["searchterm"] = trim(implode(':',$parts));
unset($parts);
}
$content .= 'if header :regex ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
$searchterm = preg_quote($page_form->dataRecord["searchterm"]);
$searchterm = str_replace(
array(
'"',
'\\[',
'\\]'
),
array(
'\\"',
'\\\\[',
'\\\\]'
), $searchterm);
if($page_form->dataRecord["op"] == 'contains') {
$content .= ".*".$searchterm;
} elseif ($page_form->dataRecord["op"] == 'is') {
$content .= "^".$searchterm."$";
} elseif ($page_form->dataRecord["op"] == 'begins') {
$content .= " ".$searchterm."";
} elseif ($page_form->dataRecord["op"] == 'ends') {
$content .= ".*".$searchterm."$";
}
$content .= '"] {'."\n";
}
$content .= '"] {'."\n";
if($page_form->dataRecord["action"] == 'move') {
$content .= ' fileinto "'.$page_form->dataRecord["target"].'";' . "\n";
$content .= ' fileinto "'.$page_form->dataRecord["target"].'";' . "\n stop;\n";
} elseif ($page_form->dataRecord["action"] == 'keep') {
$content .= " keep;\n";
} elseif ($page_form->dataRecord["action"] == 'stop') {
$content .= " stop;\n";
} elseif ($page_form->dataRecord["action"] == 'reject') {
$content .= ' reject "'.$page_form->dataRecord["target"].'"; stop;\n\n';
} else {
$content .= " discard;\n";
$content .= " discard;\n stop;\n";
}
$content .= " stop;\n}\n";
$content .= "}\n";
$content .= '### END FILTER_ID:'.$page_form->id."\n";
......
......@@ -117,7 +117,7 @@ class bind_plugin {
//TODO : change this when distribution information has been integrated into server record
if (file_exists('/etc/gentoo-release')) {
$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
}
else {
$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
......@@ -151,7 +151,7 @@ class bind_plugin {
if($data['old']['origin'] != $data['new']['origin']) {
//TODO : change this when distribution information has been integrated into server record
if (file_exists('/etc/gentoo-release')) {
$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
$filename = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
}
else {
$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment