First crack at 725443.
authorebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 1 May 2003 00:09:14 +0000 (00:09 +0000)
committerebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 1 May 2003 00:09:14 +0000 (00:09 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4837 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php
src/folders.php

index bb46e6f3e7959e2d5ffbce86545fb66ed874fdc8..3a17cd662d3a75b79c8693fddd8401b86c31bf5b 100755 (executable)
@@ -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);
 
index 182a1d3cb2e50bd32b4998c7fab75bd92815451f..63b4ac221eb9cfd6bba1ce097791a902c95b9b88 100644 (file)
@@ -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 "</SELECT></TT>\n";
 if ($show_contain_subfolders_option) {