59177427 |
1 | <?php |
21c3249f |
2 | /** |
a09387f4 |
3 | ** right_main.php |
21c3249f |
4 | ** |
3bcede49 |
5 | ** Copyright (c) 1999-2000 The SquirrelMail development team |
6 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | ** |
21c3249f |
8 | ** This is where the mailboxes are listed. This controls most of what |
9 | ** goes on in SquirrelMail. |
10 | ** |
245a6892 |
11 | ** $Id$ |
21c3249f |
12 | **/ |
13 | |
441f2d33 |
14 | if (!isset($i18n_php)) |
91dc6e4e |
15 | include('../functions/i18n.php'); |
dc54c9f2 |
16 | |
2a32fc83 |
17 | session_start(); |
18 | |
10455998 |
19 | if(!isset($logged_in) || !isset($username) || !isset($key)) { |
91dc6e4e |
20 | include ('../themes/default_theme.php'); |
21 | include ('../functions/display_messages.php'); |
10455998 |
22 | printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">', |
23 | $color[8], $color[4], $color[7], $color[7], $color[7]); |
24 | plain_error_message(_("You need a valid user and password to access this page!") |
91dc6e4e |
25 | . '<br><a href="../src/login.php">' |
10455998 |
26 | . _("Click here to log back in.") . "</a>.", $color); |
91dc6e4e |
27 | echo '</body></html>'; |
21c3249f |
28 | exit; |
29 | } |
44139266 |
30 | |
245a6892 |
31 | if (!isset($strings_php)) |
91dc6e4e |
32 | include('../functions/strings.php'); |
d068c0ec |
33 | if (!isset($config_php)) |
91dc6e4e |
34 | include('../config/config.php'); |
d068c0ec |
35 | if (!isset($imap_php)) |
91dc6e4e |
36 | include('../functions/imap.php'); |
d068c0ec |
37 | if (!isset($date_php)) |
91dc6e4e |
38 | include('../functions/date.php'); |
d068c0ec |
39 | if (!isset($page_header_php)) |
91dc6e4e |
40 | include('../functions/page_header.php'); |
d068c0ec |
41 | if (!isset($array_php)) |
91dc6e4e |
42 | include('../functions/array.php'); |
d068c0ec |
43 | if (!isset($mime_php)) |
91dc6e4e |
44 | include('../functions/mime.php'); |
d068c0ec |
45 | if (!isset($mailbox_display_php)) |
91dc6e4e |
46 | include('../functions/mailbox_display.php'); |
d068c0ec |
47 | if (!isset($display_messages_php)) |
91dc6e4e |
48 | include('../functions/display_messages.php'); |
44139266 |
49 | ?> |
59177427 |
50 | <?php |
21c3249f |
51 | ///////////////////////////////////////////////////////////////////////////////// |
52 | // |
53 | // incoming variables from URL: |
54 | // $sort Direction to sort by date |
55 | // values: 0 - descending order |
56 | // values: 1 - ascending order |
57 | // $startMessage Message to start at |
58 | // $mailbox Full Mailbox name |
59 | // |
60 | // incoming from cookie: |
61 | // $username duh |
62 | // $key pass |
63 | // |
64 | ///////////////////////////////////////////////////////////////////////////////// |
65 | |
21c3249f |
66 | // open a connection on the imap port (143) |
e1469126 |
67 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
21c3249f |
68 | |
f3d17401 |
69 | /** If it was a successful login, lets load their preferences **/ |
91dc6e4e |
70 | include('../src/load_prefs.php'); |
f3d17401 |
71 | |
5c54e435 |
72 | if (isset($newsort) && $newsort != $sort) { |
91dc6e4e |
73 | setPref($data_dir, $username, 'sort', $newsort); |
5c54e435 |
74 | } |
75 | |
21c3249f |
76 | // If the page has been loaded without a specific mailbox, |
a48fbf9b |
77 | // send them to the inbox |
21c3249f |
78 | if (!isset($mailbox)) { |
91dc6e4e |
79 | $mailbox = 'INBOX'; |
e9f8ea4e |
80 | $startMessage = 1; |
21c3249f |
81 | } |
82 | |
cdcaac70 |
83 | // compensate for the UW vulnerability |
91dc6e4e |
84 | if ($imap_server_type == 'uw' && strstr($mailbox, '../')) { |
85 | $mailbox = 'INBOX'; |
cdcaac70 |
86 | } |
87 | |
813eba2f |
88 | sqimap_mailbox_select($imapConnection, $mailbox); |
f8f9bed9 |
89 | displayPageHeader($color, $mailbox); |
21c3249f |
90 | |
91dc6e4e |
91 | do_hook('right_main_after_header'); |
06ad27a2 |
92 | |
245a6892 |
93 | if (isset($just_logged_in) && $just_logged_in == 1 && |
94 | strlen(trim($motd)) > 0) { |
04632dbc |
95 | echo "<center><br>\n"; |
96 | echo "<table width=70% cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=\"$color[9]\">\n"; |
97 | echo "<table width=100% cellpadding=5 cellspacing=1 border=0><tr><td bgcolor=\"$color[4]\">\n"; |
98 | echo "$motd\n"; |
99 | echo "</td></tr></table>\n"; |
100 | echo "</td></tr></table>\n"; |
101 | echo "</center><br>\n"; |
a37f3771 |
102 | } |
103 | |
e452ce9b |
104 | if (isset($newsort)) { |
105 | $sort = $newsort; |
91dc6e4e |
106 | session_register('sort'); |
e452ce9b |
107 | } |
108 | |
9f2215a1 |
109 | // Check to see if we can use cache or not. Currently the only time when you wont use it is |
110 | // when a link on the left hand frame is used. Also check to make sure we actually have the |
111 | // array in the registered session data. :) |
245a6892 |
112 | if (! isset($use_mailbox_cache)) |
113 | $use_mailbox_cache = 0; |
91dc6e4e |
114 | if ($use_mailbox_cache && session_is_registered('msgs')) { |
dc54c9f2 |
115 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
90033b64 |
116 | } else { |
91dc6e4e |
117 | if (session_is_registered('msgs')) |
90033b64 |
118 | unset($msgs); |
91dc6e4e |
119 | if (session_is_registered('msort')) |
dc54c9f2 |
120 | unset($msort); |
91dc6e4e |
121 | if (session_is_registered('numMessages')) |
1108e8bb |
122 | unset($numMessages); |
123 | |
124 | $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox); |
9f2215a1 |
125 | |
dc54c9f2 |
126 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
90033b64 |
127 | |
91dc6e4e |
128 | if (session_is_registered('msgs') && isset($msgs)) |
129 | session_register('msgs'); |
130 | if (session_is_registered('msort') && isset($msort)) |
131 | session_register('msort'); |
132 | session_register('numMessages'); |
90033b64 |
133 | } |
21c3249f |
134 | |
91dc6e4e |
135 | do_hook('ight_main_bottom'); |
813eba2f |
136 | sqimap_logout ($imapConnection); |
21c3249f |
137 | ?> |
138 | </FONT> |
139 | </BODY> |
140 | </HTML> |