59177427 |
1 | <?php |
895905c0 |
2 | |
23d6bd09 |
3 | /** |
895905c0 |
4 | ** right_main.php |
5 | ** |
6 | ** Copyright (c) 1999-2001 The Squirrelmail Development Team |
7 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | ** |
9 | ** This is where the mailboxes are listed. This controls most of what |
10 | ** goes on in SquirrelMail. |
11 | ** |
12 | ** $Id$ |
13 | **/ |
23d6bd09 |
14 | |
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'); |
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 | /* Open a connection on the imap port (143) */ |
37 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
38 | |
39 | if (isset($newsort) && $newsort != $sort) { |
40 | setPref($data_dir, $username, 'sort', $newsort); |
41 | } |
42 | |
43 | /* If the page has been loaded without a specific mailbox, */ |
44 | /* send them to the inbox */ |
45 | if (!isset($mailbox)) { |
46 | $mailbox = 'INBOX'; |
47 | $startMessage = 1; |
48 | } |
45e3eb3f |
49 | |
50 | if (! isset($startMessage) || $startMessage == '') |
51 | $startMessage = 1; |
23d6bd09 |
52 | |
53 | /* compensate for the UW vulnerability. */ |
dfec863e |
54 | if ($imap_server_type == 'uw' && (strstr($mailbox, '../') || |
23d6bd09 |
55 | substr($mailbox, 0, 1) == '/')) { |
56 | $mailbox = 'INBOX'; |
57 | } |
58 | |
59 | sqimap_mailbox_select($imapConnection, $mailbox); |
60 | displayPageHeader($color, $mailbox); |
61 | echo "<br>\n"; |
62 | |
63 | do_hook('right_main_after_header'); |
64 | |
65 | if (isset($note)) { |
66 | echo "<CENTER><B>$note</B></CENTER><BR>\n"; |
67 | } |
68 | |
69 | if ($just_logged_in == true) { |
70 | $just_logged_in = false; |
71 | |
72 | if (strlen(trim($motd)) > 0) { |
73 | echo "<br><table align=center width=70% cellpadding=0 cellspacing=3 border=0 bgcolor=\"$color[9]\">" . |
74 | '<tr><td>' . |
75 | "<table width=100% cellpadding=5 cellspacing=1 border=0 bgcolor=\"$color[4]\">" . |
76 | "<tr><td align=center>$motd"; |
77 | do_hook('motd'); |
78 | echo '</td></tr>' . |
79 | '</table>' . |
80 | '</td></tr></table>'; |
81 | } |
82 | } |
a37f3771 |
83 | |
2016e645 |
84 | if (isset($newsort)) { |
85 | $sort = $newsort; |
86 | session_register('sort'); |
87 | } |
e452ce9b |
88 | |
23d6bd09 |
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; |
97 | } |
98 | |
99 | if ($use_mailbox_cache && session_is_registered('msgs')) { |
100 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
101 | } else { |
102 | if (session_is_registered('msgs')) { |
103 | unset($msgs); |
104 | } |
105 | |
106 | if (session_is_registered('msort')) { |
107 | unset($msort); |
108 | } |
109 | |
110 | if (session_is_registered('numMessages')) { |
2016e645 |
111 | unset($numMessages); |
23d6bd09 |
112 | } |
113 | |
114 | $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox); |
1108e8bb |
115 | |
45e3eb3f |
116 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, |
dfec863e |
117 | $startMessage, $sort, $color, $show_num, |
118 | $use_mailbox_cache); |
9f2215a1 |
119 | |
23d6bd09 |
120 | if (session_is_registered('msgs') && isset($msgs)) { |
121 | session_register('msgs'); |
122 | } |
2016e645 |
123 | |
23d6bd09 |
124 | if (session_is_registered('msort') && isset($msort)) { |
125 | session_register('msort'); |
126 | } |
127 | |
128 | session_register('numMessages'); |
129 | } |
21c3249f |
130 | |
23d6bd09 |
131 | do_hook('right_main_bottom'); |
132 | sqimap_logout ($imapConnection); |
21c3249f |
133 | ?> |
134 | </FONT> |
135 | </BODY> |
eaab965a |
136 | </HTML> |