This commit has been accessed 611 times via Git panel.
commit 4deda3a4e1336316ee1be9a4c7b68f0e57da49a9
tree 1f683db51cf4b8d645d0025115dcc709f96e5538
parent efc011ff4546b3036e598b1c550919710bc72a07
author Engels Antonio <engels@majcms.org> 1328375859 +0800
committer Engels Antonio <engels@majcms.org> 1328375859 +0800
Improve webmail folders sort order v2
diff --git a/folders.php b/folders.php
index 2b546b7..ee7ffc6 100644
--- a/folders.php
+++ b/folders.php
@@ -93,16 +93,20 @@ $folders = imap_list($mbox, $conn, "*");
if (is_array($folders)) {
- reset($folders);
- sort($folders,SORT_NUMERIC);
+ if (in_array("{$conn}INBOX",$folders)) {
-/*
- $folder_images = glob("images/folder*");
+ $inbox = array_search("{$conn}INBOX",$folders);
- foreach ($folder_images as $folder_image) {
- echo "\n\n<script>\n\tvar img_preload = new Image();\n\timg_preload.src = \"$folder_image\";\n</script>";
+ unset($folders[$inbox]);
+ unset($inbox);
}
-*/
+
+ sort($folders);
+
+ array_unshift($folders,"{$conn}INBOX");
+
+ reset($folders);
+
echo "\n\n<div class=\"folders\"><table border=\"0\" cellspacing=\"1\" callpadding=\"2\">";
foreach ($folders as $folder) {
tree 1f683db51cf4b8d645d0025115dcc709f96e5538
parent efc011ff4546b3036e598b1c550919710bc72a07
author Engels Antonio <engels@majcms.org> 1328375859 +0800
committer Engels Antonio <engels@majcms.org> 1328375859 +0800
Improve webmail folders sort order v2
diff --git a/folders.php b/folders.php
index 2b546b7..ee7ffc6 100644
--- a/folders.php
+++ b/folders.php
@@ -93,16 +93,20 @@ $folders = imap_list($mbox, $conn, "*");
if (is_array($folders)) {
- reset($folders);
- sort($folders,SORT_NUMERIC);
+ if (in_array("{$conn}INBOX",$folders)) {
-/*
- $folder_images = glob("images/folder*");
+ $inbox = array_search("{$conn}INBOX",$folders);
- foreach ($folder_images as $folder_image) {
- echo "\n\n<script>\n\tvar img_preload = new Image();\n\timg_preload.src = \"$folder_image\";\n</script>";
+ unset($folders[$inbox]);
+ unset($inbox);
}
-*/
+
+ sort($folders);
+
+ array_unshift($folders,"{$conn}INBOX");
+
+ reset($folders);
+
echo "\n\n<div class=\"folders\"><table border=\"0\" cellspacing=\"1\" callpadding=\"2\">";
foreach ($folders as $folder) {