X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=638529a20701de8394c47b07d92f0d325c69fac6;hp=c5b304b1747dbdce161a30ed21a09b61c7b49093;hb=98fe1e9ffb8c254a739f853d3b83c667b9f9f65e;hpb=4bbba0d8cf096277dc7375cfb54193be092b83e5 diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index c5b304b1..638529a2 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -8,15 +8,16 @@ ** **/ - $mailbox_info = true; + $mailbox_display_php = true; - function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) { + function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) { global $color, $msgs, $msort; global $sent_folder; + global $message_highlight_list; $msg = $msgs[$key]; - $senderName = $msg["FROM"]; + $senderName = sqimap_find_displayable_name($msg["FROM"]); $urlMailbox = urlencode($mailbox); $subject = trim(stripslashes($msg["SUBJECT"])); echo "\n"; @@ -25,12 +26,32 @@ if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; } if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } - 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"; - if ($msg["FLAG_ANSWERED"] == true) echo " A"; - else echo "  "; - echo " $bold$flag$subject$flag_end$bold_end\n"; + for ($i=0; $i < count($message_highlight_list); $i++) { + if ($message_highlight_list[$i]["match_type"] == "to_cc") { + if (eregi($message_highlight_list[$i]["value"],$msg["TO"]) || eregi($message_highlight_list[$i]["value"],$msg["CC"])) { + $hlt_color = $message_highlight_list[$i]["color"]; + continue; + } + } else if (eregi($message_highlight_list[$i]["value"],$msg[strtoupper($message_highlight_list[$i]["match_type"])])) { + $hlt_color = $message_highlight_list[$i]["color"]; + continue; + } + } + + if (!$hlt_color) + $hlt_color = $color[4]; + + if ($where && $what) { + $search_stuff = "&where=".urlencode($where)."&what=".urlencode($what); + } + + 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"; + if ($msg["FLAG_ANSWERED"] == true) echo " A"; + elseif (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) echo " !"; + else echo "  "; + echo " $bold$flag$subject$flag_end$bold_end\n"; echo "\n"; } @@ -41,6 +62,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) { global $msgs, $msort; global $sent_folder; + global $message_highlight_list; if (!$use_cache) { if ($numMessages >= 1) { @@ -53,6 +75,9 @@ $from[$q] = $hdr->from; $date[$q] = $hdr->date; $subject[$q] = $hdr->subject; + $to[$q] = $hdr->to; + $priority[$q] = $hdr->priority; + $cc[$q] = $hdr->cc; $flags[$q] = sqimap_get_flags ($imapConnection, $q+1); } @@ -67,7 +92,17 @@ $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]); $messages[$j]["ID"] = $j+1; $messages[$j]["FROM"] = decodeHeader($from[$j]); + $messages[$j]["FROM-SORT"] = strtolower(sqimap_find_displayable_name(decodeHeader($from[$j]))); $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); + $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j])); + $messages[$j]["TO"] = decodeHeader($to[$j]); + $messages[$j]["PRIORITY"] = $priority[$j]; + $messages[$j]["CC"] = $cc[$j]; + + # fix SUBJECT-SORT to remove Re: + if (substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "re:" || + substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "aw:") + $messages[$j]["SUBJECT-SORT"] = trim(substr($messages[$j]["SUBJECT-SORT"], 3)); $num = 0; while ($num < count($flags[$j])) { @@ -111,13 +146,13 @@ ** 2 = Name (up) ** 3 = Name (dn) **/ - + session_unregister("msgs"); if (($sort == 0) || ($sort == 1)) $msort = array_cleave ($msgs, "TIME_STAMP"); if (($sort == 2) || ($sort == 3)) - $msort = array_cleave ($msgs, "FROM"); + $msort = array_cleave ($msgs, "FROM-SORT"); if (($sort == 4) || ($sort == 5)) - $msort = array_cleave ($msgs, "SUBJECT"); + $msort = array_cleave ($msgs, "SUBJECT-SORT"); if(($sort % 2) == 1) { asort($msort); @@ -127,6 +162,7 @@ session_register("msort"); } displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $msort, $mailbox, $sort, $color,$show_num); + session_register("msgs"); } // generic function to convert the msgs array into an HTML table @@ -155,29 +191,29 @@ $urlMailbox = urlencode($mailbox); /** This is the beginning of the message list table. It wraps around all messages */ - echo ""; + echo "
"; if ($startMessage < $endMessage) { echo "\n"; } else if ($startMessage == $endMessage) { echo "\n"; } echo "\n"; @@ -186,17 +222,19 @@ echo "
"; - echo "
". _("Viewing messages ") ."$startMessage". _(" to ") ."$endMessage ($numMessages total)
\n"; + echo "
". _("Viewing messages") ." $startMessage ". _("to") ." $endMessage ($numMessages " . _("total") . ")
\n"; echo "
"; - echo "
". _("Viewing message ") ."$startMessage ($numMessages ". _("total") .")
\n"; + echo "
". _("Viewing message") ." $startMessage ($numMessages " . _("total") . ")
\n"; echo "
"; 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 "". _("Previous") ." | \n"; + echo ""._("Next")."\n"; } else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) { - echo "Previous\n"; + echo ""._("Previous")." | \n"; echo "". _("Next") ."\n"; } echo "
"; echo "\n\n\n
"; - echo "\n"; + echo "
\n"; echo " \n"; - echo " "; echo "
\n"; + echo " \n"; echo " ". _("Move selected to:") .""; echo " "; echo " \n"; @@ -211,7 +249,7 @@ echo "
"; - echo ""; + echo "
"; echo ""; echo " "; /** FROM HEADER **/ @@ -250,7 +288,7 @@ // 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; reset($msort); @@ -259,7 +297,7 @@ next($msort); $k++; } while (isset ($key) && ($k < $i)); - printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage); + printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, 0, 0); } else { $i = $startMessage; reset($msort); @@ -270,7 +308,7 @@ } while (isset ($key) && ($k < $i)); do { - printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage); + printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, 0, 0); $key = key($msort); $t++; $i++; @@ -284,17 +322,17 @@ echo "
 

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

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