From 6e2ae2646b4ce2fce87dabc760ebf71e47aaa3d2 Mon Sep 17 00:00:00 2001 From: ebullient Date: Thu, 1 May 2003 00:09:14 +0000 Subject: [PATCH] First crack at 725443. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4837 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 11 +++++++++-- src/folders.php | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index bb46e6f3..3a17cd66 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -419,8 +419,9 @@ function user_strcasecmp($a, $b) { * $folder_skip - array of folders to keep out of option list (compared in lower) * $boxes - list of already fetched boxes (for places like folder panel, where * you know these options will be shown 3 times in a row.. (most often unset). + * $parent - used to indicate whether or not listed boxes can be parents */ -function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0 ) { +function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $parent = false) { global $username, $data_dir; $mbox_options = ''; @@ -429,8 +430,14 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk if ($boxes == 0) { $boxes = sqimap_mailbox_list($imap_stream); } + if ($parent) { + $flag = 'noinferiors'; + } + else { + $flag = 'noselect'; + } foreach ($boxes as $boxes_part) { - if (!in_array('noselect', $boxes_part['flags'])) { + if (!in_array($flag, $boxes_part['flags'])) { $box = $boxes_part['unformatted']; $lowerbox = strtolower($box); diff --git a/src/folders.php b/src/folders.php index 182a1d3c..63b4ac22 100644 --- a/src/folders.php +++ b/src/folders.php @@ -119,7 +119,11 @@ if ( $default_sub_of_inbox == false ) { $show_selected = array('inbox'); } -echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, 'noinferiors'); +// Call sqimap_mailbox_option_list, using existing connection to IMAP server, +// the arrays of folders to include or skip (assembled above), +// and indicate that folders listed should be parents (we're creating folders, +// so we want to list the folders that can contain other folders) +echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, true); echo "\n"; if ($show_contain_subfolders_option) { -- 2.25.1