this is a fix for the LSUB with a % when getting the folder list. This makes the...
[squirrelmail.git] / functions / imap_mailbox.php
index f3121520b047c36bce384b93b0616b7ee7cb4f3d..53a586d2490914f402140ffd919aa3c28dcf996a 100755 (executable)
@@ -437,14 +437,14 @@ function user_strcasecmp($a, $b) {
  * See comment on sqimap_mailbox_parse() for info about the returned array.
  */
 function sqimap_mailbox_list($imap_stream) {
-    global $boxesnew, $default_folder_prefix;
+    global $default_folder_prefix;
 
     if ( !isset( $boxesnew ) ) {
 
         global $data_dir, $username, $list_special_folders_first,
                $folder_prefix, $trash_folder, $sent_folder, $draft_folder,
                $move_to_trash, $move_to_sent, $save_as_draft,
-               $delimiter;
+               $delimiter, $noselect_fix_enable;
 
         $inbox_in_list = false;
         $inbox_subscribed = false;
@@ -452,10 +452,17 @@ function sqimap_mailbox_list($imap_stream) {
         require_once('../src/load_prefs.php');
         require_once('../functions/array.php');
 
+    if ($noselect_fix_enable) {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*%\"";
+    }
+    else {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*\"";
+    }
         /* LSUB array */
-        $lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*%\"",
+        $lsub_ary = sqimap_run_command ($imap_stream, $lsub_args,
                                         true, $response, $message);
 
+
         /*
          * Section about removing the last element was removed 
          * We don't return "* OK" anymore from sqimap_read_data