Added html_top and html_bottom hooks to read_body for compression plugin
[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
21c3249f 70 // If the page has been loaded without a specific mailbox,
a48fbf9b 71 // send them to the inbox
21c3249f 72 if (!isset($mailbox)) {
e9f8ea4e 73 $mailbox = "INBOX";
74 $sort = $newsort = 0;
75 $startMessage = 1;
21c3249f 76 }
77
813eba2f 78 sqimap_mailbox_select($imapConnection, $mailbox);
f8f9bed9 79 displayPageHeader($color, $mailbox);
21c3249f 80
06ad27a2 81 do_hook("right_main_after_header");
82
a37f3771 83 if ($just_logged_in == 1 && strlen(trim($motd)) > 0) {
04632dbc 84 echo "<center><br>\n";
85 echo "<table width=70% cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=\"$color[9]\">\n";
86 echo "<table width=100% cellpadding=5 cellspacing=1 border=0><tr><td bgcolor=\"$color[4]\">\n";
87 echo "$motd\n";
88 echo "</td></tr></table>\n";
89 echo "</td></tr></table>\n";
90 echo "</center><br>\n";
a37f3771 91 }
92
e452ce9b 93 if (isset($newsort)) {
94 $sort = $newsort;
95 session_register("sort");
96 }
97
9f2215a1 98 // Check to see if we can use cache or not. Currently the only time when you wont use it is
99 // when a link on the left hand frame is used. Also check to make sure we actually have the
100 // array in the registered session data. :)
90033b64 101 if ($use_mailbox_cache && session_is_registered("msgs")) {
dc54c9f2 102 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
90033b64 103 } else {
104 if (session_is_registered("msgs"))
105 unset($msgs);
dc54c9f2 106 if (session_is_registered("msort"))
107 unset($msort);
1108e8bb 108 if (session_is_registered("numMessages"))
109 unset($numMessages);
110
111 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
9f2215a1 112
dc54c9f2 113 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
90033b64 114
115 if (session_is_registered("msgs") && isset($msgs))
116 session_register("msgs");
dc54c9f2 117 if (session_is_registered("msort") && isset($msort))
118 session_register("msort");
1108e8bb 119 session_register("numMessages");
90033b64 120 }
21c3249f 121
06ad27a2 122 do_hook("right_main_bottom");
926da13e 123 // close the connection
a2790a61 124 sqimap_mailbox_close($imapConnection);
813eba2f 125 sqimap_logout ($imapConnection);
21c3249f 126?>
127</FONT>
128</BODY>
129</HTML>