5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** This is where the mailboxes are listed. This controls most of what
9 ** goes on in SquirrelMail.
13 if (!isset($i18n_php))
14 include("../functions/i18n.php");
18 if(!isset($logged_in) ||
!isset($username) ||
!isset($key)) {
19 include ("../themes/default_theme.php");
20 include ("../functions/display_messages.php");
21 printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
22 $color[8], $color[4], $color[7], $color[7], $color[7]);
23 plain_error_message(_("You need a valid user and password to access this page!")
24 . "<br><a href=\"../src/login.php\">"
25 . _("Click here to log back in.") . "</a>.", $color);
26 echo "</body></html>";
30 if (!isset($config_php))
31 include("../config/config.php");
32 if (!isset($imap_php))
33 include("../functions/imap.php");
34 if (!isset($strings_php))
35 include("../functions/strings.php");
36 if (!isset($date_php))
37 include("../functions/date.php");
38 if (!isset($page_header_php))
39 include("../functions/page_header.php");
40 if (!isset($array_php))
41 include("../functions/array.php");
42 if (!isset($mime_php))
43 include("../functions/mime.php");
44 if (!isset($mailbox_display_php))
45 include("../functions/mailbox_display.php");
46 if (!isset($display_messages_php))
47 include("../functions/display_messages.php");
50 /////////////////////////////////////////////////////////////////////////////////
52 // incoming variables from URL:
53 // $sort Direction to sort by date
54 // values: 0 - descending order
55 // values: 1 - ascending order
56 // $startMessage Message to start at
57 // $mailbox Full Mailbox name
59 // incoming from cookie:
63 /////////////////////////////////////////////////////////////////////////////////
65 // open a connection on the imap port (143)
66 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
68 /** If it was a successful login, lets load their preferences **/
69 include("../src/load_prefs.php");
71 if (isset($newsort) && $newsort != $sort) {
72 setPref($data_dir, $username, "sort", $newsort);
75 // If the page has been loaded without a specific mailbox,
76 // send them to the inbox
77 if (!isset($mailbox)) {
82 // compensate for the UW vulnerability
83 if ($imap_server_type == "uw" && strstr($mailbox, "../")) {
87 sqimap_mailbox_select($imapConnection, $mailbox);
88 displayPageHeader($color, $mailbox);
90 do_hook("right_main_after_header");
92 if ($just_logged_in == 1 && strlen(trim($motd)) > 0) {
93 echo "<center><br>\n";
94 echo "<table width=70% cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=\"$color[9]\">\n";
95 echo "<table width=100% cellpadding=5 cellspacing=1 border=0><tr><td bgcolor=\"$color[4]\">\n";
97 echo "</td></tr></table>\n";
98 echo "</td></tr></table>\n";
99 echo "</center><br>\n";
102 if (isset($newsort)) {
104 session_register("sort");
107 // Check to see if we can use cache or not. Currently the only time when you wont use it is
108 // when a link on the left hand frame is used. Also check to make sure we actually have the
109 // array in the registered session data. :)
110 if ($use_mailbox_cache && session_is_registered("msgs")) {
111 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
113 if (session_is_registered("msgs"))
115 if (session_is_registered("msort"))
117 if (session_is_registered("numMessages"))
120 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
122 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
124 if (session_is_registered("msgs") && isset($msgs))
125 session_register("msgs");
126 if (session_is_registered("msort") && isset($msort))
127 session_register("msort");
128 session_register("numMessages");
131 do_hook("right_main_bottom");
132 sqimap_logout ($imapConnection);