59177427 |
1 | <?php |
23d6bd09 |
2 | /** |
3 | * right_main.php |
4 | * |
5 | * Copyright (c) 1999-2001 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 | * incoming variables from URL: * |
24 | * $sort Direction to sort by date * |
25 | * values: 0 - descending order * |
26 | * values: 1 - ascending order * |
27 | * $startMessage Message to start at * |
28 | * $mailbox Full Mailbox name * |
29 | * * |
30 | * incoming from cookie: * |
31 | * $username duh * |
32 | * $key pass * |
33 | ***********************************************************/ |
34 | |
35 | /* Open a connection on the imap port (143) */ |
36 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
37 | |
38 | if (isset($newsort) && $newsort != $sort) { |
39 | setPref($data_dir, $username, 'sort', $newsort); |
40 | } |
41 | |
42 | /* If the page has been loaded without a specific mailbox, */ |
43 | /* send them to the inbox */ |
44 | if (!isset($mailbox)) { |
45 | $mailbox = 'INBOX'; |
46 | $startMessage = 1; |
47 | } |
45e3eb3f |
48 | |
49 | if (! isset($startMessage) || $startMessage == '') |
50 | $startMessage = 1; |
23d6bd09 |
51 | |
52 | /* compensate for the UW vulnerability. */ |
53 | if ($imap_server_type == 'uw' && (strstr($mailbox, '../') !== false || |
54 | substr($mailbox, 0, 1) == '/')) { |
55 | $mailbox = 'INBOX'; |
56 | } |
57 | |
58 | sqimap_mailbox_select($imapConnection, $mailbox); |
59 | displayPageHeader($color, $mailbox); |
60 | echo "<br>\n"; |
61 | |
62 | do_hook('right_main_after_header'); |
63 | |
64 | if (isset($note)) { |
65 | echo "<CENTER><B>$note</B></CENTER><BR>\n"; |
66 | } |
67 | |
68 | if ($just_logged_in == true) { |
69 | $just_logged_in = false; |
70 | |
71 | if (strlen(trim($motd)) > 0) { |
72 | echo "<br><table align=center width=70% cellpadding=0 cellspacing=3 border=0 bgcolor=\"$color[9]\">" . |
73 | '<tr><td>' . |
74 | "<table width=100% cellpadding=5 cellspacing=1 border=0 bgcolor=\"$color[4]\">" . |
75 | "<tr><td align=center>$motd"; |
76 | do_hook('motd'); |
77 | echo '</td></tr>' . |
78 | '</table>' . |
79 | '</td></tr></table>'; |
80 | } |
81 | } |
a37f3771 |
82 | |
2016e645 |
83 | if (isset($newsort)) { |
84 | $sort = $newsort; |
85 | session_register('sort'); |
86 | } |
e452ce9b |
87 | |
23d6bd09 |
88 | /********************************************************************* |
89 | * Check to see if we can use cache or not. Currently the only time * |
90 | * when you will not use it is when a link on the left hand frame is * |
91 | * used. Also check to make sure we actually have the array in the * |
92 | * registered session data. :) * |
93 | *********************************************************************/ |
94 | if (! isset($use_mailbox_cache)) { |
95 | $use_mailbox_cache = 0; |
96 | } |
97 | |
98 | if ($use_mailbox_cache && session_is_registered('msgs')) { |
99 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
100 | } else { |
101 | if (session_is_registered('msgs')) { |
102 | unset($msgs); |
103 | } |
104 | |
105 | if (session_is_registered('msort')) { |
106 | unset($msort); |
107 | } |
108 | |
109 | if (session_is_registered('numMessages')) { |
2016e645 |
110 | unset($numMessages); |
23d6bd09 |
111 | } |
112 | |
113 | $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox); |
1108e8bb |
114 | |
45e3eb3f |
115 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, |
116 | $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
9f2215a1 |
117 | |
23d6bd09 |
118 | if (session_is_registered('msgs') && isset($msgs)) { |
119 | session_register('msgs'); |
120 | } |
2016e645 |
121 | |
23d6bd09 |
122 | if (session_is_registered('msort') && isset($msort)) { |
123 | session_register('msort'); |
124 | } |
125 | |
126 | session_register('numMessages'); |
127 | } |
21c3249f |
128 | |
23d6bd09 |
129 | do_hook('right_main_bottom'); |
130 | sqimap_logout ($imapConnection); |
21c3249f |
131 | ?> |
132 | </FONT> |
133 | </BODY> |
eaab965a |
134 | </HTML> |