4 ** Copyright (c) 1999-2000 The SquirrelMail development team
5 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 ** This is the code for the left bar. The left bar shows the folders
8 ** available, and has cookie information.
15 if (!isset($i18n_php))
16 include ("../functions/i18n.php");
18 if(!isset($username)) {
19 set_up_language($squirrelmail_language, true);
20 include ("../themes/default_theme.php");
21 printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
22 $color[8], $color[4], $color[7], $color[7], $color[7]);
23 echo "</body></html>";
28 if (!isset($strings_php))
29 include("../functions/strings.php");
30 if (!isset($config_php))
31 include("../config/config.php");
32 if (!isset($array_php))
33 include("../functions/array.php");
34 if (!isset($imap_php))
35 include("../functions/imap.php");
36 if (!isset($page_header_php))
37 include("../functions/page_header.php");
38 if (!isset($i18n_php))
39 include("../functions/i18n.php");
40 if (!isset($plugin_php))
41 include("../functions/plugin.php");
43 // open a connection on the imap port (143)
44 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
46 /** If it was a successful login, lets load their preferences **/
47 include("../src/load_prefs.php");
51 function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) {
52 global $folder_prefix, $trash_folder, $sent_folder;
53 global $color, $move_to_sent, $move_to_trash;
54 global $unseen_notify, $unseen_type;
56 $mailboxURL = urlencode($real_box);
58 if ($unseen_notify == 2 && $real_box == "INBOX") {
59 $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
60 if ($unseen_type == 1 && $unseen > 0) {
61 $unseen_string = "($unseen)";
63 } else if ($unseen_type == 2) {
64 $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
65 $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
68 } else if ($unseen_notify == 3) {
69 $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
70 if ($unseen_type == 1 && $unseen > 0) {
71 $unseen_string = "($unseen)";
73 } else if ($unseen_type == 2) {
74 $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
75 $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
84 $special_color = false;
85 if ((strtolower($real_box) == "inbox") ||
86 (($real_box == $trash_folder) && ($move_to_trash)) ||
87 (($real_box == $sent_folder) && ($move_to_sent)))
88 $special_color = true;
90 if ($special_color == true) {
91 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT COLOR=\"$color[11]\">";
92 $line .= replace_spaces($mailbox);
93 $line .= "</font></a>";
95 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
96 $line .= replace_spaces($mailbox);
103 if (isset($unseen_found) && $unseen_found) {
104 $line .= " <small>$unseen_string</small>";
107 if (($move_to_trash == true) && ($real_box == $trash_folder)) {
108 $urlMailbox = urlencode($real_box);
109 $line .= "\n<small>\n";
110 $line .= " (<B><A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("purge")."</A></B>)";
111 $line .= "\n</small>\n";
117 if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
118 echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n";
119 echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
120 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
123 echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
125 do_hook("left_main_before");
127 $boxes = sqimap_mailbox_list($imapConnection);
129 echo "<CENTER><FONT SIZE=4><B>";
130 echo _("Folders") . "</B><BR></FONT>\n\n";
132 echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
133 echo _("refresh folder list");
134 echo "</A>)</small></CENTER><BR>";
135 $delimeter = sqimap_get_delimiter($imapConnection);
137 for ($i = 0;$i < count($boxes); $i++
) {
139 $mailbox = $boxes[$i]["formatted"];
141 if (in_array('noselect', $boxes[$i]['flags']) {
142 $line .= "<FONT COLOR=\"$color[10]\">";
143 $line .= replace_spaces($mailbox);
146 if (! isset($boxes[$i]['unseen']))
147 $boxes[$i]['unseen'] = '';
148 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
152 sqimap_logout($imapConnection);
153 do_hook("left_main_after");