function array_qsort2(&$array, $column = 0, $order = SORT_ASC, $first = 0, $last = -2) { if ($last == -2) { $last = count($array) - 1; } if ($last > $first) { $alpha = $first; $omega = $last; $guess = strtolower($array[$alpha][$column]); while ($omega >= $alpha) { if ($order == SORT_ASC) { while (strtolower($array[$alpha][$column]) < $guess) { $alpha++; } while (strtolower($array[$omega][$column]) > $guess) { $omega--; } } else { while (strtolower($array[$alpha][$column]) > $guess) { $alpha++; } while (strtolower($array[$omega][$column]) < $guess) { $omega--; } } if ($alpha > $omega) { break; } $temporary = $array[$alpha]; $array[$alpha++] = $array[$omega]; $array[$omega--] = $temporary; } array_qsort2($array, $column, $order, $first, $omega); array_qsort2($array, $column, $order, $alpha, $last); } }
$pcounter = 0; foreach ($folders as $entry) { $entry = $entry["name"]; $boxname = $entry; if (in_array($entry, $sess["sysfolders"])) { switch (strtolower($entry)) { case strtolower($sess["sysmap"]["inbox"]): $boxname = $inbox_extended; break; case strtolower($sess["sysmap"]["sent"]): $boxname = $sent_extended; break; case strtolower($sess["sysmap"]["trash"]): $boxname = $trash_extended; break; } $system[$scounter]["systemname"] = $entry; $system[$scounter]["name"] = $boxname; $system[$scounter]["link"] = "process.php?folder=" . $entry . "&sid={$sid}&tid={$tid}&lid={$lid}"; $scounter++; } else { $personal[$pcounter]["systemname"] = $entry; $personal[$pcounter]["name"] = $boxname; $personal[$pcounter]["link"] = "process.php?folder={$entry}&sid={$sid}&tid={$tid}&lid={$lid}"; $pcounter++; } } array_qsort2($system, "name"); array_qsort2($personal, "name"); $smarty->assign("umSystemFolders", $system); $smarty->assign("umPersonalFolders", $personal);
<?php /************************************************************************ UebiMiau is a GPL'ed software developed by - Aldoir Ventura - aldoir@users.sourceforge.net - http://uebimiau.sourceforge.net Fell free to contact, send donations or anything to me :-) São Paulo - Brasil *************************************************************************/ require "./inc/inc.php"; $filename = $userfolder . "_infos/addressbook.ucf"; $myfile = $UM->_read_file($filename); if ($myfile != "") { $addressbook = unserialize(base64_decode($myfile)); } array_qsort2($addressbook, "name"); $listbox = "<select name=contacts size=10 onDblClick=\"Add('to')\">\r\n"; for ($i = 0; $i < count($addressbook); $i++) { $line = $addressbook[$i]; $name = htmlspecialchars(trim($line["name"])); $email = htmlspecialchars(trim($line["email"])); $listbox .= "<option value=\""{$name}" <{$email}>\"> "{$name}" <{$email}>"; } $listbox .= "</select>"; $smarty->assign("umContacts", $listbox); $smarty->display("{$selected_theme}/quick_address.htm");
} else { $personal[$pcounter]["entry"] = $entry; $personal[$pcounter]["name"] = $boxname; $personal[$pcounter]["msgs"] = count($thisbox) . "/{$unread}"; $personal[$pcounter]["del"] = $delete; $personal[$pcounter]["boxsize"] = ceil($boxsize / 1024); $personal[$pcounter]["chlink"] = "process.php?folder=" . urlencode($entry) . "&sid={$sid}&tid={$tid}&lid={$lid}"; $personal[$pcounter]["emptylink"] = "folders.php?empty=" . urlencode($entry) . "&folder=" . urlencode($entry) . "&sid={$sid}&tid={$tid}&lid={$lid}"; $pcounter++; } $totalused += $boxsize; } $SS->Save($sess); $UM->mail_disconnect(); unset($SS, $UM); array_qsort2($system, "name"); if (!is_array($personal)) { $personal = array(); } $umFolderList = array_merge($system, $personal); $smarty->assign("umFolderList", $umFolderList); $smarty->assign("umPersonal", $personal); $smarty->assign("umTotalUsed", ceil($totalused / 1024)); $quota_enabled = $quota_limit ? 1 : 0; $smarty->assign("umQuotaEnabled", $quota_enabled); $smarty->assign("umQuotaLimit", $quota_limit); $usageGraph = get_usage_graphic($totalused / 1024, $quota_limit); $smarty->assign("umUsageGraph", $usageGraph); $noquota = $totalused / 1024 > $quota_limit ? 1 : 0; $smarty->assign("umNoQuota", $noquota); echo $nocache;
} $boxes = $UM->mail_list_boxes(); $sess["folders"] = $boxes; require "./get_message_list.php"; require "./apply_filters.php"; $UM->mail_disconnect(); if ($require_update) { mail_connect(); require "./get_message_list.php"; $UM->mail_disconnect(); } } if (!is_array($headers = $sess["headers"][$folder_key])) { redirect("messages.php?folder={$folder}&pag={$pag}&sid={$sid}&tid={$tid}&lid={$lid}\r\n"); } array_qsort2($headers, $sortby, $sortorder); $sess["headers"][$folder_key] = $headers; $SS->Save($sess); if ($check_first_login && !$prefs["first-login"]) { $prefs["first-login"] = 1; save_prefs($prefs); redirect("preferences.php?sid={$sid}&tid={$tid}&lid={$lid}&folder=" . urlencode($folder)); exit; } if (!isset($pag) || !is_numeric(trim($pag))) { $pag = 1; } $refreshurl = "messages.php?sid={$sid}&tid={$tid}&lid={$lid}&folder=" . urlencode($folder) . "&pag={$pag}"; if (isset($back_to)) { if (count($headers) > $back_to) { redirect("readmsg.php?folder=" . urlencode($folder) . "&pag={$pag}&ix={$back_to}&sid={$sid}&tid={$tid}&lid={$lid}");