X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=3268d5c7326fcb401941a3efef7061e6a60fe1af;hp=e30254534dfc5a0a9f4b4adc8824238ceb11845c;hb=0fba4d30d140ce0f4b72925403c17fd4494acd77;hpb=6b6381715922c24dc8664cc62464096814d6a291
diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php
index e3025453..3268d5c7 100644
--- a/functions/mailbox_display.php
+++ b/functions/mailbox_display.php
@@ -14,12 +14,16 @@
global $color, $msgs, $msort;
global $sent_folder;
global $message_highlight_list;
+ global $index_order;
$msg = $msgs[$key];
$senderName = sqimap_find_displayable_name($msg["FROM"]);
$urlMailbox = urlencode($mailbox);
- $subject = trim(stripslashes($msg["SUBJECT"]));
+ $subject = trim($msg["SUBJECT"]);
+ if ($subject == "")
+ $subject = _("(no subject)");
+
echo "
\n";
if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = " "; }
@@ -27,15 +31,17 @@
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)
@@ -44,14 +50,45 @@
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";
+
+ for ($i=1; $i <= count($index_order); $i++) {
+ switch ($index_order[$i]) {
+ case 1: # checkbox
+ echo " \n";
+ break;
+ case 2: # from
+ echo " $italic$bold$flag$senderName$flag_end$bold_end$italic_end \n";
+ break;
+ case 3: # date
+ echo " $bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end \n";
+ break;
+ case 4: # subject
+ echo " $bold$flag$subject$flag_end $bold_end \n";
+ break;
+ case 5: # flags
+ $stuff = false;
+ echo " \n";
+ if ($msg["FLAG_ANSWERED"] == true) {
+ echo "A\n";
+ $stuff = true;
+ }
+ if ($msg["TYPE0"] == "multipart") {
+ echo "+\n";
+ $stuff = true;
+ }
+ if (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) {
+ echo "! \n";
+ $stuff = true;
+ }
+ if (!$stuff) echo " \n";
+ echo " \n";
+ break;
+ case 6: # size
+ echo " $bold".show_readable_size($msg['SIZE'])."$bold_end \n";
+ break;
+ }
+ }
+
echo " \n";
}
@@ -63,6 +100,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) {
@@ -78,6 +121,8 @@
$to[$q] = $hdr->to;
$priority[$q] = $hdr->priority;
$cc[$q] = $hdr->cc;
+ $size[$q] = $hdr->size;
+ $type[$q] = $hdr->type0;
$flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
}
@@ -98,6 +143,8 @@
$messages[$j]["TO"] = decodeHeader($to[$j]);
$messages[$j]["PRIORITY"] = $priority[$j];
$messages[$j]["CC"] = $cc[$j];
+ $messages[$j]["SIZE"] = $size[$j];
+ $messages[$j]["TYPE0"] = $type[$j];
# fix SUBJECT-SORT to remove Re:
if (substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "re:" ||
@@ -169,10 +216,7 @@
function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) {
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");
+ global $index_order;
// if cache isn't already set, do it now
if (!session_is_registered("msgs"))
@@ -180,12 +224,19 @@
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);
@@ -223,7 +274,7 @@
echo "";
echo "\n\n\n ";
echo "";
echo "";
echo "";
- echo " ";
- /** FROM HEADER **/
- if ($mailbox == $sent_folder)
- echo " ". _("To") ." ";
- else
- echo " ". _("From") ." ";
-
- if ($sort == 2)
- echo " \n";
- else if ($sort == 3)
- echo " \n";
- else
- echo " \n";
- /** DATE HEADER **/
- echo " ". _("Date") ." ";
- if ($sort == 0)
- echo " \n";
- else if ($sort == 1)
- echo " \n";
- else
- echo " \n";
- echo " \n";
- /** SUBJECT HEADER **/
- echo " ". _("Subject") ." \n";
- if ($sort == 4)
- echo " \n";
- else if ($sort == 5)
- echo " \n";
- else
- echo " \n";
+ for ($i=1; $i <= count($index_order); $i++) {
+ switch ($index_order[$i]) {
+ case 1: # checkbox
+ echo " ";
+ break;
+ case 2: # from
+ if ($mailbox == $sent_folder)
+ echo " ". _("To") ." ";
+ else
+ echo " ". _("From") ." ";
+
+ if ($sort == 2)
+ echo " \n";
+ else if ($sort == 3)
+ echo " \n";
+ else
+ echo " \n";
+ break;
+ case 3: # date
+ echo " ". _("Date") ." ";
+ if ($sort == 0)
+ echo " \n";
+ else if ($sort == 1)
+ echo " \n";
+ else
+ echo " \n";
+ break;
+ case 4: # subject
+ echo " ". _("Subject") ." \n";
+ if ($sort == 4)
+ echo " \n";
+ else if ($sort == 5)
+ echo " \n";
+ else
+ echo " \n";
+ break;
+ case 5: # flags
+ echo " \n";
+ break;
+ case 6: # size
+ echo " " . _("Size")." \n";
+ break;
+ }
+ }
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 "". _("THIS FOLDER IS EMPTY") ." ";
+ echo "". _("THIS FOLDER IS EMPTY") ." ";
} 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);
@@ -316,7 +384,7 @@
next($msort);
} while ($i < ($endMessage+1));
}
- echo "
";
+ echo "";
echo "\n";
echo " \n";
@@ -334,6 +402,7 @@
echo "" . _("Previous"). " | \n";
echo "" . _("Next") . " \n";
}
+ echo "";
echo ""; /** End of message-list table */
do_hook("mailbox_index_after");