21c3249f |
1 | <? |
2 | /** |
a09387f4 |
3 | ** left_main.php |
21c3249f |
4 | ** |
5 | ** This is the code for the left bar. The left bar shows the folders |
6 | ** available, and has cookie information. |
7 | ** |
8 | **/ |
9 | |
10 | if(!isset($username)) { |
11 | echo "You need a valid user and password to access this page!"; |
12 | exit; |
13 | } |
14 | ?> |
15 | <HTML> |
21c3249f |
16 | <? |
a09387f4 |
17 | include("../config/config.php"); |
18 | include("../functions/strings.php"); |
19 | include("../functions/imap.php"); |
de80e95e |
20 | include("../functions/mailbox.php"); |
21c3249f |
21 | |
f8f9bed9 |
22 | echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">"; |
23 | echo "<FONT FACE=\"Arial,Helvetica\">"; |
24 | |
21c3249f |
25 | // open a connection on the imap port (143) |
2aa12d5e |
26 | $imapConnection = loginToImapServer($username, $key, $imapServerAddress); |
21c3249f |
27 | |
28 | fputs($imapConnection, "1 list \"\" *\n"); |
29 | $str = imapReadData($imapConnection); |
30 | |
ff89ac8a |
31 | echo "<FONT FACE=\"Arial,Helvetica\" COLOR=000000 SIZE=4><B><CENTER>"; |
32 | echo "Folders</B><BR></FONT>"; |
33 | echo "<FONT FACE=\"Arial,Helvetica\" COLOR=000000 SIZE=2>(<A HREF=\"../src/left_main.php\" TARGET=left>refresh folder list</A>)</FONT></CENTER><BR>"; |
34 | echo "<FONT FACE=\"Arial,Helvetica\">\n"; |
21c3249f |
35 | for ($i = 0;$i < count($str); $i++) { |
36 | $mailbox = Chop($str[$i]); |
de80e95e |
37 | $mailbox = findMailboxName($mailbox); |
38 | |
21c3249f |
39 | // find the quote at the begining of the mailbox name. |
40 | // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name. |
21c3249f |
41 | $periodCount = countCharInString($mailbox, "."); |
42 | |
43 | // indent the correct number of spaces. |
44 | for ($j = 0;$j < $periodCount;$j++) |
45 | echo " "; |
46 | |
47 | $mailboxURL = urlencode($mailbox); |
ff89ac8a |
48 | selectMailbox($imapConnection, $mailbox, $numNessages); |
49 | $unseen = unseenMessages($imapConnection, $numUnseen); |
50 | if ($unseen) |
51 | echo "<B>"; |
a09387f4 |
52 | echo "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">"; |
21c3249f |
53 | echo readShortMailboxName($mailbox, "."); |
8eea5dd3 |
54 | if (($move_to_trash == true) && ($mailbox == $trash_folder)) { |
55 | $urlMailbox = urlencode($mailbox); |
e2370222 |
56 | echo "</A> (<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">empty</A></B>)"; |
8eea5dd3 |
57 | } |
ff89ac8a |
58 | echo "</FONT></a>\n"; |
59 | if ($numUnseen > 0) { |
60 | echo "</B> </FONT><FONT FACE=\"Arial,Helvetica\" SIZE=2>($numUnseen)</FONT>"; |
61 | } |
62 | echo "<BR>\n"; |
21c3249f |
63 | } |
ff89ac8a |
64 | echo "</FONT>"; |
21c3249f |
65 | |
66 | fclose($imapConnection); |
67 | |
68 | ?> |
69 | </FONT></BODY></HTML> |