";
function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) {
global $folder_prefix, $trash_folder, $sent_folder;
global $color, $move_to_sent, $move_to_trash;
$mailboxURL = urlencode($real_box);
if($real_box=="INBOX") {
$unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
}
echo "";
if ($unseen > 0)
$line .= "";
$special_color = false;
if ((strtolower($real_box) == "inbox") ||
(($real_box == $trash_folder) && ($move_to_trash)) ||
(($real_box == $sent_folder) && ($move_to_sent)))
$special_color = true;
if ($special_color == true) {
$line .= "";
$line .= replace_spaces($mailbox);
$line .= "";
} else {
$line .= "";
$line .= replace_spaces($mailbox);
$line .= "";
}
if ($unseen > 0)
$line .= "";
if ($unseen > 0) {
$line .= " ($unseen)";
}
if (($move_to_trash == true) && ($real_box == $trash_folder)) {
$urlMailbox = urlencode($real_box);
$line .= "";
$line .= " ("._("purge").")";
$line .= "\n";
}
return $line;
echo "";
}
// open a connection on the imap port (143)
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
/** If it was a successful login, lets load their preferences **/
include("../src/load_prefs.php");
if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
echo "";
echo "";
echo "";
}
echo "
";
$boxes = sqimap_mailbox_list($imapConnection);
echo "";
echo _("Folders") . "
";
echo "(";
echo _("refresh folder list");
echo ")
";
$delimeter = sqimap_get_delimiter($imapConnection);
for ($i = 0;$i < count($boxes); $i++) {
$line = "";
$mailbox = $boxes[$i]["formatted"];
if ($boxes[$i]["flags"]) {
$noselect = false;
for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
$noselect = true;
}
if ($noselect == true) {
$line .= "";
$line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
$line .= "";
} else {
$line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
}
} else {
$line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
}
echo "$line
";
}
fclose($imapConnection);
?>