Regarding username='DELETED' bug (Opera and apparently IE 3) - forgot to
[squirrelmail.git] / src / right_main.php
CommitLineData
59177427 1<?php
21c3249f 2 /**
a09387f4 3 ** right_main.php
21c3249f 4 **
3bcede49 5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
21c3249f 8 ** This is where the mailboxes are listed. This controls most of what
9 ** goes on in SquirrelMail.
10 **
11 **/
12
441f2d33 13 if (!isset($i18n_php))
14 include("../functions/i18n.php");
dc54c9f2 15
2a32fc83 16 session_start();
17
21c3249f 18 if(!isset($logged_in)) {
441f2d33 19 set_up_language($squirrelmail_language, true);
138f26f6 20 echo _("You must login first.");
21c3249f 21 exit;
22 }
23 if(!isset($username) || !isset($key)) {
441f2d33 24 set_up_language($squirrelmail_language, true);
b581fa60 25 echo _("You need a valid user and password to access this page!");
21c3249f 26 exit;
27 }
44139266 28
d068c0ec 29 if (!isset($config_php))
30 include("../config/config.php");
31 if (!isset($imap_php))
32 include("../functions/imap.php");
33 if (!isset($strings_php))
34 include("../functions/strings.php");
35 if (!isset($date_php))
36 include("../functions/date.php");
37 if (!isset($page_header_php))
38 include("../functions/page_header.php");
39 if (!isset($array_php))
40 include("../functions/array.php");
41 if (!isset($mime_php))
42 include("../functions/mime.php");
43 if (!isset($mailbox_display_php))
44 include("../functions/mailbox_display.php");
45 if (!isset($display_messages_php))
46 include("../functions/display_messages.php");
44139266 47?>
59177427 48<?php
21c3249f 49 /////////////////////////////////////////////////////////////////////////////////
50 //
51 // incoming variables from URL:
52 // $sort Direction to sort by date
53 // values: 0 - descending order
54 // values: 1 - ascending order
55 // $startMessage Message to start at
56 // $mailbox Full Mailbox name
57 //
58 // incoming from cookie:
59 // $username duh
60 // $key pass
61 //
62 /////////////////////////////////////////////////////////////////////////////////
63
21c3249f 64 // open a connection on the imap port (143)
e1469126 65 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
21c3249f 66
f3d17401 67 /** If it was a successful login, lets load their preferences **/
68 include("../src/load_prefs.php");
f3d17401 69
5c54e435 70 if (isset($newsort) && $newsort != $sort) {
71 setPref($data_dir, $username, "sort", $newsort);
72 }
73
21c3249f 74 // If the page has been loaded without a specific mailbox,
a48fbf9b 75 // send them to the inbox
21c3249f 76 if (!isset($mailbox)) {
e9f8ea4e 77 $mailbox = "INBOX";
e9f8ea4e 78 $startMessage = 1;
21c3249f 79 }
80
813eba2f 81 sqimap_mailbox_select($imapConnection, $mailbox);
f8f9bed9 82 displayPageHeader($color, $mailbox);
21c3249f 83
06ad27a2 84 do_hook("right_main_after_header");
85
a37f3771 86 if ($just_logged_in == 1 && strlen(trim($motd)) > 0) {
04632dbc 87 echo "<center><br>\n";
88 echo "<table width=70% cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=\"$color[9]\">\n";
89 echo "<table width=100% cellpadding=5 cellspacing=1 border=0><tr><td bgcolor=\"$color[4]\">\n";
90 echo "$motd\n";
91 echo "</td></tr></table>\n";
92 echo "</td></tr></table>\n";
93 echo "</center><br>\n";
a37f3771 94 }
95
e452ce9b 96 if (isset($newsort)) {
97 $sort = $newsort;
98 session_register("sort");
99 }
100
9f2215a1 101 // Check to see if we can use cache or not. Currently the only time when you wont use it is
102 // when a link on the left hand frame is used. Also check to make sure we actually have the
103 // array in the registered session data. :)
90033b64 104 if ($use_mailbox_cache && session_is_registered("msgs")) {
dc54c9f2 105 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
90033b64 106 } else {
107 if (session_is_registered("msgs"))
108 unset($msgs);
dc54c9f2 109 if (session_is_registered("msort"))
110 unset($msort);
1108e8bb 111 if (session_is_registered("numMessages"))
112 unset($numMessages);
113
114 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
9f2215a1 115
dc54c9f2 116 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
90033b64 117
118 if (session_is_registered("msgs") && isset($msgs))
119 session_register("msgs");
dc54c9f2 120 if (session_is_registered("msort") && isset($msort))
121 session_register("msort");
1108e8bb 122 session_register("numMessages");
90033b64 123 }
21c3249f 124
06ad27a2 125 do_hook("right_main_bottom");
813eba2f 126 sqimap_logout ($imapConnection);
21c3249f 127?>
128</FONT>
129</BODY>
130</HTML>