* $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 = '';
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);
$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 "</SELECT></TT>\n";
if ($show_contain_subfolders_option) {