Do a natural language sort on mailbox names. Otherwise it shows as all uppercase...
authorindiri69 <indiri69@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 30 Sep 2004 18:11:38 +0000 (18:11 +0000)
committerindiri69 <indiri69@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 30 Sep 2004 18:11:38 +0000 (18:11 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8098 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/imap_mailbox.php

index 2be767d3619c9e41a2ae40605b372338e87947df..387b46fe62aa03ef16963fa00cd0c54252dbb24f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -109,6 +109,7 @@ Version 1.5.1 -- CVS
   - Fixed folder list in Create Folders list for Courier (properly skip INBOX).
   - Fixed undefined variables in sqimap_create_stream().
   - Added Bengali translation support.
+  - Fixed left frame mailbox list when sorting by case
 
 Version 1.5.0
 --------------------
index 56883236e6e4ef334d46a0e90cd5c0944d5d2e2a..3d7f87f62aa7247445355aa4b88c4e60844bb72d 100755 (executable)
@@ -230,7 +230,7 @@ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true,
             $id = sqimap_message_list_squisher($id);
         }
         $id = ' '.$id;
-       $uid = TRUE;
+        $uid = TRUE;
     } else {
         $uid = false;
     }
@@ -751,7 +751,6 @@ function sqimap_mailbox_list_all($imap_stream) {
 function sqimap_mailbox_tree($imap_stream) {
     global $default_folder_prefix, $unseen_notify, $unseen_type;
     if (true) {
-
         global $data_dir, $username, $list_special_folders_first,
                $folder_prefix, $delimiter, $trash_folder, $move_to_trash,
                $imap_server_type;
@@ -774,7 +773,7 @@ function sqimap_mailbox_tree($imap_stream) {
 
         for ($i = 0, $cnt = count($lsub_ary); $i < $cnt; $i++) {
             if (preg_match("/^\*\s+LSUB.*\s\"?INBOX\"?[^(\/\.)].*$/i",$lsub_ary[$i])) {
-               $lsub_ary[$i] = strtoupper($lsub_ary[$i]);
+                $lsub_ary[$i] = strtoupper($lsub_ary[$i]);
                 // in case of an unsubscribed inbox an imap server can
                 // return the inbox in the lsub results with a \NoSelect
                 // flag.
@@ -847,12 +846,16 @@ function sqimap_mailbox_tree($imap_stream) {
            $cnt = count($sorted_lsub_ary);
        }
        $sorted_lsub_ary = array_values($sorted_lsub_ary);
-       array_multisort($sorted_lsub_ary, SORT_ASC, SORT_REGULAR);
+       usort($sorted_lsub_ary, 'mbxSort');
        $boxestree = sqimap_fill_mailbox_tree($sorted_lsub_ary,false,$imap_stream);
        return $boxestree;
     }
 }
 
+function mbxSort($a, $b) {
+    return strnatcasecmp($a['mbx'], $b['mbx']);
+}
+
 function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) {
     global $data_dir, $username, $list_special_folders_first,
            $folder_prefix, $trash_folder, $sent_folder, $draft_folder,
@@ -882,7 +885,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) {
         $start = 0;
     }
 
-    $cnt =  count($mbx_ary);
+    $cnt = count($mbx_ary);
     for ($i=0; $i < $cnt; $i++) {
         if ($mbx_ary[$i]['mbx'] !='' ) {
             $mbx = new mailboxes();
@@ -1055,4 +1058,4 @@ function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) {
     }
 }
 
-?>
\ No newline at end of file
+?>