X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=a4823676e6bab7fa0a30aff1fcb57c89c9a23a4a;hp=6b74424ba307122f10304b090d0e5f5f82d52563;hb=ac53fb5645d47313e6efe3327b57f0e2a30327c1;hpb=6b8a49c9f38f3b34e2ae11763d95535cf5c7c853
diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php
index 6b74424b..a4823676 100644
--- a/functions/mailbox_display.php
+++ b/functions/mailbox_display.php
@@ -9,7 +9,9 @@
** $Id$
**/
- $mailbox_display_php = true;
+ if (defined('mailbox_display_php'))
+ return;
+ define('mailbox_display_php', true);
function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) {
global $checkall;
@@ -18,82 +20,92 @@
global $message_highlight_list;
global $index_order;
+ $color_string = $color[4];
+ if ($GLOBALS['alt_index_colors']) {
+ if (!isset($GLOBALS["row_count"])) {
+ $GLOBALS["row_count"] = 0;
+ }
+ $GLOBALS["row_count"]++;
+ if ($GLOBALS["row_count"] % 2) {
+ if (!isset($color[12])) $color[12] = "#EAEAEA";
+ $color_string = $color[12];
+ }
+ }
+
$msg = $msgs[$key];
- $senderName = sqimap_find_displayable_name($msg["FROM"]);
+ $senderName = sqimap_find_displayable_name($msg['FROM']);
$urlMailbox = urlencode($mailbox);
- $subject = trim($msg["SUBJECT"]);
- if ($subject == "")
- $subject = _("(no subject)");
+ $subject = processSubject($msg['SUBJECT']);
echo "
\n";
- if (isset($msg['FLAG_FLAGGED']) && $msg["FLAG_FLAGGED"] == true)
+ if (isset($msg['FLAG_FLAGGED']) && $msg['FLAG_FLAGGED'] == true)
{
$flag = "";
- $flag_end = "";
+ $flag_end = '';
}
else
{
- $flag = "";
- $flag_end = "";
+ $flag = '';
+ $flag_end = '';
}
- if (isset($msg['FLAG_SEEN']) && $msg["FLAG_SEEN"] == false)
+ if (!isset($msg['FLAG_SEEN']) || $msg['FLAG_SEEN'] == false)
{
- $bold = "";
- $bold_end = "";
+ $bold = '';
+ $bold_end = '';
}
else
{
- $bold = "";
- $bold_end = "";
+ $bold = '';
+ $bold_end = '';
}
if ($mailbox == $sent_folder)
{
- $italic = "";
- $italic_end = "";
+ $italic = '';
+ $italic_end = '';
}
else
{
- $italic = "";
- $italic_end = "";
+ $italic = '';
+ $italic_end = '';
}
- if (isset($msg['FLAG_DELETED']) && $msg["FLAG_DELETED"])
+ if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'])
{
$fontstr = "";
- $fontstr_end = "";
+ $fontstr_end = '';
}
else
{
- $fontstr = "";
- $fontstr_end = "";
+ $fontstr = '';
+ $fontstr_end = '';
}
for ($i=0; $i < count($message_highlight_list); $i++) {
- 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"];
+ 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"];
+ } 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;
}
}
}
if (!isset($hlt_color))
- $hlt_color = $color[4];
+ $hlt_color = $color_string;
if ($where && $what) {
- $search_stuff = "&where=".urlencode($where)."&what=".urlencode($what);
+ $search_stuff = '&where='.urlencode($where).'&what='.urlencode($what);
}
if ($checkall == 1)
- $checked = " checked";
+ $checked = ' checked';
else
- $checked = "";
+ $checked = '';
for ($i=1; $i <= count($index_order); $i++) {
switch ($index_order[$i]) {
@@ -108,34 +120,28 @@
break;
case 4: # subject
echo " $bold";
- if (! isset($search_stuff))
- $search_stuff = "";
- echo "$flag";
- if (strlen($subject) > 55)
- echo substr($subject, 0, 50) . "...";
- else
- echo $subject;
- echo "$flag_end$bold_end | \n";
+ if (! isset($search_stuff)) { $search_stuff = ''; }
+ echo "$flag$subject$flag_end$bold_end\n";
break;
case 5: # flags
$stuff = false;
echo " \n";
if (isset($msg['FLAG_ANSWERED']) &&
- $msg["FLAG_ANSWERED"] == true) {
+ $msg['FLAG_ANSWERED'] == true) {
echo "A\n";
$stuff = true;
}
- if ($msg["TYPE0"] == "multipart") {
+ if ($msg['TYPE0'] == 'multipart') {
echo "+\n";
$stuff = true;
}
- if (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) {
+ if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
echo "!\n";
$stuff = true;
}
- if (isset($msg['FLAG_DELETED']) && $msg["FLAG_DELETED"]) {
+ if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
echo "D\n";
$stuff = true;
}
@@ -231,47 +237,57 @@
$j = 0;
if ($sort == 6) {
$end = $startMessage + $show_num - 1;
+ if ($numMessages < $show_num)
+ $end_loop = $numMessages;
+ elseif ($end > $numMessages)
+ $end_loop = $numMessages - $startMessage + 1;
+ else
+ $end_loop = $show_num;
} else {
$end = $numMessages;
+ $end_loop = $end;
}
- if ($end > $numMessages) $end = $numMessages;
- while ($j < $end) {
- $date[$j] = ereg_replace(" ", " ", $date[$j]);
- $tmpdate = explode(" ", trim($date[$j]));
-
- $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate);
- $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]);
- $messages[$j]["ID"] = $id[$j];
- $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];
- $messages[$j]["SIZE"] = $size[$j];
- $messages[$j]["TYPE0"] = $type[$j];
+ while ($j < $end_loop) {
+ if (isset($date[$j])) {
+ $date[$j] = ereg_replace(' ', ' ', $date[$j]);
+ $tmpdate = explode(' ', trim($date[$j]));
+ } else {
+ $tmpdate = $date = array("","","","","","");
+ }
+
+ $messages[$j]['TIME_STAMP'] = getTimeStamp($tmpdate);
+ $messages[$j]['DATE_STRING'] = getDateString($messages[$j]['TIME_STAMP']);
+ $messages[$j]['ID'] = $id[$j];
+ $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];
+ $messages[$j]['SIZE'] = $size[$j];
+ $messages[$j]['TYPE0'] = $type[$j];
# fix SUBJECT-SORT to remove Re:
$re_abbr = # Add more here!
- "vedr|sv|" . # Danish
- "re|aw"; # English
+ 'vedr|sv|' . # Danish
+ 're|aw'; # English
if (eregi("^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs))
$messages[$j]['SUBJECT-SORT'] = $regs[2];
$num = 0;
while ($num < count($flags[$j])) {
- if ($flags[$j][$num] == "Deleted") {
- $messages[$j]["FLAG_DELETED"] = true;
+ if ($flags[$j][$num] == 'Deleted') {
+ $messages[$j]['FLAG_DELETED'] = true;
}
- elseif ($flags[$j][$num] == "Answered") {
- $messages[$j]["FLAG_ANSWERED"] = true;
+ elseif ($flags[$j][$num] == 'Answered') {
+ $messages[$j]['FLAG_ANSWERED'] = true;
}
- elseif ($flags[$j][$num] == "Seen") {
- $messages[$j]["FLAG_SEEN"] = true;
+ elseif ($flags[$j][$num] == 'Seen') {
+ $messages[$j]['FLAG_SEEN'] = true;
}
- elseif ($flags[$j][$num] == "Flagged") {
- $messages[$j]["FLAG_FLAGGED"] = true;
+ elseif ($flags[$j][$num] == 'Flagged') {
+ $messages[$j]['FLAG_FLAGGED'] = true;
}
$num++;
}
@@ -281,13 +297,13 @@
/* Only ignore messages flagged as deleted if we are using a
* trash folder or auto_expunge */
if (((isset($move_to_trash) && $move_to_trash)
- || (isset($auto_expunge) && $auto_expunge)) && $sort != 6)
+ || (isset($auto_expunge) && $auto_expunge)) && $sort != 6)
{
/** Find and remove the ones that are deleted */
$i = 0;
$j = 0;
while ($j < $numMessages) {
- if ($messages[$j]["FLAG_DELETED"] == true) {
+ if (isset($messages[$j]['FLAG_DELETED']) && $messages[$j]['FLAG_DELETED'] == true) {
$j++;
continue;
}
@@ -298,8 +314,8 @@
}
$numMessages = $i;
} else {
- if (! isset($messages))
- $messages = array();
+ if (! isset($messages))
+ $messages = array();
$msgs = $messages;
}
}
@@ -313,11 +329,11 @@
**/
session_unregister("msgs");
if (($sort == 0) || ($sort == 1))
- $msort = array_cleave ($msgs, "TIME_STAMP");
+ $msort = array_cleave ($msgs, 'TIME_STAMP');
if (($sort == 2) || ($sort == 3))
- $msort = array_cleave ($msgs, "FROM-SORT");
+ $msort = array_cleave ($msgs, 'FROM-SORT');
if (($sort == 4) || ($sort == 5))
- $msort = array_cleave ($msgs, "SUBJECT-SORT");
+ $msort = array_cleave ($msgs, 'SUBJECT-SORT');
if ($sort == 6)
$msort = $msgs;
@@ -328,10 +344,10 @@
arsort($msort);
}
}
- session_register("msort");
+ session_register('msort');
}
displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $msort, $mailbox, $sort, $color,$show_num);
- session_register("msgs");
+ session_register('msgs');
}
// generic function to convert the msgs array into an HTML table
@@ -341,10 +357,10 @@
global $index_order, $real_endMessage, $real_startMessage, $checkall;
// 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 (!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);
@@ -362,7 +378,7 @@
$prevGroup = $startMessage - $show_num;
$urlMailbox = urlencode($mailbox);
- do_hook("mailbox_index_before");
+ do_hook('mailbox_index_before');
$Message = '';
if ($startMessage < $endMessage) {
@@ -421,7 +437,7 @@
else
$i = 1;
reset($msort);
- $k = 0;
+ $k = 0;
do {
$key = key($msort);
next($msort);
@@ -432,7 +448,7 @@
$i = $startMessage;
reset($msort);
- $k = 0;
+ $k = 0;
do {
$key = key($msort);
next($msort);
@@ -447,24 +463,21 @@
next($msort);
} while ($i && $i < $endVar);
}
- echo "";
+ echo '';
echo " |
\n";
echo "