X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=e4d3c6816d33eb1502c9d31f175e74fec830a8ab;hb=e4821f6c30b9211cf836ae706aa79356f780bb0a;hp=d1589cd5f0d2ba11cb9280c23f7a0397b29a8631;hpb=1195c34026fc65eb8e0ca7a337fe4b406764dee8;p=squirrelmail.git diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index d1589cd5..e4d3c681 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -10,7 +10,7 @@ $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; @@ -19,7 +19,7 @@ $senderName = sqimap_find_displayable_name($msg["FROM"]); $urlMailbox = urlencode($mailbox); - $subject = trim(stripslashes($msg["SUBJECT"])); + $subject = trim($msg["SUBJECT"]); echo "\n"; if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = ""; } @@ -27,26 +27,34 @@ if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } 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"])) { + if (trim($message_highlight_list[$i]["value"]) != "") { + if ($message_highlight_list[$i]["match_type"] == "to_cc") { + if (strpos("^^".strtolower($msg["TO"]), strtolower($message_highlight_list[$i]["value"])) || strpos("^^".strtolower($msg["CC"]), strtolower($message_highlight_list[$i]["value"]))) { + $hlt_color = $message_highlight_list[$i]["color"]; + continue; + } + } else if (strpos("^^".strtolower($msg[strtoupper($message_highlight_list[$i]["match_type"])]),strtolower($message_highlight_list[$i]["value"]))) { $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 " \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"; + + if ($msg["FLAG_ANSWERED"] == true) echo " A\n"; + elseif (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) echo " !\n"; + else echo "  \n"; + echo " $bold$flag$subject$flag_end$bold_end\n"; echo "\n"; } @@ -58,6 +66,12 @@ global $msgs, $msort; global $sent_folder; global $message_highlight_list; + global $auto_expunge; + + if ($auto_expunge) { + sqimap_mailbox_expunge($imapConnection, $mailbox); + sqimap_mailbox_select($imapConnection, $mailbox); + } if (!$use_cache) { if ($numMessages >= 1) { @@ -87,10 +101,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])) { @@ -138,9 +159,9 @@ 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); @@ -158,50 +179,54 @@ 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 cache isn't already set, do it now if (!session_is_registered("msgs")) session_register("msgs"); if (!session_is_registered("msort")) session_register("msort"); + if ($startMessage + ($show_num - 1) < $numMessages) { $endMessage = $startMessage + ($show_num-1); } else { $endMessage = $numMessages; } - + + if ($endMessage < $startMessage) { + $startMessage = $startMessage - $show_num; + if ($startMessage < 1) + $startMessage = 1; + } + $nextGroup = $startMessage + $show_num; $prevGroup = $startMessage - $show_num; $urlMailbox = urlencode($mailbox); + do_hook("mailbox_index_before"); /** 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"; @@ -210,9 +235,10 @@ 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"; + do_hook("mailbox_form_before"); + echo "
\n"; echo " \n"; - echo " "; echo "
\n"; + echo " \n"; echo " ". _("Move selected to:") .""; echo "
"; - echo ""; + echo "
"; echo ""; echo " "; /** FROM HEADER **/ @@ -278,14 +304,14 @@ if ($numMessages == 0) { // if there's no messages in this folder echo ""; } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different. - $i = $startMessage - 1; + $i = $startMessage; reset($msort); do { $key = key($msort); 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); @@ -296,7 +322,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++; @@ -310,18 +336,19 @@ echo "
 

". _("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 */ + do_hook("mailbox_index_after"); } ?>