X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=c8bc624aa7411bed2e8ed2e7e22318c46236c61b;hb=e1c11171cd580d0d27e1a596ab53afac90075bf3;hp=b224497b55887402220e834898c8001245af11a4;hpb=d92b6f319c3ca67ff701db9da869b42c298ef9a4;p=squirrelmail.git
diff --git a/src/left_main.php b/src/left_main.php
index b224497b..c8bc624a 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -1,4 +1,4 @@
-
+
-
-
- include("../config/config.php");
- include("../functions/array.php");
- include("../functions/strings.php");
- include("../functions/imap.php");
- include("../functions/mailbox.php");
-
- function formatMailboxName($imapConnection, $mailbox, $delimeter) {
- require ("../config/config.php");
-
- $mailboxURL = urlencode($mailbox);
- selectMailbox($imapConnection, $mailbox, $numNessages);
- $unseen = unseenMessages($imapConnection, $numUnseen);
-
- if ($unseen)
+
+ if (!isset($config_php))
+ include("../config/config.php");
+ if (!isset($array_php))
+ include("../functions/array.php");
+ if (!isset($strings_php))
+ include("../functions/strings.php");
+ if (!isset($imap_php))
+ include("../functions/imap.php");
+ if (!isset($page_header_php))
+ include("../functions/page_header.php");
+ if (!isset($i18n_php))
+ include("../functions/i18n.php");
+
+
+ echo "";
+
+ 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 .= "";
- $line .= "";
- $line .= readShortMailboxName($mailbox, $delimeter);
- if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) {
- $urlMailbox = urlencode($mailbox);
- $line .= " (empty)";
+ $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)";
}
- $line .= "\n";
- if ($numUnseen > 0) {
- $line .= " ($numUnseen)";
+
+ if (($move_to_trash == true) && ($real_box == $trash_folder)) {
+ $urlMailbox = urlencode($real_box);
+ $line .= "";
+ $line .= " ("._("purge").")";
+ $line .= "\n";
}
return $line;
+ echo "";
}
- echo "
";
- echo "";
// open a connection on the imap port (143)
- $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output
-
- fputs($imapConnection, "1 list \"\" *\n");
- $str = imapReadData($imapConnection, "1", true, $response, $message);
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
- echo "";
- echo "Folders
";
- echo "(refresh folder list)
";
- echo "\n";
- $delimeter = findMailboxDelimeter($imapConnection);
- for ($i = 0;$i < count($str); $i++) {
- $mailbox = Chop($str[$i]);
- $boxFlags = getMailboxFlags($mailbox);
- $mailbox = findMailboxName($mailbox);
+ /** If it was a successful login, lets load their preferences **/
+ include("../src/load_prefs.php");
- $boxCount = countCharInString($mailbox, $delimeter);
-
- $line = "";
- // indent the correct number of spaces.
- for ($j = 0;$j < $boxCount;$j++)
- $line .= " ";
-
- if (trim($boxFlags[0]) != "") {
- for ($h = 0; $h < count($boxFlags); $h++) {
- if (strtolower($boxFlags[$h]) == "noselect") {
- $line .= "";
- $line .= readShortMailboxName($mailbox, $delimeter);
- $line .= "";
- } else {
- $line .= formatMailboxName($imapConnection, $mailbox, $delimeter);
- }
- }
- } else {
- $line .= formatMailboxName($imapConnection, $mailbox, $delimeter);
- }
- $folder_list[$i]["FORMATTED"] = trim($line);
- $folder_list[$i]["PLAIN"] = trim($mailbox);
- $folder_list[$i]["ID"] = $i;
+ if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
+ echo "";
+ echo "";
+ echo "";
}
+
+ echo "";
- /** Alphebetize the folders */
- $original = $folder_list;
+ $boxes = sqimap_mailbox_list($imapConnection);
- for ($i = 0; $i < count($original); $i++) {
- $folder_list[$i]["PLAIN"] = strtolower($folder_list[$i]["PLAIN"]);
- }
+ echo "";
+ echo _("Folders") . "
";
- $folder_list = ary_sort($folder_list, "PLAIN", 1);
+ echo "(";
+ echo _("refresh folder list");
+ echo ")
";
+ $delimeter = sqimap_get_delimiter($imapConnection);
- for ($i = 0; $i < count($original); $i++) {
- for ($j = 0; $j < count($original); $j++) {
- if ($folder_list[$i]["ID"] == $original[$j]["ID"]) {
- $folder_list[$i]["PLAIN"] = $original[$j]["PLAIN"];
- $folder_list[$i]["FORMATTED"] = $original[$j]["FORMATTED"];
- }
- }
- }
+ for ($i = 0;$i < count($boxes); $i++) {
+ $line = "";
+ $mailbox = $boxes[$i]["formatted"];
- /** If it is the inbox, list it first **/
- for ($i = 0; $i < count($folder_list); $i++) {
- if ($folder_list[$i]["PLAIN"] == $special_folders[0]) {
- echo "";
- echo trim($folder_list[$i]["FORMATTED"]);
- echo "
";
- $folder_list[$i]["USED"] = true;
- }
- }
- /** Now the other special folders **/
- if ($list_special_folders_first == true) {
- for ($i = 0; $i < count($folder_list); $i++) {
- for ($j = 1; $j < count($special_folders); $j++) {
- if (substr($folder_list[$i]["PLAIN"], 0, strlen($special_folders[$j])) == $special_folders[$j]) {
- echo "";
- echo trim($folder_list[$i]["FORMATTED"]);
- echo "
";
- $folder_list[$i]["USED"] = true;
- }
+ 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"]);
}
- }
- /** Then list all the other ones (not equal to INBOX) **/
- /** NOTE: .mailboxlist is a netscape thing.. just ignore it **/
- for ($i = 0; $i < count($folder_list); $i++) {
- if (($folder_list[$i]["PLAIN"] != $special_folders[0]) &&
- ($folder_list[$i]["PLAIN"] != ".mailboxlist") &&
- ($folder_list[$i]["USED"] == false)) {
- echo "";
- echo trim($folder_list[$i]["FORMATTED"]);
- echo "
";
- }
+ echo "$line
";
}
- echo "";
fclose($imapConnection);
?>
-
+