From: fidian Date: Mon, 23 Apr 2001 14:51:27 +0000 (+0000) Subject: * Finally fixed that weird To/Cc/Bcc bug (it might be with PHP or browsers X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=b87968812427ae41d8df87b6a919927809cebacb * Finally fixed that weird To/Cc/Bcc bug (it might be with PHP or browsers or whatnot -- but this now works properly). Bug description: - Add multiple people to your address book - Select lots for the To, and one for CC or BCC - When you return to the compose form, the To list would be right, but the CC and/or BCC list would have extra addresses appendeded. - Extremely weird. Seemed to have a cascading affect, as though the CC array needed to be >= the to array, and likewise for the BCC >= CC size. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1296 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 3602ef24..4ff7aca3 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -53,8 +53,9 @@ if(sizeof($res) <= 0) return; - printf('
'."\n", - $PHP_SELF); + echo '\n"; + echo ''; + echo "\n"; addr_insert_hidden(); $line = 0; @@ -69,22 +70,23 @@ print "\n"; - while(list($undef, $row) = each($res)) { - printf("". - " To". - " Cc ". - " Bcc ". - " %s  ". - "%s". - " %s ", - ($line % 2) ? " bgcolor=\"$color[0]\"" : "", - htmlspecialchars($row["email"]), htmlspecialchars($row["email"]), htmlspecialchars($row["email"]), - $row["name"], $row["email"], $row["label"]); + foreach ($res as $row) { + echo ''; + echo ' To '; + echo ' Cc '; + echo ' Bcc '; + echo ' ' . $row['name'] . ' '; + echo ' ' . $row['email'] . ' '; + echo ' ' . $row['label'] . ' '; if($includesource) - printf(" %s", $row["source"]); - - print "\n"; - $line++; + echo ' ' . $row['source'] . ' '; + echo "\n"; + $line ++; } printf('', diff --git a/src/compose.php b/src/compose.php index 33bc51d0..edec6ed0 100644 --- a/src/compose.php +++ b/src/compose.php @@ -446,30 +446,23 @@ } else if (isset($html_addr_search_done)) { displayPageHeader($color, $mailbox); - if (isset($send_to_search) && is_array($send_to_search)) - { - for ($i=0; $i < count($send_to_search); $i++) { - if ($send_to) - $send_to .= ", "; - $send_to .= $send_to_search[$i]; - } - } - - if (isset($send_to_cc_search) && is_array($send_to_cc_search)) - { - for ($i=0; $i < count($send_to_cc_search); $i++) { - if ($send_to_cc) - $send_to_cc .= ", "; - $send_to_cc .= $send_to_cc_search[$i]; - } - } - - if (isset($send_to_bcc_search) && is_array($send_to_bcc_search)) - { - for ($i=0; $i < count($send_to_bcc_search); $i++) { - if ($send_to_bcc) - $send_to_bcc .= ", "; - $send_to_bcc .= $send_to_bcc_search[$i]; + if (isset($send_to_search) && is_array($send_to_search)) { + foreach ($send_to_search as $k => $v) { + if (substr($k, 0, 1) == 'T') { + if ($send_to) + $send_to .= ', '; + $send_to .= $v; + } + elseif (substr($k, 0, 1) == 'C') { + if ($send_to_cc) + $send_to_cc .= ', '; + $send_to_cc .= $v; + } + elseif (substr($k, 0, 1) == 'B') { + if ($send_to_bcc) + $send_to_bcc .= ', '; + $send_to_bcc .= $v; + } } }