Doh! Left an extra curly brace.
[squirrelmail.git] / functions / imap_mailbox.php
index f88a5995e287c4ef166927e3c091a435ad7e3dff..e879466937288e240a02b88c47c505786fadf5f0 100755 (executable)
@@ -7,6 +7,10 @@
     **  $Id$
     **/
 
+   if (defined ('imap_mailbox_php'))
+      return;
+   define ('imap_mailbox_php', true);
+
    /******************************************************************************
     **  Expunges a mailbox 
     ******************************************************************************/
          if (substr($mailbox, -1) == $dm)
             $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
          $boxes[$g]['unformatted'] = $mailbox;
-         //$boxes[$g]['unformatted-disp'] = ereg_replace('^' . $folder_prefix, '', $mailbox);
-         if (substr($mailbox,0,strlen($folder_prefix))==$folder_prefix) { 
-            $boxes[$g]['unformatted-disp'] = substr($mailbox, strlen($folder_prefix));
-         }
+         if (substr($mailbox,0,strlen($folder_prefix))==$folder_prefix)
+            $mailbox = substr($mailbox, strlen($folder_prefix));
+         $boxes[$g]['unformatted-disp'] = $mailbox;
          $boxes[$g]['id'] = $g;
 
          if (isset($line[$g]))
          $flags = trim(strtolower(str_replace('\\', '',$regs[1])));
          if ($flags) {
             $boxes[$g]['flags'] = explode(' ', $flags);
-         }
-        else
-            $boxes[$g]['flags'] = array();
+         } else
+            $boxes[$g]['flags'] = array();
       }
 
       return $boxes;
     **  See comment on sqimap_mailbox_parse() for info about the returned array.
     ******************************************************************************/
    function sqimap_mailbox_list ($imap_stream) {
-      global $load_prefs_php, $prefs_php, $config_php;
       global $data_dir, $username, $list_special_folders_first;
       global $trash_folder, $sent_folder;
-      global $move_to_trash, $move_to_sent;
+      global $move_to_trash, $move_to_sent, $folder_prefix;
 
       $inbox_in_list = false;
       $inbox_subscribed = false;
 
-      if (!isset($load_prefs_php)) include "../src/load_prefs.php";
-      else global $folder_prefix;
-      if (!function_exists ("ary_sort")) include "../functions/array.php";
+      include "../src/load_prefs.php";
+      include "../functions/array.php";
 
       $dm = sqimap_get_delimiter ($imap_stream);
 
       /** LSUB array **/
       $inbox_subscribed = false;
-      fputs ($imap_stream, "a001 LSUB \"\" \"*\"\r\n");
+      fputs ($imap_stream, "a001 LSUB \"\" \"*%\"\r\n");
       $lsub_ary = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
 
       /** OS: we don't want to parse last element of array, 'cause it is OK command, so we unset it **/
             if ($flags) {
                $boxes[$g]['flags'] = explode(" ", $flags);
             }
-           else
-           {
-              $boxes[$g]['flags'] = array();
-           }
+            else
+            {
+               $boxes[$g]['flags'] = array();
+            }
          }
          $g++;
       }