From: mattphillips Date: Mon, 31 Jul 2000 21:31:20 +0000 (+0000) Subject: Fix for bug number 110588. Addresses listed in the CC field of reply all messages... X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=b676ba7e1210f474881c43a9aa48a9c4d402fe76 Fix for bug number 110588. Addresses listed in the CC field of reply all messages never get double commas now. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@662 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/strings.php b/functions/strings.php index c3f2e4c0..ca54ee84 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -103,12 +103,11 @@ /** Returns a line of comma separated email addresses from an array **/ function getLineOfAddrs($array) { - $to_line = ""; - for ($i = 0; $i < count($array); $i++) { - if ($to_line) - $to_line = "$to_line, $array[$i]"; - else - $to_line = "$array[$i]"; + if (is_array($array)) { + $to_line = implode(", ", $array); + $to_line = trim(ereg_replace(",,+", ",", $to_line)); + } else { + $to_line = ""; } return $to_line; } diff --git a/src/read_body.php b/src/read_body.php index bd9fa35a..dd597f5a 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -121,7 +121,20 @@ $url_replyto = urlencode($message->header->replyto); $url_replytoall = urlencode($message->header->replyto); - $url_replytoallcc = urlencode(getLineOfAddrs($message->header->to) . ", " . getLineOfAddrs($message->header->cc)); + $url_replytoallcc = getLineOfAddrs($message->header->to); + $url_replytoallcc_cc = getLineOfAddrs($message->header->cc); + if ($url_replytoallcc) { + if ($url_replytoallcc_cc) { + $url_replytoallcc .= ", " . $url_replytoallcc_cc; + } + } else { + if ($url_replytoallcc_cc) { + $url_replytoallcc = $url_replytoallcc_cc; + } else { + $url_replytoallcc = ""; + } + } + $url_replytoallcc = urlencode($url_replytoallcc); $dateString = getLongDateString($message->header->date); $ent_num = findDisplayEntity($message);