From e7681707b665cbdd5e7c91c3416a3899fa62da8b Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 31 Jan 2001 14:10:30 +0000 Subject: [PATCH] fixed bug that always showed CC header even when no CC was available to display git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1001 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/read_body.php | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/read_body.php b/src/read_body.php index e0777db5..c35e5d11 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -241,38 +241,39 @@ /** FORMAT THE CC STRING **/ $i = 0; - $cc_string = ""; - $cc_ary = $message->header->cc; - while ($i < count(decodeHeader($cc_ary))) { - $cc_ary[$i] = htmlspecialchars($cc_ary[$i]); - if ($cc_string) - $cc_string = "$cc_string
$cc_ary[$i]"; - else - $cc_string = "$cc_ary[$i]"; - - $i++; - if (count($cc_ary) > 1) { - if ($show_more_cc == false) { - if ($i == 1) { + if (isset ($message->header->cc[0]) && trim($message->header->cc[0])){ + $cc_string = ""; + $cc_ary = $message->header->cc; + while ($i < count(decodeHeader($cc_ary))) { + $cc_ary[$i] = htmlspecialchars($cc_ary[$i]); + if ($cc_string) + $cc_string = "$cc_string
$cc_ary[$i]"; + else + $cc_string = "$cc_ary[$i]"; + + $i++; + if (count($cc_ary) > 1) { + if ($show_more_cc == false) { + if ($i == 1) { + if ($where && $what) { + // from a search + $cc_string = "$cc_string ($echo_more)"; + } else { + $cc_string = "$cc_string ($echo_more)"; + } + $i = count($cc_ary); + } + } else if ($i == 1) { if ($where && $what) { // from a search - $cc_string = "$cc_string ($echo_more)"; + $cc_string = "$cc_string ($echo_less)"; } else { - $cc_string = "$cc_string ($echo_more)"; + $cc_string = "$cc_string ($echo_less)"; } - $i = count($cc_ary); } - } else if ($i == 1) { - if ($where && $what) { - // from a search - $cc_string = "$cc_string ($echo_less)"; - } else { - $cc_string = "$cc_string ($echo_less)"; - } } } } - /** make sure everything will display in HTML format **/ $from_name = decodeHeader(htmlspecialchars($message->header->from)); $subject = decodeHeader(htmlspecialchars($message->header->subject)); @@ -378,7 +379,7 @@ echo " \n"; echo " \n"; /** cc **/ - if ($message->header->cc) { + if (isset($cc_string)) { echo " \n"; echo " \n"; echo " Cc:\n"; -- 2.25.1