Browse Source

First crack at 725443.

Erin Schnabel 22 years ago
parent
commit
4626ea9a10
2 changed files with 14 additions and 3 deletions
  1. 9 2
      functions/imap_mailbox.php
  2. 5 1
      src/folders.php

+ 9 - 2
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);
 

+ 5 - 1
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 "</SELECT></TT>\n";
 if ($show_contain_subfolders_option) {