From 9d8d1ebdb41ab1d5e8af918d966e830d8a760e2c Mon Sep 17 00:00:00 2001 From: indiri69 Date: Thu, 30 Sep 2004 18:11:38 +0000 Subject: [PATCH] Do a natural language sort on mailbox names. Otherwise it shows as all uppercase and then all lowercase git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8098 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/imap_mailbox.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2be767d3..387b46fe 100644 --- 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 -------------------- diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 56883236..3d7f87f6 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -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 +?> -- 2.25.1