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.
14 require_once('../src/validate.php');
15 require_once('../functions/imap.php');
16 require_once('../functions/date.php');
17 require_once('../functions/array.php');
18 require_once('../functions/mime.php');
19 require_once('../functions/mailbox_display.php');
20 require_once('../functions/display_messages.php');
22 /////////////////////////////////////////////////////////////////////////////////
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:
35 /////////////////////////////////////////////////////////////////////////////////
37 // open a connection on the imap port (143)
38 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
40 if (isset($newsort) && $newsort != $sort) {
41 setPref($data_dir, $username, 'sort', $newsort);
44 // If the page has been loaded without a specific mailbox,
45 // send them to the inbox
46 if (!isset($mailbox)) {
51 // compensate for the UW vulnerability
52 if ($imap_server_type == 'uw' && (strstr($mailbox, '../') !== false ||
53 substr($mailbox, 0, 1) == '/')) {
57 sqimap_mailbox_select($imapConnection, $mailbox);
58 displayPageHeader($color, $mailbox);
60 do_hook('right_main_after_header');
62 if ($just_logged_in == true) {
63 $just_logged_in = false;
65 if (strlen(trim($motd)) > 0) {
67 <table align
=center width
=70% cellpadding
=0 cellspacing
=3 border
=0
68 bgcolor
="<?PHP echo $color[9] ?>">
70 <table width
=100% cellpadding
=5 cellspacing
=1 border
=0 bgcolor
="<?PHP
72 <tr
><td align
=center
><?PHP
82 if (isset($newsort)) {
84 session_register('sort');
87 // Check to see if we can use cache or not. Currently the only time when you wont use it is
88 // when a link on the left hand frame is used. Also check to make sure we actually have the
89 // array in the registered session data. :)
90 if (! isset($use_mailbox_cache))
91 $use_mailbox_cache = 0;
92 if ($use_mailbox_cache && session_is_registered('msgs')) {
93 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
95 if (session_is_registered('msgs'))
97 if (session_is_registered('msort'))
99 if (session_is_registered('numMessages'))
102 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
104 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
106 if (session_is_registered('msgs') && isset($msgs))
107 session_register('msgs');
108 if (session_is_registered('msort') && isset($msort))
109 session_register('msort');
110 session_register('numMessages');
113 do_hook('right_main_bottom');
114 sqimap_logout ($imapConnection);