Adding FIXME to comment
[squirrelmail.git] / functions / imap_mailbox.php
index 13eab2d4d868c18907c3d77753023506c1d1d58b..0a50cf86048938fdfadc32b5cb26c74b872f6640 100755 (executable)
@@ -247,44 +247,6 @@ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true,
     return $cnt;
 }
 
-
-/**
- * Expunge specified message
- *
- * We'll use this wrapper function to
- * remove the message with the matching UID .. the order
- * won't be changed - the array element for the message
- * will just be removed.
- */
-
-function sqimap_mailbox_expunge_dmn($imapConnection, &$aMailbox, $message_id) {
-    $cnt = 0;
-
-    if ($aMailbox['AUTO_EXPUNGE']) {
-         $cnt = sqimap_mailbox_expunge($imapConnection, $aMailbox['NAME'], true);
-    } else {
-         return $cnt;
-    }
-    $error = '';
-    $message_id = (int) $message_id; // we use strickt array_search
-    if (is_array($aMailbox['UIDSET'])) {
-        $key = array_search($message_id,$aMailbox['UIDSET'],true);
-        if ($key !== false) {
-            unset($aMailbox['UIDSET'][$key]);
-            $aMailbox['UIDSET'] = array_values($aMailbox['UIDSET']);
-            // adapt the exists count to avoid triggering of a new sort
-            $aMailbox['EXISTS'] -= 1;
-        } else {
-            $aMailbox['UIDSET'] = get_sorted_msgs_list($imapConnection,$aMailbox,$error);
-        }
-    } else {
-        $aMailbox['UIDSET'] = get_sorted_msgs_list($imapConnection,$aMailbox,$error);
-    }
-    sqsession_register($aMailbox,'aLastSelectedMailbox');
-    sqsession_register($aMailbox['UIDSET'],'server_sort_array'); //fix me, use aMailbox instead
-    return $cnt;
-}
-
 /**
  * Checks whether or not the specified mailbox exists
  */
@@ -552,7 +514,8 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk
     }
 
     foreach ($boxes as $boxes_part) {
-        if ($flag == NULL || !in_array($flag, $boxes_part['flags'])) {
+        if ($flag == NULL || (is_array($boxes_part['flags'])
+                      && !in_array($flag, $boxes_part['flags']))) {
             $box = $boxes_part['unformatted'];
 
             if ($folder_skip != 0 && in_array($box, $folder_skip) ) {