5c86e1445317d5008ccaf120a0a676206eba413a
5 ** This is where the mailboxes are listed. This controls most of what
6 ** goes on in SquirrelMail.
10 if(!isset($logged_in)) {
11 echo "You must <a href=\"login.php\">login</a> first.";
14 if(!isset($username) ||
!isset($key)) {
15 echo "You need a valid user and password to access this page!";
20 <BODY TEXT
="#000000" BGCOLOR
="#FFFFFF" LINK
="#0000EE" VLINK
="#0000EE" ALINK
="#0000EE">
21 <FONT FACE
="Arial,Helvetica">
23 include("../config/config.php");
24 include("../functions/imap.php");
25 include("../functions/strings.php");
26 include("../functions/date.php");
27 include("../functions/page_header.php");
28 include("../functions/array.php");
29 include("../functions/mailbox.php");
30 include("../functions/mailbox_display.php");
31 include("../functions/display_messages.php");
33 /////////////////////////////////////////////////////////////////////////////////
35 // incoming variables from URL:
36 // $sort Direction to sort by date
37 // values: 0 - descending order
38 // values: 1 - ascending order
39 // $startMessage Message to start at
40 // $mailbox Full Mailbox name
42 // incoming from cookie:
46 /////////////////////////////////////////////////////////////////////////////////
49 // open a connection on the imap port (143)
50 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
51 if (!$imapConnection) {
52 echo "Error connecting to IMAP Server.<br>";
53 echo "$errorNumber : $errorString<br>";
56 $serverInfo = fgets($imapConnection, 256);
59 fputs($imapConnection, "1 login $username $key\n");
60 $read = fgets($imapConnection, 1024);
61 if (strpos($read, "NO")) {
62 error_username_password_incorrect();
66 // If the page has been loaded without a specific mailbox,
67 // just show a page of general info.
68 if (!isset($mailbox)) {
69 displayPageHeader("None");
70 general_info($motd, $org_logo, $version, $org_name);
74 // switch to the mailbox, and get the number of messages in it.
75 selectMailbox($imapConnection, $mailbox, $numMessages);
77 // Display the header at the top of the page
78 displayPageHeader($mailbox);
80 // Get the list of messages for this mailbox
81 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort);
83 // close the connection
84 fputs($imapConnection, "1 logout\n");
85 fclose($imapConnection);