bf155105c16d3873fba30c89d7d41c3e823e1043
6 ** Copyright (c) 1999-2001 The Squirrelmail Development Team
7 ** Licensed under the GNU GPL. For full terms see the file COPYING.
9 ** This is where the mailboxes are listed. This controls most of what
10 ** goes on in SquirrelMail.
15 require_once('../src/validate.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/date.php');
18 require_once('../functions/array.php');
19 require_once('../functions/mime.php');
20 require_once('../functions/mailbox_display.php');
21 require_once('../functions/display_messages.php');
23 /***********************************************************
24 * incoming variables from URL: *
25 * $sort Direction to sort by date *
26 * values: 0 - descending order *
27 * values: 1 - ascending order *
28 * $startMessage Message to start at *
29 * $mailbox Full Mailbox name *
31 * incoming from cookie: *
34 ***********************************************************/
36 /* Open a connection on the imap port (143) */
37 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
39 if (isset($newsort) && $newsort != $sort) {
40 setPref($data_dir, $username, 'sort', $newsort);
43 /* If the page has been loaded without a specific mailbox, */
44 /* send them to the inbox */
45 if (!isset($mailbox)) {
50 if (! isset($startMessage) ||
$startMessage == '')
53 /* compensate for the UW vulnerability. */
54 if ($imap_server_type == 'uw' && (strstr($mailbox, '../') ||
55 substr($mailbox, 0, 1) == '/')) {
59 sqimap_mailbox_select($imapConnection, $mailbox);
60 displayPageHeader($color, $mailbox);
63 do_hook('right_main_after_header');
66 echo "<CENTER><B>$note</B></CENTER><BR>\n";
69 if ($just_logged_in == true) {
70 $just_logged_in = false;
72 if (strlen(trim($motd)) > 0) {
73 echo "<br><table align=center width=70% cellpadding=0 cellspacing=3 border=0 bgcolor=\"$color[9]\">" .
75 "<table width=100% cellpadding=5 cellspacing=1 border=0 bgcolor=\"$color[4]\">" .
76 "<tr><td align=center>$motd";
84 if (isset($newsort)) {
86 session_register('sort');
89 /*********************************************************************
90 * Check to see if we can use cache or not. Currently the only time *
91 * when you will not use it is when a link on the left hand frame is *
92 * used. Also check to make sure we actually have the array in the *
93 * registered session data. :) *
94 *********************************************************************/
95 if (! isset($use_mailbox_cache)) {
96 $use_mailbox_cache = 0;
99 if ($use_mailbox_cache && session_is_registered('msgs')) {
100 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
102 if (session_is_registered('msgs')) {
106 if (session_is_registered('msort')) {
110 if (session_is_registered('numMessages')) {
114 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
116 showMessagesForMailbox($imapConnection, $mailbox, $numMessages,
117 $startMessage, $sort, $color, $show_num,
120 if (session_is_registered('msgs') && isset($msgs)) {
121 session_register('msgs');
124 if (session_is_registered('msort') && isset($msort)) {
125 session_register('msort');
128 session_register('numMessages');
131 do_hook('right_main_bottom');
132 sqimap_logout ($imapConnection);