X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fmime%2FRfc822Header.class.php;h=2cc08f703ce786b3de058b16361ce346a0c0bed8;hp=d509503558afa892cc9b6c31019b3da2b65698ab;hb=8d2d85f59ea194a546f9d843dbaaaea1b76f5ac7;hpb=4b5049de2fa934c45599d6e4c74bf2bbee10d34d diff --git a/class/mime/Rfc822Header.class.php b/class/mime/Rfc822Header.class.php index d5095035..2cc08f70 100644 --- a/class/mime/Rfc822Header.class.php +++ b/class/mime/Rfc822Header.class.php @@ -29,6 +29,11 @@ class Rfc822Header { * @var mixed */ var $date = -1; + /** + * Original date header as fallback for unparsable dates + * @var mixed + */ + var $date_unparsed = ''; /** * Subject header * @var string @@ -234,6 +239,7 @@ class Rfc822Header { $d = strtr($value, array(' ' => ' ')); $d = explode(' ', $d); $this->date = getTimeStamp($d); + $this->date_unparsed = strtr($value,'<>',' '); break; case 'subject': $this->subject = $value; @@ -343,7 +349,7 @@ class Rfc822Header { $value = $this->stripComments($value); $this->mlist('id', $value); break; - case 'x-spam-status': + case 'x-spam-status': $this->x_spam_status = $this->parseSpamStatus($value); break; default: @@ -642,15 +648,16 @@ class Rfc822Header { * X-MS-Mail-Priority is not parsed because it always coincides * with one of the other headers. * - * NOTE: this is actually a duplicate from the function in - * functions/imap_messages. I'm not sure if it's ok here to call + * NOTE: this is actually a duplicate from the code in + * functions/imap_messages:parseFetch(). + * I'm not sure if it's ok here to call * that function? * @param string $sValue literal priority name * @return integer */ function parsePriority($sValue) { // don't use function call inside array_shift. - $aValue = split('/\w/',trim($sValue)); + $aValue = preg_split('/\s/',trim($sValue)); $value = strtolower(array_shift($aValue)); if ( is_numeric($value) ) { @@ -928,6 +935,7 @@ class Rfc822Header { } /** +//FIXME: This needs some documentation (inside the function too)! Don't code w/out comments! * @param mixed $address array or string * @param boolean $recurs * @return mixed array, boolean @@ -953,10 +961,10 @@ class Rfc822Header { $srch_addr = $this->parseAddress($address); $results = array(); foreach ($this->to as $to) { - if ($to->host == $srch_addr->host) { - if ($to->mailbox == $srch_addr->mailbox) { + if (strtolower($to->host) == strtolower($srch_addr->host)) { + if (strtolower($to->mailbox) == strtolower($srch_addr->mailbox)) { $results[] = $srch_addr; - if ($to->personal == $srch_addr->personal) { + if (strtolower($to->personal) == strtolower($srch_addr->personal)) { if ($recurs) { return array($results, true); } else { @@ -967,10 +975,10 @@ class Rfc822Header { } } foreach ($this->cc as $cc) { - if ($cc->host == $srch_addr->host) { - if ($cc->mailbox == $srch_addr->mailbox) { + if (strtolower($cc->host) == strtolower($srch_addr->host)) { + if (strtolower($cc->mailbox) == strtolower($srch_addr->mailbox)) { $results[] = $srch_addr; - if ($cc->personal == $srch_addr->personal) { + if (strtolower($cc->personal) == strtolower($srch_addr->personal)) { if ($recurs) { return array($results, true); } else {