From: lkehresman Date: Mon, 22 Nov 1999 21:20:08 +0000 (+0000) Subject: Next/previous is working a bit better X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=54a8ae32ccfb5259f230e5d2b55e1ccdd3752d76;hp=926da13e320077a43c18149ae43f64403bfff62f Next/previous is working a bit better git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@17 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/date.php3 b/functions/date.php3 index b24b46fa..83aae61a 100644 --- a/functions/date.php3 +++ b/functions/date.php3 @@ -141,7 +141,7 @@ } function getTimeStamp($dateParts) { - if (eregi("mon|tue|wed|thu|fri|sat|sun", $dateParts[0], $tmp)) { +// if (eregi("mon|tue|wed|thu|fri|sat|sun", $dateParts[0], $tmp)) { $d[0] = getHour($dateParts[4]); $d[1] = getMinute($dateParts[4]); $d[2] = getSecond($dateParts[4]); @@ -149,13 +149,13 @@ $d[4] = getDayOfMonth($dateParts[1]); $d[5] = getYear($dateParts[3]); return mktime($d[0], $d[1], $d[2], $d[3], $d[4], $d[5]); - } - $d[0] = getHour($dateParts[3]); - $d[1] = getMinute($dateParts[3]); - $d[2] = getSecond($dateParts[3]); - $d[3] = getMonthNum($dateParts[1]); - $d[4] = getDayOfMonth($dateParts[0]); - $d[5] = getYear($dateParts[2]); - return mktime($d[0], $d[1], $d[2], $d[3], $d[4], $d[5]); +// } +// $d[0] = getHour($dateParts[3]); +// $d[1] = getMinute($dateParts[3]); +// $d[2] = getSecond($dateParts[3]); +// $d[3] = getMonthNum($dateParts[1]); +// $d[4] = getDayOfMonth($dateParts[0]); +// $d[5] = getYear($dateParts[2]); +// return mktime($d[0], $d[1], $d[2], $d[3], $d[4], $d[5]); } ?> diff --git a/functions/mailbox.php3 b/functions/mailbox.php3 index bb7a00a2..4508e419 100644 --- a/functions/mailbox.php3 +++ b/functions/mailbox.php3 @@ -58,10 +58,10 @@ $read = substr($read, strpos($read, "FLAGS")+6, strlen($read)); $read = trim($read); $flags = explode(" ", $read);; - $i = 0; - while ($i < count($flags)) { - $flags[$i] = substr($flags[$i], 1, strlen($flags[$i])); - $i++; + $s = 0; + while ($s < count($flags)) { + $flags[$s] = substr($flags[$s], 1, strlen($flags[$s])); + $s++; } } else { $flags[0] = "None"; diff --git a/functions/mailbox_display.php3 b/functions/mailbox_display.php3 index 83bcca29..2666e3a8 100644 --- a/functions/mailbox_display.php3 +++ b/functions/mailbox_display.php3 @@ -7,10 +7,7 @@ ** **/ - function printMessageInfo($imapConnection, $i, $from, $subject, $date, $answered, $seen) { -// getMessageHeaders($imapConnection, $i, $from, $subject, $date); - $dateParts = explode(" ", trim($date)); - $dateString = getDateString($dateParts); // this will reformat the date string into a good format for us. + function printMessageInfo($imapConnection, $i, $from, $subject, $dateString, $answered, $seen) { $senderName = getSenderName($from); if (strlen(Chop($subject)) == 0) $subject = "(no subject)"; @@ -34,18 +31,17 @@ ** This function loops through a group of messages in the mailbox and shows them **/ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort) { - $i = 1; + $i = 0; $j = 1; while ($j <= $numMessages) { getMessageHeaders($imapConnection, $j, $from, $subject, $date); getMessageFlags($imapConnection, $j, $flags); - echo "$date --"; - $messages[$i]["DATE"] = getTimeStamp(explode(" ", trim($date))); + $messages[$i]["TIME_STAMP"] = getTimeStamp(explode(" ", trim($date))); + $messages[$i]["DATE_STRING"] = getDateString(explode(" ", trim($date))); $messages[$i]["ID"] = $j; $messages[$i]["FROM"] = $from; $messages[$i]["SUBJECT"] = $subject; -// echo "$messages[$i][\"DATE\"]
"; $messages[$i]["FLAG_DELETED"] = false; $messages[$i]["FLAG_ANSWERED"] = false; @@ -71,10 +67,9 @@ $numMessages = $i; if ($sort == 0) - $msgs = ary_sort($messages, "DATE", -1); + $msgs = ary_sort($messages, "TIME_STAMP", -1); else - $msgs = ary_sort($messages, "DATE", 1); - + $msgs = ary_sort($messages, "TIME_STAMP", 1); if ($startMessage + 24 < $numMessages) { $nextGroup = $startMessage + 24 + 1; // +1 to go to beginning of next group @@ -118,8 +113,8 @@ echo ""; // loop through and display the info for each message. - for ($i = $startMessage;$i <= $endMessage; $i++) { - printMessageInfo($imapConnection, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]); + for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) { + printMessageInfo($imapConnection, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]); } echo "\n"; diff --git a/src/right_main.php3 b/src/right_main.php3 index eb8e3782..ab5cd7dc 100644 --- a/src/right_main.php3 +++ b/src/right_main.php3 @@ -74,7 +74,7 @@ // switch to the mailbox, and get the number of messages in it. selectMailbox($imapConnection, $mailbox, $numMessages); - $numMessages = $numMessages - 1; // I did this so it's 0 based like the message array +// $numMessages = $numMessages - 1; // I did this so it's 0 based like the message array // make a URL safe $mailbox for use in the links $urlMailbox = urlencode($mailbox);