* Fixed typo.
[squirrelmail.git] / functions / imap_mailbox.php
index ed043c7b67453d108055cc94a2c651b2f7bc8d80..6e4fe26aef93cc75a2ba9a1b044527ef3c67dbaf 100755 (executable)
@@ -12,7 +12,6 @@
       sqimap_mailbox_select ($imap_stream, $mailbox);
       fputs ($imap_stream, "a001 EXPUNGE\r\n");
       $read = sqimap_read_data($imap_stream, "a001", $handle_errors, $response, $message);
-      sqimap_mailbox_close ($imap_stream);
    }
 
 
       }
    }
 
-   /******************************************************************************
-    **  Closes an open mailbox 
-    ******************************************************************************/
-   function sqimap_mailbox_close ($imap_stream) {
-      fputs ($imap_stream, "a001 CLOSE\r\n");
-      $tmp = sqimap_read_data($imap_stream, "a001", false, $response, $message);
-   }
-
    /******************************************************************************
     **  Selects a mailbox
     ******************************************************************************/
       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 **/
+         unset($lsub_ary[count($lsub_ary)-1]);
+
       for ($i=0;$i < count($lsub_ary); $i++) {
          $sorted_lsub_ary[$i] = find_mailbox_name($lsub_ary[$i]);
          if ($sorted_lsub_ary[$i] == "INBOX")
 
          // Then list special folders and their subfolders
          for ($i = 0 ; $i <= count($boxes) ; $i++) {
-            if((eregi("^".$trash_folder.'$', $boxes[$i]["unformatted"]) ||
-                eregi("^".$trash_folder.quotemeta($dm), $boxes[$i]["unformatted"]) )  &&
-               ($move_to_trash)) {        
+            if (! (strcasecmp($trash_folder, $boxes[$i]["unformatted"]) &&
+                strcasecmp($trash_folder . $dm, $boxes[$i]["unformatted"] ))
+               && $move_to_trash) {
                $boxesnew[] = $boxes[$i];
                $boxes[$i]["used"] = true;
             }
-            else if((eregi("^".$sent_folder.'$', $boxes[$i]["unformatted"]) ||
-                     eregi("^".$sent_folder.quotemeta($dm), $boxes[$i]["unformatted"]) )  &&
-                    ($move_to_sent)) {        
+            elseif (! (strcasecmp($sent_folder, $boxes[$i]["unformatted"]) &&
+                strcasecmp($sent_folder . $dm, $boxes[$i]["unformatted"] ))
+               && $move_to_sent) {        
                $boxesnew[] = $boxes[$i];
                $boxes[$i]["used"] = true;
             }