-?>
-<HTML>
-<?
- 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, $color, $move_to_trash) {
- require ("../config/config.php");
-
- $mailboxURL = urlencode($mailbox);
- selectMailbox($imapConnection, $mailbox, $numNessages);
- $unseen = unseenMessages($imapConnection, $numUnseen);
-
- echo "<NOBR>";
- 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");
+ if (!isset($plugin_php))
+ include("../functions/plugin.php");
+
+ // 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");
+
+ displayHtmlHeader();
+
+
+ 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);
+
+ 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 = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
+ $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 = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
+ $unseen_found = true;
+ }
+ }
+
+ $line .= "<NOBR>";
+ if ($unseen > 0)