make e-mail address and compare-address lowercase, thx to DasTho from the forum

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-07-10 13:45:52 +02:00
parent 1870a88f6b
commit 6d06187df4

View File

@@ -61,6 +61,8 @@ if($db->num_rows($result) > 0)
$ts_start = (int)$row['date_from']; $ts_start = (int)$row['date_from'];
$ts_end = (int)$row['date_until']; $ts_end = (int)$row['date_until'];
$row['email'] = strtolower($row['email']);
// not yet // not yet
if($ts_start != -1 && $ts_start > $ts_now) continue; if($ts_start != -1 && $ts_start > $ts_now) continue;
// already ended // already ended
@@ -134,24 +136,24 @@ if($db->num_rows($result) > 0)
if(!strlen($from) if(!strlen($from)
&& preg_match("/^From:(.+)<(.*)>$/", $line, $match) && preg_match("/^From:(.+)<(.*)>$/", $line, $match)
) { ) {
$from = $match[2]; $from = strtolower($match[2]);
} }
elseif(!strlen($from) elseif(!strlen($from)
&& preg_match("/^From:\s+(.*@.*)$/", $line, $match) && preg_match("/^From:\s+(.*@.*)$/", $line, $match)
) { ) {
$from = $match[1]; $from = strtolower($match[1]);
} }
//fetching to field //fetching to field
if((!strlen($to) || $to != $row['email']) if((!strlen($to) || $to != $row['email'])
&& preg_match("/^To:(.+)<(.*)>$/", $line, $match) && preg_match("/^To:(.+)<(.*)>$/", $line, $match)
) { ) {
$to = $match[2]; $to = strtolower($match[2]);
} }
elseif((!strlen($to) || $to != $row['email']) elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^To:\s+(.*@.*)$/", $line, $match) && preg_match("/^To:\s+(.*@.*)$/", $line, $match)
) { ) {
$to = $match[1]; $to = strtolower($match[1]);
} }
/* /*
* if we still don't have a To:-address * if we still don't have a To:-address
@@ -162,30 +164,31 @@ if($db->num_rows($result) > 0)
elseif((!strlen($to) || $to != $row['email']) elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^Cc:(.+)<(.*)>$/", $line, $match) && preg_match("/^Cc:(.+)<(.*)>$/", $line, $match)
) { ) {
$to = $match[2]; $to = strtolower($match[2]);
} }
elseif((!strlen($to) || $to != $row['email']) elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^Cc:\s+(.*@.*)$/", $line, $match) && preg_match("/^Cc:\s+(.*@.*)$/", $line, $match)
) { ) {
$to = $match[1]; $to = strtolower($match[1]);
} }
//fetching sender field //fetching sender field
if(!strlen($sender) if(!strlen($sender)
&& preg_match("/^Sender:(.+)<(.*)>$/", $line, $match) && preg_match("/^Sender:(.+)<(.*)>$/", $line, $match)
) { ) {
$sender = $match[2]; $sender = strtolower($match[2]);
} }
elseif(!strlen($sender) elseif(!strlen($sender)
&& preg_match("/Sender:\s+(.*@.*)$/", $line, $match) && preg_match("/Sender:\s+(.*@.*)$/", $line, $match)
) { ) {
$sender = $match[1]; $sender = strtolower($match[1]);
} }
//check for amavis/spamassassin spam headers //check for amavis/spamassassin spam headers
if(preg_match("/^X-Spam-Status: (Yes|No)(.*)$/", $line, $match)) if(preg_match("/^X-Spam-Status: (Yes|No)(.*)$/", $line, $match))
{ {
if($match[1] == 'Yes')$spam = true; if($match[1] == 'Yes')
$spam = true;
} }
//check for precedence header //check for precedence header