X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=8ffb15e62ce9c6a24f16e542fe057ab2b3f8d063;hp=cd25b137d29f2c7e7088b0af2aa591396dcd1761;hb=591000ec59a6ae1088df08a48e65bb6652fc63a7;hpb=8e9e8afac7b50a90520dd86c7d8efdfd3ee62d7a diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index cd25b137..8ffb15e6 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -10,8 +10,11 @@ $mailbox_info = true; - function printMessageInfo($imapConnection, $t, $msg, $mailbox, $sort, $startMessage) { - global $color; + function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) { + global $color, $msgs, $msort; + global $sent_folder; + + $msg = $msgs[$key]; $senderName = $msg["FROM"]; $urlMailbox = urlencode($mailbox); @@ -20,12 +23,14 @@ if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = ""; } if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; } - if ($msg["FLAG_ANSWERED"] == true) { $ans = " [A]"; } + if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } - echo " \n"; - echo " $bold$flag$senderName$flag_end$bold_end\n"; + echo " \n"; + echo " $italic$bold$flag$senderName$flag_end$bold_end$italic_end\n"; echo "
$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end
\n"; - echo " $bold$flag$subject$flag_end$ans$bold_end\n"; + if ($msg["FLAG_ANSWERED"] == true) echo " A"; + else echo "  "; + echo " $bold$flag$subject$flag_end$bold_end\n"; echo "\n"; } @@ -35,15 +40,20 @@ **/ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) { global $msgs, $msort; - include ("../config/config.php"); + global $sent_folder; if (!$use_cache) { if ($numMessages >= 1) { for ($q = 0; $q < $numMessages; $q++) { - sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d); - $from[$q] = $f; - $date[$q] = $d; - $subject[$q] = $s; + if ($mailbox == $sent_folder) + $hdr = sqimap_get_small_header ($imapConnection, $q+1, true); + else + $hdr = sqimap_get_small_header ($imapConnection, $q+1, false); + + $from[$q] = $hdr->from; + $date[$q] = $hdr->date; + $subject[$q] = $hdr->subject; + $flags[$q] = sqimap_get_flags ($imapConnection, $q+1); } } @@ -102,7 +112,13 @@ ** 3 = Name (dn) **/ - $msort = array_cleave ($msgs, "TIME_STAMP"); + if (($sort == 0) || ($sort == 1)) + $msort = array_cleave ($msgs, "TIME_STAMP"); + if (($sort == 2) || ($sort == 3)) + $msort = array_cleave ($msgs, "FROM"); + if (($sort == 4) || ($sort == 5)) + $msort = array_cleave ($msgs, "SUBJECT"); + if(($sort % 2) == 1) { asort($msort); } else { @@ -115,11 +131,12 @@ // generic function to convert the msgs array into an HTML table function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) { - global $folder_prefix; + global $folder_prefix, $sent_folder; + global $imapServerAddress; // do a check to see if the config stuff has already been included or not - if (!isset($imapServerAddress)) - include("../config/config.php"); +// if (!isset($imapServerAddress)) +// include("../config/config.php"); // if cache isn't already set, do it now if (!session_is_registered("msgs")) @@ -145,30 +162,30 @@ echo "
". _("Viewing messages ") ."$startMessage". _(" to ") ."$endMessage ($numMessages total)
\n"; echo "\n"; } else if ($startMessage == $endMessage) { - echo "\"TD>"; + echo ""; echo "
". _("Viewing message ") ."$startMessage ($numMessages ". _("total") .")
\n"; echo "\n"; } echo ""; if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { - echo "". _("Previous") ."\n"; - echo "". _("Next") ."\n"; + echo "". _("Previous") ."\n"; + echo "". _("Next") ."\n"; } else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) { - echo "". _("Previous") ."\n"; + echo "". _("Previous") ."\n"; echo "Next\n"; } else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) { echo "Previous\n"; - echo "". _("Next") ."\n"; + echo "". _("Next") ."\n"; } echo "\n"; /** The delete and move options */ echo ""; - echo "\n\n\n
"; + echo "\n\n\n"; echo "\n"; echo " \n"; echo "
\n"; @@ -196,41 +213,53 @@ echo "
"; echo ""; echo ""; - echo " "; + echo " "; /** FROM HEADER **/ - echo " \n"; + echo " \n"; else if ($sort == 3) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; /** DATE HEADER **/ - echo " \n"; + echo " \n"; else if ($sort == 1) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; + echo " \n"; /** SUBJECT HEADER **/ echo " \n"; + echo " \n"; else if ($sort == 5) - echo " \n"; + echo " \n"; else - echo " \n"; + echo " \n"; + echo ""; // loop through and display the info for each message. $t = 0; // $t is used for the checkbox number if ($numMessages == 0) { // if there's no messages in this folder - echo ""; + echo ""; } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different. $i = $startMessage - 1; - printMessageInfo($imapConnection, $t, $msgs[$i], $mailbox, $sort, $startMessage); + reset($msort); + do { + $key = key($msort); + next($msort); + $k++; + } while (isset ($key) && ($k < $i)); + printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage); } else { $i = $startMessage; reset($msort); @@ -241,7 +270,7 @@ } while (isset ($key) && ($k < $i)); do { - printMessageInfo($imapConnection, $t, $msgs[$key], $mailbox, $sort, $startMessage); + printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage); $key = key($msort); $t++; $i++; @@ -255,17 +284,18 @@ echo "
  ". _("From") .""; + if ($mailbox == $sent_folder) + echo " ". _("To") .""; + else + echo " ". _("From") .""; + if ($sort == 2) - echo " ". _("Date") .""; + echo " ". _("Date") .""; if ($sort == 0) - echo "  ". _("Subject") ."\n"; if ($sort == 4) - echo "

". _("THIS FOLDER IS EMPTY") ."
 

". _("THIS FOLDER IS EMPTY") ."
 
"; if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { - echo "" . _("Previous") . "\n"; - echo "" . _("Next") . "\n"; + echo "" . _("Previous") . "\n"; + echo "" . _("Next") . "\n"; } else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) { - echo "" . _("Previous") . "\n"; + echo "" . _("Previous") . "\n"; echo "" . _("Next") . "\n"; } else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) { echo "Previous\n"; - echo "" . _("Next") . "\n"; + echo "" . _("Next") . "\n"; } echo "
"; /** End of message-list table */ + } ?>