Minor cleanups
[squirrelmail.git] / functions / imap_mailbox.php
index e2198947a7629fdfa923d45494c76eec7f4c194c..4faef27bd36a3fef123a1ac50f000a1a665ffcae 100755 (executable)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * imap_mailbox.php
  *
@@ -247,44 +248,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 && !is_null($key)) {
-            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
  */
@@ -522,7 +485,7 @@ function sqimap_mailbox_parse ($line, $line_lsub) {
 /**
  * Returns list of options (to be echoed into select statement
  * based on available mailboxes and separators
- * Caller should surround options with <SELECT..> </SELECT> and
+ * Caller should surround options with <select ...> </select> and
  * any formatting.
  *   $imap_stream - $imapConnection to query for mailboxes
  *   $show_selected - array containing list of mailboxes to pre-select (0 if none)
@@ -552,7 +515,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) ) {
@@ -579,9 +543,9 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk
                 }
             }
             if ($show_selected != 0 && in_array($lowerbox, $show_selected) ) {
-                $mbox_options .= '<OPTION VALUE="' . htmlspecialchars($box) .'" SELECTED>'.$box2.'</OPTION>' . "\n";
+                $mbox_options .= '<option value="' . htmlspecialchars($box) .'" selected="selected">'.$box2.'</option>' . "\n";
             } else {
-                $mbox_options .= '<OPTION VALUE="' . htmlspecialchars($box) .'">'.$box2.'</OPTION>' . "\n";
+                $mbox_options .= '<option value="' . htmlspecialchars($box) .'">'.$box2.'</option>' . "\n";
             }
         }
     }
@@ -1091,4 +1055,4 @@ function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) {
     }
 }
 
-?>
+?>
\ No newline at end of file