From 4c2d69acdad62c5b56c437debc24c7e75e3003cf Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 24 Nov 1999 16:57:46 +0000 Subject: [PATCH] * fixed so bottom delete button works * if only one message in mailbox, it now shows correctly * If no messages in mailbox, displays correctly git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@25 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 33 ++++++++++++++++++++++----------- src/right_main.php | 1 + 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 27ff6da2..16826bfa 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -14,12 +14,12 @@ echo "\n"; if ($seen == false) { - echo " \n"; + echo " \n"; echo " $senderName\n"; echo "
$dateString
\n"; echo " $subject\n"; } else { - echo " \n"; + echo " \n"; echo " $senderName\n"; echo "
$dateString
\n"; echo " $subject\n"; @@ -85,10 +85,13 @@ $numMessagesOld = $numMessages; $numMessages = $i - 1; - if ($sort == 0) - $msgs = ary_sort($msgs, "TIME_STAMP", -1); - else - $msgs = ary_sort($msgs, "TIME_STAMP", 1); + // There's gotta be messages in the array for it to sort them. + if ($numMessages > 0) { + if ($sort == 0) + $msgs = ary_sort($msgs, "TIME_STAMP", -1); + else + $msgs = ary_sort($msgs, "TIME_STAMP", 1); + } if ($startMessage + 24 < $numMessages) { $endMessage = $startMessage + 24; @@ -143,19 +146,27 @@ // loop through and display the info for each message. $t = 0; // $t is used for the checkbox number - for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) { + if ($numMessages == 0) { // if there's no messages in this folder + echo "

THIS FOLDER IS EMPTY
 
"; + } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different. + $i = $startMessage; printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]); - $t++; + } else { + for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) { + printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]); + $t++; + } } - echo "\n"; - echo "\n"; + echo ""; /** The "DELETE" button */ echo ""; - echo "
"; echo " selected messages"; echo ""; + echo "
\n"; + echo "\n"; + echo ""; if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { echo "Previous\n"; diff --git a/src/right_main.php b/src/right_main.php index cbc699f9..5c86e144 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -81,6 +81,7 @@ showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort); // close the connection + fputs($imapConnection, "1 logout\n"); fclose($imapConnection); ?> -- 2.25.1