Browse Source

Fix for bug number 110588. Addresses listed in the CC field of reply all messages never get double commas now.

mattphillips 25 years ago
parent
commit
bfe087e99f
2 changed files with 19 additions and 7 deletions
  1. 5 6
      functions/strings.php
  2. 14 1
      src/read_body.php

+ 5 - 6
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;
    }

+ 14 - 1
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);