5 ** This is the code for the left bar. The left bar shows the folders
6 ** available, and has cookie information.
12 if(!isset($username)) {
13 echo "You need a valid user and password to access this page!";
17 if (!isset($config_php))
18 include("../config/config.php");
19 if (!isset($array_php))
20 include("../functions/array.php");
21 if (!isset($strings_php))
22 include("../functions/strings.php");
23 if (!isset($imap_php))
24 include("../functions/imap.php");
25 if (!isset($page_header_php))
26 include("../functions/page_header.php");
27 if (!isset($i18n_php))
28 include("../functions/i18n.php");
33 function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color) {
34 global $folder_prefix, $trash_folder, $sent_folder;
35 global $color, $move_to_sent, $move_to_trash;
37 $mailboxURL = urlencode($real_box);
38 sqimap_mailbox_select ($imapConnection, $real_box);
39 $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
45 $special_color = false;
46 if ((strtolower($real_box) == "inbox") ||
47 (($real_box == $trash_folder) && ($move_to_trash)) ||
48 (($real_box == $sent_folder) && ($move_to_sent)))
49 $special_color = true;
51 if ($special_color == true) {
52 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT COLOR=\"$color[11]\">";
53 $line .= replace_spaces($mailbox);
54 $line .= "</font></a>";
56 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
57 $line .= replace_spaces($mailbox);
58 $line .= "</font></a>";
65 $line .= " <small>($numUnseen)</small>";
68 if (($move_to_trash == true) && ($real_box == $trash_folder)) {
69 $urlMailbox = urlencode($real_box);
71 $line .= " (<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">"._("purge")."</A></B>)";
72 $line .= "</small></a>\n";
79 // open a connection on the imap port (143)
80 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
82 /** If it was a successful login, lets load their preferences **/
83 include("../src/load_prefs.php");
85 if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
86 echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">";
87 echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
88 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
91 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
93 $boxes = sqimap_mailbox_list($imapConnection);
95 echo "<FONT SIZE=4><B><CENTER>";
96 echo _("Folders") . "</B><BR></FONT>";
98 echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
99 echo _("refresh folder list");
100 echo "</A>)</small></CENTER><BR>";
101 $delimeter = sqimap_get_delimiter($imapConnection);
103 for ($i = 0;$i < count($boxes); $i++
) {
105 $mailbox = $boxes[$i]["formatted"];
107 if ($boxes[$i]["flags"]) {
109 for ($h = 0; $h < count($boxes[$i]["flags"]); $h++
) {
110 if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
113 if ($noselect == true) {
114 $line .= "<FONT COLOR=\"$color[10]\">";
115 $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
118 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color);
121 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color);
127 fclose($imapConnection);