<?
/**
- ** left_main.php3
+ ** left_main.php
**
** This is the code for the left bar. The left bar shows the folders
** available, and has cookie information.
<BODY BGCOLOR=A0B8C8 TEXT="#000000" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE" onUnLoad="unSetCookies()">
<FONT FACE="Arial,Helvetica">
<?
- include("../config/config.php3");
- include("../functions/strings.php3");
- include("../functions/imap.php3");
-
- // *****************************************
- // Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX
- // *****************************************
- function findMailboxName($mailbox) {
- // start at -2 so that we skip the initial quote at the end of the mailbox name
- $i = -2;
- $char = substr($mailbox, $i, 1);
- while ($char != "\"") {
- $i--;
- $temp .= $char;
- $char = substr($mailbox, $i, 1);
- }
- return strrev($temp);
- }
+ include("../config/config.php");
+ include("../functions/strings.php");
+ include("../functions/imap.php");
+ include("../functions/mailbox.php");
// open a connection on the imap port (143)
- $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
- if (!$imapConnection) {
- echo "Error connecting to IMAP Server.<br>";
- echo "$errorNumber : $errorString<br>";
- exit;
- }
- $serverInfo = fgets($imapConnection, 256);
-
- fputs($imapConnection, "1 login $username $key\n");
- $read = fgets($imapConnection, 1024);
+ $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
fputs($imapConnection, "1 list \"\" *\n");
$str = imapReadData($imapConnection);
echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
for ($i = 0;$i < count($str); $i++) {
$mailbox = Chop($str[$i]);
+ $mailbox = findMailboxName($mailbox);
+
// find the quote at the begining of the mailbox name.
// i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
- $mailbox = findMailboxName($mailbox);
$periodCount = countCharInString($mailbox, ".");
// indent the correct number of spaces.
echo " ";
$mailboxURL = urlencode($mailbox);
- echo "<a href=\"right_main.php3?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
+ echo "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
+ if ($doBold == true)
+ echo "<B>";
echo readShortMailboxName($mailbox, ".");
+ if ($doBold == true)
+ echo "</B>";
echo "</FONT></a><br>\n";
}
echo "</code></FONT>";