Explorar el Código

Fix message highlighting for text with spaces in it.

indiri69 hace 22 años
padre
commit
8818c6ee19
Se han modificado 1 ficheros con 9 adiciones y 8 borrados
  1. 9 8
      functions/mailbox_display.php

+ 9 - 8
functions/mailbox_display.php

@@ -74,7 +74,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $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.
@@ -95,9 +95,6 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
         }
     }
     $senderName = str_replace(' ',' ',$senderName);
-    $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']);
-    $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
-    $subject = str_replace(' ',' ',$subject);    
     echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
 
     if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
@@ -134,7 +131,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     } else {
         $searchstr = '';
     }
-    
+
     if (is_array($message_highlight_list) && count($message_highlight_list)) {
         $msg['TO'] = parseAddress($msg['TO']);
         $msg['CC'] = parseAddress($msg['CC']);
@@ -153,8 +150,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                         case('CC'):
                         case('FROM'):
                             foreach ($msg[$match_type] as $address) {
-                                $address[0] = decodeHeader($address[0]);
-                                $address[1] = decodeHeader($address[1]);
+                                $address[0] = decodeHeader($address[0], true, false);
+                                $address[1] = decodeHeader($address[1], true, false);
                                 if (strstr('^^' . strtolower($address[0]), $high_val) ||
                                     strstr('^^' . strtolower($address[1]), $high_val)) {
                                     $hlt_color = $message_highlight_list_part['color'];
@@ -163,7 +160,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                             }
                             break;
                         default:
-                            if (strstr('^^' . strtolower($msg[$match_type]), $high_val)) {
+                            $headertest = strtolower(decodeHeader($msg[$match_type], true, false));
+                            if (strstr('^^' . $headertest, $high_val)) {
                                 $hlt_color = $message_highlight_list_part['color'];
                                 break 3; 
                             }
@@ -179,6 +177,9 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     }
     $checked = ($checkall == 1) ? ' CHECKED' : '';
     $col = 0;
+    $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']);
+    $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
+    $subject = str_replace(' ',' ',$subject);    
     if (sizeof($index_order)) {
         foreach ($index_order as $index_order_part) {
             switch ($index_order_part) {