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!";
17 include("../config/config.php");
18 include("../functions/array.php");
19 include("../functions/strings.php");
20 include("../functions/imap.php");
21 include("../functions/mailbox.php");
23 function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
24 require ("../config/config.php");
26 $mailboxURL = urlencode($real_box);
27 selectMailbox($imapConnection, $real_box, $numNessages);
28 $unseen = unseenMessages($imapConnection, $numUnseen);
34 $special_color = false;
35 for ($i = 0; $i < count($special_folders); $i++
) {
36 if (($special_folders[$i] == $mailbox) && ($use_special_folder_color == true))
37 $special_color = true;
40 if ($special_color == true) {
41 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\" COLOR=\"$color[11]\">";
42 $line .= readShortMailboxName($mailbox, $delimeter);
43 $line .= "</font></a>";
45 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
46 $line .= readShortMailboxName($mailbox, $delimeter);
47 $line .= "</font></a>";
54 $line .= " <FONT FACE=\"Arial,Helvetica\" SIZE=2>($numUnseen)</FONT>";
57 if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) {
58 $urlMailbox = urlencode($mailbox);
59 $line .= "<FONT FACE=\"Arial,Helvetica\" SIZE=2>";
60 $line .= " (<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">empty</A></B>)";
61 $line .= "</FONT></a>\n";
68 // open a connection on the imap port (143)
69 $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output
71 /** If it was a successful login, lets load their preferences **/
72 include("../src/load_prefs.php");
73 if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
74 echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">";
75 echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
76 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
78 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
79 echo "<FONT FACE=\"Arial,Helvetica\">";
81 getFolderList($imapConnection, $boxes);
83 echo "<FONT FACE=\"Arial,Helvetica\" SIZE=4><B><CENTER>";
84 echo "Folders</B><BR></FONT>";
86 echo "<FONT FACE=\"Arial,Helvetica\" SIZE=2>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
87 echo _("refresh folder list");
88 echo "</A>)</FONT></CENTER><BR>";
89 echo "<FONT FACE=\"Arial,Helvetica\">\n";
90 $delimeter = findMailboxDelimeter($imapConnection);
92 for ($i = 0;$i < count($boxes); $i++
) {
94 $mailbox = $boxes[$i]["FORMATTED"];
95 $boxFlags = getMailboxFlags($imapConnection, $boxes[$i]["RAW"]);
97 if (trim($boxFlags[0]) != "") {
99 for ($h = 0; $h < count($boxFlags); $h++
) {
100 if (strtolower($boxFlags[$h]) == "noselect")
103 if ($noselect == true) {
104 $line .= "<FONT COLOR=\"$color[10]\" FACE=\"Arial,Helvetica\">";
105 $line .= readShortMailboxName($mailbox, $delimeter);
106 $line .= "</FONT><FONT FACE=\"Arial,Helvetica\">";
108 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
111 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
118 fclose($imapConnection);
121 </FONT
></BODY
></HTML
>