From 199446c16d91b62e9924e7fff8d8a869175c0c85 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 02 Mar 2015 06:59:48 -0500
Subject: [PATCH] Fix so localized folder name is displayed in multi-folder search result (#1490243)

---
 program/steps/mail/func.inc |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 6423636..341c14b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -399,6 +399,7 @@
         $head_replace = true;
     }
 
+    $delimiter   = $RCMAIL->storage->get_hierarchy_delimiter();
     $search_set  = $RCMAIL->storage->get_search_set();
     $multifolder = $search_set && $search_set[1]->multi;
 
@@ -489,8 +490,16 @@
                 $cont = show_bytes($header->$col);
             else if ($col == 'date')
                 $cont = $RCMAIL->format_date($header->date);
-            else if ($col == 'folder')
-                $cont = rcube::Q(rcube_charset::convert($header->folder, 'UTF7-IMAP'));
+            else if ($col == 'folder') {
+                if ($last_folder !== $header->folder) {
+                    $last_folder      = $header->folder;
+                    $last_folder_name = rcube_charset::convert($last_folder, 'UTF7-IMAP');
+                    $last_folder_name = $RCMAIL->localize_foldername($last_folder_name, true);
+                    $last_folder_name = str_replace($delimiter, " \xC2\xBB ", $last_folder_name);
+                }
+
+                $cont = rcube::Q($last_folder_name);
+            }
             else
                 $cont = rcube::Q($header->$col);
 
@@ -815,7 +824,7 @@
     $wash_opts = array(
         'show_washed'   => false,
         'allow_remote'  => $p['safe'],
-        'blocked_src'   => "./program/resources/blocked.gif",
+        'blocked_src'   => 'program/resources/blocked.gif',
         'charset'       => RCUBE_CHARSET,
         'cid_map'       => $cid_replaces,
         'html_elements' => array('body'),
@@ -1959,9 +1968,16 @@
 // Fixes some content-type names
 function rcmail_fix_mimetype($name)
 {
+    $map = array(
+        'image/x-ms-bmp' => 'image/bmp', // #1490282
+    );
+
+    if ($alias = $map[strtolower($name)]) {
+        $name = $alias;
+    }
     // Some versions of Outlook create garbage Content-Type:
     // application/pdf.A520491B_3BF7_494D_8855_7FAC2C6C0608
-    if (preg_match('/^application\/pdf.+/', $name)) {
+    else if (preg_match('/^application\/pdf.+/', $name)) {
         $name = 'application/pdf';
     }
     // treat image/pjpeg (image/pjpg, image/jpg) as image/jpeg (#1489097)

--
Gitblit v1.9.1