5 ** This is the code for the left bar. The left bar shows the folders
6 ** available, and has cookie information.
10 if(!isset($username)) {
11 echo "You need a valid user and password to access this page!";
15 if (!isset($config_php))
16 include("../config/config.php");
17 if (!isset($array_php))
18 include("../functions/array.php");
19 if (!isset($strings_php))
20 include("../functions/strings.php");
21 if (!isset($imap_php))
22 include("../functions/imap.php");
23 if (!isset($page_header_php))
24 include("../functions/page_header.php");
28 function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
29 require ("../config/config.php");
31 $mailboxURL = urlencode($real_box);
32 sqimap_mailbox_select ($imapConnection, $real_box);
33 $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
39 $special_color = false;
40 for ($i = 0; $i < count($special_folders); $i++
) {
41 if (($special_folders[$i] == $real_box) && ($use_special_folder_color == true))
42 $special_color = true;
45 if ($special_color == true) {
46 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT COLOR=\"$color[11]\">";
47 $line .= replace_spaces($mailbox);
48 $line .= "</font></a>";
50 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
51 $line .= replace_spaces($mailbox);
52 $line .= "</font></a>";
59 $line .= " <small>($numUnseen)</small>";
62 if (($move_to_trash == true) && (trim($real_box) == $trash_folder)) {
63 $urlMailbox = urlencode($real_box);
65 $line .= " (<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">"._("purge")."</A></B>)";
66 $line .= "</small></a>\n";
73 // open a connection on the imap port (143)
74 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
76 /** If it was a successful login, lets load their preferences **/
77 include("../src/load_prefs.php");
78 if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
79 echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">";
80 echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
81 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
84 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
86 $boxes = sqimap_mailbox_list($imapConnection);
88 echo "<FONT SIZE=4><B><CENTER>";
89 echo _("Folders") . "</B><BR></FONT>";
91 echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
92 echo _("refresh folder list");
93 echo "</A>)</small></CENTER><BR>";
94 $delimeter = sqimap_get_delimiter($imapConnection);
96 for ($i = 0;$i < count($boxes); $i++
) {
98 $mailbox = $boxes[$i]["formatted"];
100 if ($boxes[$i]["flags"]) {
102 for ($h = 0; $h < count($boxes[$i]["flags"]); $h++
) {
103 if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
106 if ($noselect == true) {
107 $line .= "<FONT COLOR=\"$color[10]\">";
108 $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
111 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
114 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
120 fclose($imapConnection);