X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_mailbox.php;h=143edfdc9bf2bcd2a7ce24583bcce96c89070bdb;hb=97dd6a624bf63447bba316785396f88265d7a081;hp=16b50a2e1d524f7fb0ee9241dbe55f7904ce3033;hpb=d29aac0e3969fcd88d2dc76698ea802718c200e6;p=squirrelmail.git diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 16b50a2e..143edfdc 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -5,7 +5,6 @@ ** This impliments all functions that manipulate mailboxes **/ - /****************************************************************************** ** Expunges a mailbox ******************************************************************************/ @@ -107,6 +106,8 @@ ** The array returned looks like this: ******************************************************************************/ function sqimap_mailbox_list ($imap_stream) { + global $special_folders, $list_special_folders_first; + if (!function_exists ("ary_sort")) include ("../functions/array.php"); @@ -159,8 +160,16 @@ } $original = $boxes; + + /** Get the folders into lower case so sorting is not case sensative */ + for ($i = 0; $i < count($original); $i++) { + $boxes[$i]["unformatted"] = strtolower($boxes[$i]["unformatted"]); + } + + /** Sort them **/ $boxes = ary_sort($boxes, "unformatted", 1); - + + /** Get them back from the original array, still sorted by the id **/ for ($i = 0; $i < count($boxes); $i++) { for ($j = 0; $j < count($original); $j++) { if ($boxes[$i]["id"] == $original[$j]["id"]) { @@ -169,11 +178,14 @@ } } + for ($i = 0; $i < count($boxes); $i++) { if ($boxes[$i]["unformatted"] == $special_folders[0]) { $boxesnew[0] = $boxes[$i]; + $boxes[$i]["used"] = true; } } + if ($list_special_folders_first == true) { for ($i = 0; $i < count($boxes); $i++) { for ($j = 1; $j < count($special_folders); $j++) { @@ -185,6 +197,7 @@ } } } + for ($i = 0; $i < count($boxes); $i++) { if (($boxes[$i]["unformatted"] != $special_folders[0]) && ($boxes[$i]["used"] == false)) { @@ -194,7 +207,7 @@ } } - return $boxes; + return $boxesnew; } -?> +?>