From 587ec647ab27414babdc9d7965365f579bcf6074 Mon Sep 17 00:00:00 2001 From: stekkel Date: Thu, 19 Jun 2003 12:58:43 +0000 Subject: [PATCH] Do utf7 decode after we created the tree, otherwise we cannot match 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 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 0a376ce2..67bf3e47 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -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]); + } + } +} + ?> -- 2.25.1