浏览代码

Make identities matching case insensitive

pdontthink 18 年之前
父节点
当前提交
310d01467d
共有 2 个文件被更改,包括 8 次插入7 次删除
  1. 7 6
      class/mime/Rfc822Header.class.php
  2. 1 1
      src/compose.php

+ 7 - 6
class/mime/Rfc822Header.class.php

@@ -935,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 mixed $address array or string
      * @param boolean $recurs
      * @param boolean $recurs
      * @return mixed array, boolean
      * @return mixed array, boolean
@@ -960,10 +961,10 @@ class Rfc822Header {
             $srch_addr = $this->parseAddress($address);
             $srch_addr = $this->parseAddress($address);
             $results = array();
             $results = array();
             foreach ($this->to as $to) {
             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;
                         $results[] = $srch_addr;
-                        if ($to->personal == $srch_addr->personal) {
+                        if (strtolower($to->personal) == strtolower($srch_addr->personal)) {
                             if ($recurs) {
                             if ($recurs) {
                                 return array($results, true);
                                 return array($results, true);
                             } else {
                             } else {
@@ -974,10 +975,10 @@ class Rfc822Header {
                 }
                 }
             }
             }
             foreach ($this->cc as $cc) {
             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;
                         $results[] = $srch_addr;
-                        if ($cc->personal == $srch_addr->personal) {
+                        if (strtolower($cc->personal) == strtolower($srch_addr->personal)) {
                             if ($recurs) {
                             if ($recurs) {
                                 return array($results, true);
                                 return array($results, true);
                             } else {
                             } else {

+ 1 - 1
src/compose.php

@@ -855,7 +855,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
         if (count($idents) > 1) {
         if (count($idents) > 1) {
             foreach($idents as $nr=>$data) {
             foreach($idents as $nr=>$data) {
                 $enc_from_name = '"'.$data['full_name'].'" <'. $data['email_address'].'>';
                 $enc_from_name = '"'.$data['full_name'].'" <'. $data['email_address'].'>';
-                if($enc_from_name == $orig_from) {
+                if(strtolower($enc_from_name) == strtolower($orig_from)) {
                     $identity = $nr;
                     $identity = $nr;
                     break;
                     break;
                 }
                 }