added color customization
[squirrelmail.git] / src / left_main.php
index 3bf51e5955ef106b342bbf8e30824de8830acf73..e3725eb8f151036a9403d8f1cbdb091ba0c9a6ff 100644 (file)
    }
 ?>
 <HTML>
-<HEAD>
-   <SCRIPT LANGUAGE="JavaScript">
-      function DeleteCookie (name) {
-         var exp = new Date();  
-         exp.setTime (exp.getTime() - 1);  
-         // This cookie is history  
-         var cval = GetCookie (name);  
-         document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
-      }
-
-      function unSetCookies() {
-         DeleteCookie('username');
-         DeleteCookie('key');
-         DeleteCookie('logged_in');
-         alert(document.cookie);
-      }
-   </SCRIPT>
-</HEAD>
-<BODY BGCOLOR=A0B8C8 TEXT="#000000" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE" onUnLoad="unSetCookies()">
-<FONT FACE="Arial,Helvetica">
 <?
    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);
+   echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
+   echo "<FONT FACE=\"Arial,Helvetica\">";
 
-   fputs($imapConnection, "1 login $username $key\n");
-   $read = fgets($imapConnection, 1024);
+   // open a connection on the imap port (143)
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    fputs($imapConnection, "1 list \"\" *\n");
    $str = imapReadData($imapConnection);
 
-   echo "<FONT FACE=\"Arial,Helvetica\"><B>";
-   echo "<CENTER>$org_name</B><BR>";
-   echo "Folders</CENTER>";
-   echo "</B><BR></FONT>";
-   echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
+   echo "<FONT FACE=\"Arial,Helvetica\" COLOR=000000 SIZE=4><B><CENTER>";
+   echo "Folders</B><BR></FONT>";
+   echo "<FONT FACE=\"Arial,Helvetica\" COLOR=000000 SIZE=2>(<A HREF=\"../src/left_main.php\" TARGET=left>refresh folder list</A>)</FONT></CENTER><BR>";
+   echo "<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 "&nbsp;&nbsp;";
       
       $mailboxURL = urlencode($mailbox);
+      selectMailbox($imapConnection, $mailbox, $numNessages);
+      $unseen = unseenMessages($imapConnection, $numUnseen);
+      if ($unseen)
+         echo "<B>";
       echo "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
       echo readShortMailboxName($mailbox, ".");
-      echo "</FONT></a><br>\n";
+      if (($move_to_trash == true) && ($mailbox == $trash_folder)) {
+         $urlMailbox = urlencode($mailbox);
+         echo "</A>&nbsp;&nbsp;&nbsp;&nbsp;(<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">empty</A></B>)";
+      }
+      echo "</FONT></a>\n";
+      if ($numUnseen > 0) {
+         echo "</B>&nbsp;</FONT><FONT FACE=\"Arial,Helvetica\" SIZE=2>($numUnseen)</FONT>";
+      }
+      echo "<BR>\n";
    }
-   echo "</code></FONT>";
+   echo "</FONT>";
 
    fclose($imapConnection);