fixed select all bug with spaces in folder name
[squirrelmail.git] / functions / imap_mailbox.php
index 8e2600f059f6e70d70a553fc68377e1cc43a8291..01ab0f9af19c8b8ed4ecb6c7301880887b234e4b 100755 (executable)
 
          // Then list special folders and their subfolders
          for ($i = 0 ; $i <= count($boxes) ; $i++) {
-            if((eregi("^".quotemeta($trash_folder).'$', $boxes[$i]["unformatted"]) ||
-                eregi("^".quotemeta($trash_folder).quotemeta($dm), $boxes[$i]["unformatted"]) )  &&
-               ($move_to_trash)) {        
+           if ($move_to_trash && 
+               eregi("^" . quotemeta($trash_folder) . "(" . 
+                   quotemeta($dm) . ")?$", $boxes[$i]["unformatted"]))
+           {
                $boxesnew[] = $boxes[$i];
                $boxes[$i]["used"] = true;
             }
-            else if((eregi("^".quotemeta($sent_folder).'$', $boxes[$i]["unformatted"]) ||
-                     eregi("^".quotemeta($sent_folder).quotemeta($dm), $boxes[$i]["unformatted"]) )  &&
-                    ($move_to_sent)) {        
+            elseif ($move_to_sent &&
+               eregi("^" . quotemeta($sent_folder) . "(" .
+                   quotemeta($dm) . ")?$", $boxes[$i]["unformatted"]))
+           {
                $boxesnew[] = $boxes[$i];
                $boxes[$i]["used"] = true;
             }