Notification when saving a draft.
[squirrelmail.git] / src / right_main.php
1 <?php
2 /**
3 ** right_main.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** This is where the mailboxes are listed. This controls most of what
9 ** goes on in SquirrelMail.
10 **
11 ** $Id$
12 **/
13
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');
21
22 /////////////////////////////////////////////////////////////////////////////////
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
30 //
31 // incoming from cookie:
32 // $username duh
33 // $key pass
34 //
35 /////////////////////////////////////////////////////////////////////////////////
36
37 // open a connection on the imap port (143)
38 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
39
40 if (isset($newsort) && $newsort != $sort) {
41 setPref($data_dir, $username, 'sort', $newsort);
42 }
43
44 // If the page has been loaded without a specific mailbox,
45 // send them to the inbox
46 if (!isset($mailbox)) {
47 $mailbox = 'INBOX';
48 $startMessage = 1;
49 }
50
51 // compensate for the UW vulnerability
52 if ($imap_server_type == 'uw' && (strstr($mailbox, '../') !== false ||
53 substr($mailbox, 0, 1) == '/')) {
54 $mailbox = 'INBOX';
55 }
56
57 sqimap_mailbox_select($imapConnection, $mailbox);
58 displayPageHeader($color, $mailbox);
59
60 do_hook('right_main_after_header');
61
62 if (isset($note))
63 echo "<CENTER><B>$note</B></CENTER><BR>\n";
64
65 if ($just_logged_in == true) {
66 $just_logged_in = false;
67
68 if (strlen(trim($motd)) > 0) {
69 ?><br>
70 <table align=center width=70% cellpadding=0 cellspacing=3 border=0
71 bgcolor="<?PHP echo $color[9] ?>">
72 <tr><td>
73 <table width=100% cellpadding=5 cellspacing=1 border=0 bgcolor="<?PHP
74 echo $color[4] ?>">
75 <tr><td align=center><?PHP
76 echo $motd;
77 do_hook('motd');
78 ?></td></tr>
79 </table>
80 </td></tr></table>
81 <?PHP
82 }
83 }
84
85 if (isset($newsort)) {
86 $sort = $newsort;
87 session_register('sort');
88 }
89
90 // Check to see if we can use cache or not. Currently the only time when you wont use it is
91 // when a link on the left hand frame is used. Also check to make sure we actually have the
92 // array in the registered session data. :)
93 if (! isset($use_mailbox_cache))
94 $use_mailbox_cache = 0;
95 if ($use_mailbox_cache && session_is_registered('msgs')) {
96 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
97 } else {
98 if (session_is_registered('msgs'))
99 unset($msgs);
100 if (session_is_registered('msort'))
101 unset($msort);
102 if (session_is_registered('numMessages'))
103 unset($numMessages);
104
105 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
106
107 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
108
109 if (session_is_registered('msgs') && isset($msgs))
110 session_register('msgs');
111 if (session_is_registered('msort') && isset($msort))
112 session_register('msort');
113 session_register('numMessages');
114 }
115
116 do_hook('right_main_bottom');
117 sqimap_logout ($imapConnection);
118 ?>
119 </FONT>
120 </BODY>
121 </HTML>