Improved the inline downloadig of attachments
[squirrelmail.git] / src / right_main.php
index cbc699f9820bde98009b6514d08366e124b07afb..1def94edfdb5ffb4280ea0ed82db1001b205d77a 100644 (file)
@@ -17,7 +17,6 @@
    }
 ?>
 <HTML>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE">
 <FONT FACE="Arial,Helvetica">
 <?
    include("../config/config.php");
@@ -30,6 +29,8 @@
    include("../functions/mailbox_display.php");
    include("../functions/display_messages.php");
 
+   echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
+   echo "<FONT FACE=\"Arial,Helvetica\">";
    /////////////////////////////////////////////////////////////////////////////////
    //
    // incoming variables from URL:
    //
    /////////////////////////////////////////////////////////////////////////////////
 
-
    // 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);
-
-   // login
-   fputs($imapConnection, "1 login $username $key\n");
-   $read = fgets($imapConnection, 1024);
-   if (strpos($read, "NO")) {
-      error_username_password_incorrect();
-      exit;
-   }
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    // If the page has been loaded without a specific mailbox,
    //    just show a page of general info.
    if (!isset($mailbox)) {
-      displayPageHeader("None");
-      general_info($motd, $org_logo, $version, $org_name);
+      displayPageHeader($color, "None");
+      general_info($motd, $org_logo, $version, $org_name, $color);
+      echo "</BODY></HTML>";
       exit;
    }
 
    selectMailbox($imapConnection, $mailbox, $numMessages);
 
    // Display the header at the top of the page
-   displayPageHeader($mailbox);
+   displayPageHeader($color, $mailbox);
 
    // Get the list of messages for this mailbox
    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort);
 
    // close the connection
+   fputs($imapConnection, "1 logout\n");
    fclose($imapConnection);
 ?>
 </FONT>