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