* Sieve/Felamimail|Mail:Make exclamation mark (\!) in the begining of sieve rule query escapable from always bien used as NOT conditon

This commit is contained in:
Hadi Nategh 2014-03-13 13:16:09 +00:00
parent 8d3a2d0007
commit b429fe8ef6
2 changed files with 23 additions and 16 deletions

View File

@ -938,21 +938,28 @@ class mail_sieve
function setMatchType (&$matchstr, $regex = false)
{
$match = lang('contains');
if (preg_match("/\s*!/", $matchstr))
if (preg_match("/^\s*!/", $matchstr))
$match = lang('does not contain');
if (preg_match("/\*|\?/", $matchstr))
{
$match = lang('matches');
if (preg_match("/\s*!/", $matchstr))
if (preg_match("/^\s*!/", $matchstr))
$match = lang('does not match');
}
if ($regex)
{
$match = lang('matches regexp');
if (preg_match("/\s*!/", $matchstr))
if (preg_match("/^\s*!/", $matchstr))
$match = lang('does not match regexp');
}
if ($regex && preg_match("/^\s*\\\\!/", $matchstr))
{
$matchstr = preg_replace("/^\s*\\\\!/","!",$matchstr);
}
else
{
$matchstr = preg_replace("/^\s*!/","",$matchstr);
}
return $match;
}

View File

@ -77,7 +77,7 @@
</row>
</rows>
</grid>
<description value="(*) wildcards (*,?) may be used. If you are trying to match * or ? itself, you must escape them with a backslash (\). If you check &quot;Use regular expressions&quot; you must use valid regular expressions."/>
<description value='(*) wildcards (*,?) may be used. If you are trying to match * or ? itself, you must escape them with a backslash (\). If you check &quot;Use regular expressions&quot; you must use valid regular expressions. In order to escape of exclamation mark (!) at the begining not being used as "NOT", use regex and backslash (\) (e.g. \!)'/>
</groupbox>
</row>
<row>