Commit e4b1db2e authored by Marius Cramer's avatar Marius Cramer
Browse files

Fixed missing escape of " in sieve rules

parent d90ab94f
......@@ -141,13 +141,22 @@ class mail_user_filter_plugin {
$content .= 'if header :regex ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
$searchterm = preg_quote($page_form->dataRecord["searchterm"]);
$searchterm = str_replace('\\[', '\\\\[', $searchterm);
$searchterm = str_replace('\\]', '\\\\]', $searchterm);
$searchterm = str_replace(
array(
'"',
'\\[',
'\\]'
),
array(
'\\"',
'\\\\[',
'\\\\]'
), $searchterm);
if($page_form->dataRecord["op"] == 'contains') {
$content .= ".*".$searchterm;
} elseif ($page_form->dataRecord["op"] == 'is') {
$content .= $searchterm."$";
$content .= "^".$searchterm."$";
} elseif ($page_form->dataRecord["op"] == 'begins') {
$content .= " ".$searchterm."";
} elseif ($page_form->dataRecord["op"] == 'ends') {
......
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