Adding full locale names. Enabled ukrainian and russian-ukrainian
[squirrelmail.git] / src / right_main.php
... / ...
CommitLineData
1<?php
2
3/**
4 * right_main.php
5 *
6 * Copyright (c) 1999-2004 The SquirrelMail Project 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 * @package squirrelmail
14 */
15
16/** Path for SquirrelMail required files. */
17define('SM_PATH','../');
18
19/* SquirrelMail required files. */
20require_once(SM_PATH . 'include/validate.php');
21require_once(SM_PATH . 'functions/global.php');
22require_once(SM_PATH . 'functions/imap.php');
23require_once(SM_PATH . 'functions/date.php');
24require_once(SM_PATH . 'functions/mime.php');
25require_once(SM_PATH . 'functions/mailbox_display.php');
26require_once(SM_PATH . 'functions/display_messages.php');
27require_once(SM_PATH . 'functions/html.php');
28
29/***********************************************************
30 * incoming variables from URL: *
31 * $sort Direction to sort by date *
32 * values: 0 - descending order *
33 * values: 1 - ascending order *
34 * $startMessage Message to start at *
35 * $mailbox Full Mailbox name *
36 * *
37 * incoming from cookie: *
38 * $key pass *
39 * incoming from session: *
40 * $username duh *
41 * *
42 ***********************************************************/
43
44
45/* lets get the global vars we may need */
46sqgetGlobalVar('key', $key, SQ_COOKIE);
47sqgetGlobalVar('username', $username, SQ_SESSION);
48sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
49sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
50sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
51
52sqgetGlobalVar('mailbox', $mailbox);
53sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
54sqgetGlobalVar('numMessages' , $numMessages, SQ_SESSION);
55sqgetGlobalVar('session', $session, SQ_GET);
56sqgetGlobalVar('note', $note, SQ_GET);
57sqgetGlobalVar('mail_sent', $mail_sent, SQ_GET);
58sqgetGlobalVar('use_mailbox_cache', $use_mailbox_cache, SQ_GET);
59
60if ( sqgetGlobalVar('startMessage', $temp) ) {
61 $startMessage = (int) $temp;
62}
63if ( sqgetGlobalVar('PG_SHOWNUM', $temp) ) {
64 $PG_SHOWNUM = (int) $temp;
65}
66if ( sqgetGlobalVar('PG_SHOWALL', $temp, SQ_GET) ) {
67 $PG_SHOWALL = (int) $temp;
68}
69if ( sqgetGlobalVar('newsort', $temp, SQ_GET) ) {
70 $newsort = (int) $temp;
71}
72if ( sqgetGlobalVar('checkall', $temp, SQ_GET) ) {
73 $checkall = (int) $temp;
74}
75if ( sqgetGlobalVar('set_thread', $temp, SQ_GET) ) {
76 $set_thread = (int) $temp;
77}
78if ( !sqgetGlobalVar('composenew', $composenew, SQ_GET) ) {
79 $composenew = false;
80}
81/* end of get globals */
82
83
84/* Open a connection on the imap port (143) */
85
86$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
87
88if (isset($PG_SHOWALL)) {
89 if ($PG_SHOWALL) {
90 $PG_SHOWNUM=999999;
91 $show_num=$PG_SHOWNUM;
92 sqsession_register($PG_SHOWNUM, 'PG_SHOWNUM');
93 }
94 else {
95 sqsession_unregister('PG_SHOWNUM');
96 unset($PG_SHOWNUM);
97 }
98}
99else if( isset( $PG_SHOWNUM ) ) {
100 $show_num = $PG_SHOWNUM;
101}
102
103if (isset($newsort) ) {
104 if ( $newsort != $sort )
105 setPref($data_dir, $username, 'sort', $newsort);
106
107 $sort = $newsort;
108 sqsession_register($sort, 'sort');
109}
110
111/* If the page has been loaded without a specific mailbox, */
112/* send them to the inbox */
113if (!isset($mailbox)) {
114 $mailbox = 'INBOX';
115 $startMessage = 1;
116}
117
118
119if (!isset($startMessage) || ($startMessage == '')) {
120 $startMessage = 1;
121}
122
123/* compensate for the UW vulnerability. */
124if ($imap_server_type == 'uw' && (strstr($mailbox, '../') ||
125 substr($mailbox, 0, 1) == '/')) {
126 $mailbox = 'INBOX';
127}
128
129/* decide if we are thread sorting or not */
130if ($allow_thread_sort == TRUE) {
131 if (isset($set_thread)) {
132 if ($set_thread == 1) {
133 setPref($data_dir, $username, "thread_$mailbox", 1);
134 $thread_sort_messages = '1';
135 }
136 elseif ($set_thread == 2) {
137 setPref($data_dir, $username, "thread_$mailbox", 0);
138 $thread_sort_messages = '0';
139 }
140 }
141 else {
142 $thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox");
143 }
144}
145else {
146 $thread_sort_messages = 0;
147}
148
149do_hook ('generic_header');
150
151sqimap_mailbox_select($imapConnection, $mailbox);
152
153if ($composenew) {
154 $comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
155 "&session=$session";
156 displayPageHeader($color, $mailbox, "comp_in_new('$comp_uri');", false);
157} else {
158 displayPageHeader($color, $mailbox);
159}
160do_hook('right_main_after_header');
161
162/* display a message to the user that their mail has been sent */
163if (isset($mail_sent) && $mail_sent == 'yes') {
164 $note = _("Your Message has been sent.");
165}
166if (isset($note)) {
167 echo html_tag( 'div', '<b>' . $note .'</b>', 'center' ) . "<br>\n";
168}
169
170if ( sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION) ) {
171 if ($just_logged_in == true) {
172 $just_logged_in = false;
173 sqsession_register($just_logged_in, 'just_logged_in');
174
175 if (strlen(trim($motd)) > 0) {
176 echo html_tag( 'table',
177 html_tag( 'tr',
178 html_tag( 'td',
179 html_tag( 'table',
180 html_tag( 'tr',
181 html_tag( 'td', $motd, 'center' )
182 ) ,
183 '', $color[4], 'width="100%" cellpadding="5" cellspacing="1" border="0"' )
184 )
185 ) ,
186 'center', $color[9], 'width="70%" cellpadding="0" cellspacing="3" border="0"' );
187 }
188 }
189}
190
191
192/*********************************************************************
193 * Check to see if we can use cache or not. Currently the only time *
194 * when you will not use it is when a link on the left hand frame is *
195 * used. Also check to make sure we actually have the array in the *
196 * registered session data. :) *
197 *********************************************************************/
198if (! isset($use_mailbox_cache)) {
199 $use_mailbox_cache = 0;
200}
201
202if ($use_mailbox_cache && sqsession_is_registered('msgs')) {
203 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
204} else {
205 if (sqsession_is_registered('msgs')) {
206 unset($msgs);
207 }
208
209 if (sqsession_is_registered('msort')) {
210 unset($msort);
211 }
212
213 if (sqsession_is_registered('numMessages')) {
214 unset($numMessages);
215 }
216
217 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
218
219 showMessagesForMailbox($imapConnection, $mailbox, $numMessages,
220 $startMessage, $sort, $color, $show_num,
221 $use_mailbox_cache);
222
223 if (sqsession_is_registered('msgs') && isset($msgs)) {
224 sqsession_register($msgs, 'msgs');
225 //$_SESSION['msgs'] = $msgs;
226 }
227
228 if (sqsession_is_registered('msort') && isset($msort)) {
229 sqsession_register($msort, 'msort');
230 //$_SESSION['msort'] = $msort;
231 }
232
233 sqsession_register($numMessages, 'numMessages');
234 //$_SESSION['numMessages'] = $numMessages;
235}
236do_hook('right_main_bottom');
237sqimap_logout ($imapConnection);
238
239echo '</body></html>';
240
241?>