1.3.0 version string
[squirrelmail.git] / functions / imap_mailbox.php
index 44e14a91dca65f3f059282464b1c757646f83299..403ce05fddfb7098fc9095103e6bc502266337ec 100755 (executable)
@@ -149,17 +149,20 @@ function isSpecialMailbox( $box ) {
 /* Expunges a mailbox */
 function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') {
   global $uid_support;
-    if (isset($id)) {
+    if ($id) {
        if (is_array($id)) {
           $id = sqimap_message_list_squisher($id);
        }
        $id = ' '.$id;
+       $uid = $uid_support;
+    } else {
+       $uid = false;
     }
-    $read = sqimap_run_command($imap_stream, 'EXPUNGE$id', $handle_errors,
-                               $response, $message, $uid_support);
+    $read = sqimap_run_command($imap_stream, 'EXPUNGE'.$id, $handle_errors,
+                               $response, $message, $uid);
     $cnt = 0;                         
     foreach ($read as $r) {
-       if (pregmatch('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) {
+       if (preg_match('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) {
           $cnt++;
        }
     }
@@ -578,8 +581,7 @@ function sqimap_mailbox_list($imap_stream) {
                     $used[$k] = true;
                 }
                 $spec_sub = str_replace(' ', '', $box['formatted']);
-                $spec_sub = str_replace('*', '', $spec_sub);
-                $spec_sub = str_replace('?', '\?', $spec_sub);
+                $spec_sub = preg_replace("/(\*|\[|\]|\(|\)|\?|\+|\{|\}|\^|\\$)/", '\\\\'.'\\1', $spec_sub);
 
                /* In case of problems with preg
                   here is a ereg version