X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=39382ea096619b015c5099d110c3991845a2884d;hb=c95df3808257297105d60595ab869357359a89e7;hp=a6702f23d4ca2082d4a057ac27f067bb647102bc;hpb=e146912692c921160f93dcb6da97dc6246bf95d2;p=squirrelmail.git
diff --git a/src/left_main.php b/src/left_main.php
index a6702f23..39382ea0 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -1,17 +1,22 @@
-
+";
- function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
- require ("../config/config.php");
+ function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) {
+ global $folder_prefix, $trash_folder, $sent_folder;
+ global $color, $move_to_sent, $move_to_trash;
+ global $unseen_notify, $unseen_type;
$mailboxURL = urlencode($real_box);
- sqimap_mailbox_select ($imapConnection, $real_box);
- $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
- echo "";
- if ($unseen)
+ if ($unseen_notify == 2 && $real_box == "INBOX") {
+ $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
+ if ($unseen_type == 1 && $unseen > 0) {
+ $unseen_string = "($unseen)";
+ $unseen_found = true;
+ } else if ($unseen_type == 2) {
+ $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
+ $unseen_string = "($unseen/$numMessages)";
+ $unseen_found = true;
+ }
+ } else if ($unseen_notify == 3) {
+ $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
+ if ($unseen_type == 1 && $unseen > 0) {
+ $unseen_string = "($unseen)";
+ $unseen_found = true;
+ } else if ($unseen_type == 2) {
+ $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
+ $unseen_string = "($unseen/$numMessages)";
+ $unseen_found = true;
+ }
+ }
+
+ $line .= "";
+ if ($unseen > 0)
$line .= "";
$special_color = false;
- for ($i = 0; $i < count($special_folders); $i++) {
- if (($special_folders[$i] == $real_box) && ($use_special_folder_color == true))
- $special_color = true;
- }
+ 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 .= "";
@@ -49,44 +87,40 @@
} else {
$line .= "";
$line .= replace_spaces($mailbox);
- $line .= "";
+ $line .= "";
}
- if ($unseen)
+ if ($unseen > 0)
$line .= "";
- if ($numUnseen > 0) {
- $line .= " ($numUnseen)";
+ if ($unseen_found) {
+ $line .= " $unseen_string";
}
- if (($move_to_trash == true) && (trim($real_box) == $trash_folder)) {
+ if (($move_to_trash == true) && ($real_box == $trash_folder)) {
$urlMailbox = urlencode($real_box);
- $line .= "";
- $line .= " ("._("purge").")";
- $line .= "\n";
+ $line .= "\n\n";
+ $line .= " ("._("purge").")";
+ $line .= "\n\n";
}
-
- echo "";
+ $line .= "";
return $line;
}
- // 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 "\n";
+ echo "\n";
+ echo "\n";
}
- echo "
";
+ echo "\n\n";
+
+ do_hook("left_main_before");
$boxes = sqimap_mailbox_list($imapConnection);
- echo "";
- echo _("Folders") . "
";
+ echo "";
+ echo _("Folders") . "
\n\n";
echo "(";
echo _("refresh folder list");
@@ -108,16 +142,14 @@
$line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
$line .= "";
} else {
- $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
+ $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
}
} else {
- $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
+ $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
}
- echo "$line
";
+ echo "$line
\n";
}
-
-
- fclose($imapConnection);
-
+ sqimap_logout($imapConnection);
+ do_hook("left_main_after");
?>