+
+ for ($i = 0; $i < count($boxes); $i++) {
+ if ($boxes[$i]["UNFORMATTED"] == $special_folders[0]) {
+ $boxesnew[0]["FORMATTED"] = $boxes[$i]["FORMATTED"];
+ $boxesnew[0]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]);
+ $boxesnew[0]["RAW"] = trim($boxes[$i]["RAW"]);
+ $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++) {
+ if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($special_folders[$j])) == $special_folders[$j]) {
+ $pos = count($boxesnew);
+ $boxesnew[$pos]["FORMATTED"] = $boxes[$i]["FORMATTED"];
+ $boxesnew[$pos]["RAW"] = trim($boxes[$i]["RAW"]);
+ $boxesnew[$pos]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]);
+ $boxes[$i]["USED"] = true;
+ }
+ }
+ }
+ }
+ for ($i = 0; $i < count($boxes); $i++) {
+ if (($boxes[$i]["UNFORMATTED"] != $special_folders[0]) &&
+ ($boxes[$i]["UNFORMATTED"] != ".mailboxlist") &&
+ ($boxes[$i]["USED"] == false)) {
+ $pos = count($boxesnew);
+ $boxesnew[$pos]["FORMATTED"] = $boxes[$i]["FORMATTED"];
+ $boxesnew[$pos]["RAW"] = trim($boxes[$i]["RAW"]);
+ $boxesnew[$pos]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]);
+ $boxes[$i]["USED"] = true;
+ }
+ }
+
+ $boxes = $boxesnew;