6fe9ef48a464b8726be99ca23c240240c0cfccba
[squirrelmail.git] / src / right_main.php
1 <?
2 /**
3 ** right_main.php
4 **
5 ** This is where the mailboxes are listed. This controls most of what
6 ** goes on in SquirrelMail.
7 **
8 **/
9
10 if(!isset($logged_in)) {
11 echo _("You must ");
12 echo "<a href=\"login.php\">";
13 echo _("login");
14 echo "</a>";
15 echo _(" first.");
16 exit;
17 }
18 if(!isset($username) || !isset($key)) {
19 echo _("You need a valid user and password to access this page!");
20 exit;
21 }
22 ?>
23 <HTML>
24 <FONT FACE="Arial,Helvetica">
25 <?
26 include("../config/config.php");
27 include("../functions/imap.php");
28 include("../functions/strings.php");
29 include("../functions/date.php");
30 include("../functions/page_header.php");
31 include("../functions/array.php");
32 include("../functions/mailbox.php");
33 include("../functions/mailbox_display.php");
34 include("../functions/display_messages.php");
35
36 /////////////////////////////////////////////////////////////////////////////////
37 //
38 // incoming variables from URL:
39 // $sort Direction to sort by date
40 // values: 0 - descending order
41 // values: 1 - ascending order
42 // $startMessage Message to start at
43 // $mailbox Full Mailbox name
44 //
45 // incoming from cookie:
46 // $username duh
47 // $key pass
48 //
49 /////////////////////////////////////////////////////////////////////////////////
50
51 // open a connection on the imap port (143)
52 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
53
54 /** If it was a successful login, lets load their preferences **/
55 include("../src/load_prefs.php");
56 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
57 echo "<FONT FACE=\"Arial,Helvetica\">";
58
59 // If the page has been loaded without a specific mailbox,
60 // just show a page of general info.
61 if (!isset($mailbox)) {
62 displayPageHeader($color, "None");
63 general_info($motd, $org_logo, $version, $org_name, $color);
64 echo "</BODY></HTML>";
65 exit;
66 }
67
68 // switch to the mailbox, and get the number of messages in it.
69 selectMailbox($imapConnection, $mailbox, $numMessages);
70
71 // Display the header at the top of the page
72 displayPageHeader($color, $mailbox);
73
74 // Get the list of messages for this mailbox
75 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color);
76
77 // close the connection
78 fputs($imapConnection, "1 logout\n");
79 fclose($imapConnection);
80 ?>
81 </FONT>
82 </BODY>
83 </HTML>