X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=426609ed4aef42d66cdb22ea75721201eade1f94;hb=22476f18b2ff4ae81fd4a52e9f335691e31b7750;hp=79954364b39ed3b005ae1fa74b6397e14476d271;hpb=098ea084d624846de46648afacc0564d9f2c1959;p=squirrelmail.git diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 79954364..426609ed 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -37,7 +37,7 @@ function elapsed($start) function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $start_msg, $where, $what) { global $checkall, - $color, $msgs, $msort, + $color, $msgs, $msort, $td_str, $msg, $default_use_priority, $message_highlight_list, $index_order, @@ -73,11 +73,13 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, if (handleAsSent($mailbox)) { $msg['FROM'] = $msg['TO']; } + $msg['FROM'] = parseAddress($msg['FROM'],1); + /* * This is done in case you're looking into Sent folders, * because you can have multiple receivers. */ - + $senderNames = $msg['FROM']; $senderName = ''; if (sizeof($senderNames)){ @@ -91,11 +93,11 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $senderName .= htmlspecialchars($senderNames_part[0]); } } - } - - - $subject = processSubject(decodeHeader($msg['SUBJECT']), $indent_array[$msg['ID']]); + } + $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']); + $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]); + echo html_tag( 'tr','','','','VALIGN="top"') . "\n"; if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) { @@ -132,34 +134,40 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, } else { $searchstr = ''; } - /** - * AAAAH! Make my eyes stop bleeding! - * Who wrote this?! - */ - if (is_array($message_highlight_list) && count($message_highlight_list)){ + + if (is_array($message_highlight_list) && count($message_highlight_list)) { + $msg['TO'] = parseAddress($msg['TO']); + $msg['CC'] = parseAddress($msg['CC']); foreach ($message_highlight_list as $message_highlight_list_part) { if (trim($message_highlight_list_part['value']) != '') { $high_val = strtolower($message_highlight_list_part['value']); $match_type = strtoupper($message_highlight_list_part['match_type']); - if ($match_type == 'TO_CC') { - foreach ($msg['TO'] as $address) { - if (strstr('^^' . strtolower($address[0]), $high_val) || - strstr('^^' . strtolower($address[1]), $high_val)) { - $hlt_color = $message_highlight_list_part['color']; - continue; - } - } - foreach ($msg['CC'] as $address) { - if( strstr('^^' . strtolower($address[0]), $high_val) || - strstr('^^' . strtolower($address[1]), $high_val)) { - $hlt_color = $message_highlight_list_part['color']; - continue; - } - } + if($match_type == 'TO_CC') { + $match = array('TO', 'CC'); } else { - if (strstr('^^' . strtolower($msg[$match_type]), $high_val)) { - $hlt_color = $message_highlight_list_part['color']; - continue; + $match = array($match_type); + } + foreach($match as $match_type) { + switch($match_type) { + case('TO'): + case('CC'): + case('FROM'): + foreach ($msg[$match_type] as $address) { + $address[0] = decodeHeader($address[0]); + $address[1] = decodeHeader($address[1]); + if (strstr('^^' . strtolower($address[0]), $high_val) || + strstr('^^' . strtolower($address[1]), $high_val)) { + $hlt_color = $message_highlight_list_part['color']; + break 4; + } + } + break; + default: + if (strstr('^^' . strtolower($msg[$match_type]), $high_val)) { + $hlt_color = $message_highlight_list_part['color']; + break 3; + } + break; } } } @@ -209,7 +217,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $td_str .= ''; - $t = elapsed($start); - echo("elapsed time = $t seconds\n"); + //$t = elapsed($start); + //echo("elapsed time = $t seconds\n"); } function calc_msort($msgs, $sort) { @@ -505,8 +528,8 @@ function calc_msort($msgs, $sort) { return $msort; } -function fillMessageArray($imapConnection, $id, $count) { - return sqimap_get_small_header_list($imapConnection, $id); +function fillMessageArray($imapConnection, $id, $count, $show_num=false) { + return sqimap_get_small_header_list($imapConnection, $id, $show_num); } @@ -805,7 +828,7 @@ function printHeader($mailbox, $sort, $color, $showsort=true) { echo "\n"; break; case 6: /* size */ - echo html_tag( 'td', '' . _("Size") . '', 'center', '', 'width="5%"' ); + echo html_tag( 'td', '' . _("Size") . '', 'center', '', 'width="5%" nowrap' ); break; } } @@ -1152,23 +1175,29 @@ function processSubject($subject, $threadlevel = 0) { if (strlen($subject) <= $trim_at) return $subject; - $ent_strlen = strlen($subject); + $ent_strlen = $orig_len = strlen($subject); $trim_val = $trim_at - 5; $ent_offset = 0; /* * see if this is entities-encoded string * If so, Iterate through the whole string, find out * the real number of characters, and if more - * than 55, substr with an updated trim value. + * than 55, substr with an updated trim value. */ - - while ( (($ent_loc = strpos(substr($subject,0,$trim_val), '&', $ent_offset)) !== false) && - (($ent_loc_end = strpos(substr($subject,0,$trim_val+5), ';', $ent_loc)) !== false) ) { - $trim_val += ($ent_loc_end-$ent_loc)+1; - $ent_strlen -= $ent_loc_end-$ent_loc; + $step = $ent_loc = 0; + while ( $ent_loc < $trim_val && (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) && + (($ent_loc_end = strpos($subject, ';', $ent_loc+3)) !== false) ) { + $trim_val += ($ent_loc_end-$ent_loc); $ent_offset = $ent_loc_end+1; + ++$step; + } + + if (($trim_val > 50) && (strlen($subject) > ($trim_val))&& (strpos($subject,';',$trim_val) < ($trim_val +6))) { + $i = strpos($subject,';',$trim_val); + if ($i) { + $trim_val = strpos($subject,';',$trim_val); + } } - if ($ent_strlen <= $trim_at){ return $subject; } @@ -1177,7 +1206,6 @@ function processSubject($subject, $threadlevel = 0) { function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) { return $languages[$squirrelmail_language]['XTRA_CODE']('strimwidth', $subject, $trim_val); } - return substr($subject, 0, $trim_val) . '...'; } @@ -1228,4 +1256,5 @@ function handleAsSent($mailbox) { /* And return the result. */ return $handleAsSent_result; } + ?>