From 4002354021d08a99f572eb33fa009ac4cc86de4c Mon Sep 17 00:00:00 2001 From: fidian Date: Wed, 31 Jan 2001 18:03:55 +0000 Subject: [PATCH] $header->cc, $header->to, $header->bcc should always be an array Removed checks for the "always array" stuff Made Reply To All addresses unique using PHP 4.0.0 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1010 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 4 ++-- src/read_body.php | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index 57833735..9f0a8805 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -25,8 +25,8 @@ /** could be in a header. **/ var $type0 = '', $type1 = '', $boundary = '', $charset = ''; - var $encoding = '', $size = 0, $to = '', $from = '', $date = ''; - var $cc = '', $bcc = '', $reply_to = '', $subject = ''; + var $encoding = '', $size = 0, $to = array(), $from = '', $date = ''; + var $cc = array(), $bcc = array(), $reply_to = '', $subject = ''; var $id = 0, $mailbox = '', $description = '', $filename = ''; var $entity_id = 0, $message_id = 0; } diff --git a/src/read_body.php b/src/read_body.php index c35e5d11..ef59d765 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -165,8 +165,6 @@ // add them to the list. Remove duplicates. // This is somewhat messy, so I'll explain: // 1) Take all addresses (from, to, cc) (avoid nasty join errors here) - if (!is_array($message->header->to)) { $message->header->cc = array($message->header->to); } - if (!is_array($message->header->cc)) { $message->header->cc = array($message->header->cc); } $url_replytoall_extra_addrs = array_merge(array($message->header->from), $message->header->to, $message->header->cc); @@ -177,9 +175,9 @@ $url_replytoall_extra_addrs = parseAddrs($url_replytoall_extra_addrs); // 4) Make them unique -- weed out duplicates - if (function_exists("array_unique")) { - $url_replytoall_extra_addrs = array_unique($url_replytoall_extra_addrs); - } + // (Coded for PHP 4.0.0) + $url_replytoall_extra_addrs = + array_keys(array_flip($url_replytoall_extra_addrs); // 5) Remove the addresses we'll be sending the message 'to' $url_replytoall_avoid_addrs = parseAddrs($message->header->replyto); -- 2.25.1