7a2d670c4d905948f49b3c1c7be3c3a2c06a3ab5
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 <SCRIPT LANGUAGE
="JavaScript">
18 function DeleteCookie (name
) {
20 exp
.setTime (exp
.getTime() - 1);
21 // This cookie is history
22 var cval
= GetCookie (name
);
23 document
.cookie
= name +
"=" + cval +
"; expires=" + exp
.toGMTString();
26 function unSetCookies() {
27 DeleteCookie('username');
29 DeleteCookie('logged_in');
30 alert(document
.cookie
);
34 <BODY BGCOLOR
=A0B8C8 TEXT
="#000000" LINK
="#0000EE" VLINK
="#0000EE" ALINK
="#0000EE" onUnLoad
="unSetCookies()">
35 <FONT FACE
="Arial,Helvetica">
37 include("../config/config.php3");
38 include("../functions/strings.php3");
39 include("../functions/imap.php3");
41 // *****************************************
42 // Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX
43 // *****************************************
44 function findMailboxName($mailbox) {
45 // start at -2 so that we skip the initial quote at the end of the mailbox name
47 $char = substr($mailbox, $i, 1);
48 while ($char != "\"") {
51 $char = substr($mailbox, $i, 1);
56 // open a connection on the imap port (143)
57 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
58 if (!$imapConnection) {
59 echo "Error connecting to IMAP Server.<br>";
60 echo "$errorNumber : $errorString<br>";
63 $serverInfo = fgets($imapConnection, 256);
65 fputs($imapConnection, "1 login $username $key\n");
66 $read = fgets($imapConnection, 1024);
68 fputs($imapConnection, "1 list \"\" *\n");
69 $str = imapReadData($imapConnection);
71 echo "<FONT FACE=\"Arial,Helvetica\"><B>";
72 echo "<CENTER>$org_name</B><BR>";
73 echo "Folders</CENTER>";
74 echo "</B><BR></FONT>";
75 echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
76 for ($i = 0;$i < count($str); $i++
) {
77 $mailbox = Chop($str[$i]);
78 // find the quote at the begining of the mailbox name.
79 // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
80 $mailbox = findMailboxName($mailbox);
81 $periodCount = countCharInString($mailbox, ".");
83 // indent the correct number of spaces.
84 for ($j = 0;$j < $periodCount;$j++
)
87 $mailboxURL = urlencode($mailbox);
88 echo "<a href=\"right_main.php3?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
89 echo readShortMailboxName($mailbox, ".");
90 echo "</FONT></a><br>\n";
92 echo "</code></FONT>";
94 fclose($imapConnection);