- $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
-
- fputs($imapConnection, "1 list \"\" *\n");
- $str = imapReadData($imapConnection);
-
- echo "<FONT FACE=\"Arial,Helvetica\"><B>";
- echo "<CENTER>$org_name</B><BR>";
- echo "Folders</CENTER>";
- echo "</B><BR></FONT>";
- echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
- for ($i = 0;$i < count($str); $i++) {
- $mailbox = Chop($str[$i]);
- $mailbox = findMailboxName($mailbox);
-
- // find the quote at the begining of the mailbox name.
- // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
- $periodCount = countCharInString($mailbox, ".");
-
- // indent the correct number of spaces.
- for ($j = 0;$j < $periodCount;$j++)
- echo " ";
-
- $mailboxURL = urlencode($mailbox);
- echo "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
- if ($doBold == true)
- echo "<B>";
- echo readShortMailboxName($mailbox, ".");
- if ($doBold == true)
- echo "</B>";
- echo "</FONT></a><br>\n";
+ $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 "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">";
+ echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
+ echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
+ }
+
+ echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
+
+ $boxes = sqimap_mailbox_list($imapConnection);
+
+ echo "<FONT SIZE=4><B><CENTER>";
+ echo _("Folders") . "</B><BR></FONT>";
+
+ echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
+ echo _("refresh folder list");
+ echo "</A>)</small></CENTER><BR>";
+ $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 .= "<FONT COLOR=\"$color[10]\">";
+ $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
+ $line .= "</FONT>";
+ } 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<BR>";