Do utf7 decode after we created the tree, otherwise we cannot match
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Jun 2003 12:58:43 +0000 (12:58 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Jun 2003 12:58:43 +0000 (12:58 +0000)
unsubscribed parent_boxes. Besides it's more efficient

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5093 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php

index 0a376ce2318856fc07ef73b28dfbf7eebd78d633..67bf3e4741b675d08f286e079338966a4c520412 100755 (executable)
@@ -42,7 +42,7 @@ class mailboxes {
                 } else {
                     $no_select_mbx->mailboxname_full = $ary[$i];
                 }
-                $no_select_mbx->mailboxname_sub = imap_utf7_decode_local($ary[$i]);
+                $no_select_mbx->mailboxname_sub = $ary[$i];
                 $no_select_mbx->is_noselect = true;
                 $mbx_parent->mbxs[] = $no_select_mbx;
                 $i--;
@@ -814,6 +814,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false) {
     $trail_del = false;
     $start = 0;
 
+
     if (isset($folder_prefix) && ($folder_prefix != '')) {
         $start = substr_count($folder_prefix,$delimiter);
         if (strrpos($folder_prefix, $delimiter) == (strlen($folder_prefix)-1)) {
@@ -863,16 +864,27 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false) {
 
             $r_del_pos = strrpos($mbx_ary[$i]['mbx'], $delimiter);
             if ($r_del_pos) {
-                $mbx->mailboxname_sub = imap_utf7_decode_local(substr($mbx_ary[$i]['mbx'],$r_del_pos+1));
+                $mbx->mailboxname_sub = substr($mbx_ary[$i]['mbx'],$r_del_pos+1);
             } else {   /* mailbox is root folder */
-                $mbx->mailboxname_sub = imap_utf7_decode_local($mbx_ary[$i]['mbx']);
+                $mbx->mailboxname_sub = $mbx_ary[$i]['mbx'];
             }
             $mbx->mailboxname_full = $mbx_ary[$i]['mbx'];
 
             $mailboxes->addMbx($mbx, $delimiter, $start, $list_special_folders_first);
         }
     }
+    sqimap_utf7_decode_mbx_tree($mailboxes);
     return $mailboxes;
 }
 
+function sqimap_utf7_decode_mbx_tree(&$mbx_tree) {
+   $mbx_tree->mailboxname_sub=imap_utf7_decode_local($mbx_tree->mailboxname_sub);
+   if ($mbx_tree->mbxs) {
+      $iCnt = count($mbx_tree->mbxs);
+      for ($i=0;$i<$iCnt;++$i) {
+         $mbxs_tree->mbxs[$i] = sqimap_utf7_decode_mbx_tree($mbx_tree->mbxs[$i]);
+      }
+   }
+}      
+
 ?>