59177427 |
1 | <?php |
c6d6fe73 |
2 | |
864b1c33 |
3 | /** |
15e6162e |
4 | * webmail.php -- Displays the main frameset |
5 | * |
15e6162e |
6 | * This file generates the main frameset. The files that are |
7 | * shown can be given as parameters. If the user is not logged in |
8 | * this file will verify username and password. |
9 | * |
47ccfad4 |
10 | * @copyright © 1999-2006 The SquirrelMail Project Team |
4b4abf93 |
11 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
30967a1e |
12 | * @version $Id$ |
8f6f9ba5 |
13 | * @package squirrelmail |
15e6162e |
14 | */ |
21c3249f |
15 | |
30967a1e |
16 | /** |
17 | * Path for SquirrelMail required files. |
18 | * @ignore |
19 | */ |
86725763 |
20 | define('SM_PATH','../'); |
21 | |
22 | /* SquirrelMail required files. */ |
23 | require_once(SM_PATH . 'functions/strings.php'); |
24 | require_once(SM_PATH . 'config/config.php'); |
25 | require_once(SM_PATH . 'functions/prefs.php'); |
26 | require_once(SM_PATH . 'functions/imap.php'); |
27 | require_once(SM_PATH . 'functions/plugin.php'); |
28 | require_once(SM_PATH . 'functions/i18n.php'); |
29 | require_once(SM_PATH . 'functions/auth.php'); |
a32985a5 |
30 | require_once(SM_PATH . 'functions/global.php'); |
245a6892 |
31 | |
f3bc099d |
32 | if (!function_exists('sqm_baseuri')){ |
86725763 |
33 | require_once(SM_PATH . 'functions/display_messages.php'); |
f3bc099d |
34 | } |
35 | $base_uri = sqm_baseuri(); |
88fa922a |
36 | |
748ba6c0 |
37 | sqsession_is_active(); |
a32985a5 |
38 | |
f38b7cf0 |
39 | sqgetGlobalVar('username', $username, SQ_SESSION); |
40 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
41 | sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); |
dcc1cc82 |
42 | |
ef8d36ad |
43 | if (sqgetGlobalVar('sort', $sort)) { |
44 | $sort = (int) $sort; |
45 | } |
46 | |
47 | if (sqgetGlobalVar('startMessage', $startMessage)) { |
48 | $startMessage = (int) $startMessage; |
49 | } |
50 | |
a2b193bc |
51 | if (!sqgetGlobalVar('mailbox', $mailbox)) { |
ef8d36ad |
52 | $mailbox = 'INBOX'; |
53 | } |
54 | |
f38b7cf0 |
55 | sqgetGlobalVar('right_frame', $right_frame, SQ_GET); |
56 | |
db6a9192 |
57 | if ( isset($_SESSION['session_expired_post']) ) { |
58 | sqsession_unregister('session_expired_post'); |
59 | } |
c67e4479 |
60 | if(!sqgetGlobalVar('mailto', $mailto)) { |
61 | $mailto = ''; |
62 | } |
a32985a5 |
63 | |
864b1c33 |
64 | is_logged_in(); |
1b187352 |
65 | |
148ee1ef |
66 | do_hook('webmail_top'); |
67 | |
15e6162e |
68 | /** |
864b1c33 |
69 | * We'll need this to later have a noframes version |
70 | * |
71 | * Check if the user has a language preference, but no cookie. |
72 | * Send him a cookie with his language preference, if there is |
73 | * such discrepancy. |
74 | */ |
871ab9eb |
75 | $my_language = getPref($data_dir, $username, 'language'); |
864b1c33 |
76 | if ($my_language != $squirrelmail_language) { |
3a1de9f1 |
77 | sqsetcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri); |
864b1c33 |
78 | } |
cf47d363 |
79 | |
53da506b |
80 | $err=set_up_language(getPref($data_dir, $username, 'language')); |
441f2d33 |
81 | |
151562a7 |
82 | $output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n". |
83 | " \"http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd\">\n". |
0e3b9a5a |
84 | "<html><head>\n" . |
f8a1ed5a |
85 | "<meta name=\"robots\" content=\"noindex,nofollow\">\n" . |
0e3b9a5a |
86 | "<title>$org_title</title>\n". |
87 | "</head>"; |
65c3ec94 |
88 | |
53da506b |
89 | // Japanese translation used without mbstring support |
90 | if ($err==2) { |
0e3b9a5a |
91 | echo $output. |
92 | "<body>\n". |
238d4cfc |
93 | "<p>You need to have PHP installed with the multibyte string function \n". |
134e4174 |
94 | "enabled (using configure option --enable-mbstring).</p>\n". |
95 | "<p>System assumed that you accidently switched to Japanese translation \n". |
53da506b |
96 | "and reverted your language preference to English.</p>\n". |
134e4174 |
97 | "<p>Please refresh this page in order to use webmail.</p>\n". |
98 | "</body></html>"; |
53da506b |
99 | return; |
100 | } |
101 | |
871ab9eb |
102 | $left_size = getPref($data_dir, $username, 'left_size'); |
103 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
fab3baa6 |
104 | |
0c660770 |
105 | if (isset($languages[$squirrelmail_language]['DIR']) && |
106 | strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') { |
fab3baa6 |
107 | $temp_location_of_bar = 'right'; |
108 | } else { |
109 | $temp_location_of_bar = 'left'; |
110 | } |
111 | |
864b1c33 |
112 | if ($location_of_bar == '') { |
fab3baa6 |
113 | $location_of_bar = $temp_location_of_bar; |
864b1c33 |
114 | } |
fab3baa6 |
115 | $temp_location_of_bar = ''; |
116 | |
864b1c33 |
117 | if ($left_size == "") { |
118 | if (isset($default_left_size)) { |
f740c049 |
119 | $left_size = $default_left_size; |
864b1c33 |
120 | } |
121 | else { |
122 | $left_size = 200; |
123 | } |
65c3ec94 |
124 | } |
125 | |
864b1c33 |
126 | if ($location_of_bar == 'right') { |
0e3b9a5a |
127 | $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n"; |
864b1c33 |
128 | } |
129 | else { |
0e3b9a5a |
130 | $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n"; |
864b1c33 |
131 | } |
ad6787f0 |
132 | |
864b1c33 |
133 | /* |
134 | * There are three ways to call webmail.php |
135 | * 1. webmail.php |
136 | * - This just loads the default entry screen. |
137 | * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
138 | * - This loads the frames starting at the given values. |
139 | * 3. webmail.php?right_frame=folders.php |
140 | * - Loads the frames with the Folder options in the right frame. |
141 | * |
142 | * This was done to create a pure HTML way of refreshing the folder list since |
143 | * we would like to use as little Javascript as possible. |
0a03f924 |
144 | * |
145 | * The test for // should catch any attempt to include off-site webpages into |
146 | * our frameset. |
864b1c33 |
147 | */ |
f3fa1c10 |
148 | |
0a03f924 |
149 | if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) { |
793cc001 |
150 | $right_frame = ''; |
91e0dccc |
151 | } |
f3fa1c10 |
152 | |
02d8345e |
153 | switch($right_frame) { |
154 | case 'right_main.php': |
155 | $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox) |
ef8d36ad |
156 | . (!empty($sort)?"&sort=$sort":'') |
157 | . (!empty($startMessage)?"&startMessage=$startMessage":''); |
02d8345e |
158 | break; |
159 | case 'options.php': |
160 | $right_frame_url = 'options.php'; |
161 | break; |
162 | case 'folders.php': |
163 | $right_frame_url = 'folders.php'; |
164 | break; |
165 | case 'compose.php': |
166 | $right_frame_url = 'compose.php?' . $mailto; |
167 | break; |
168 | case '': |
169 | $right_frame_url = 'right_main.php'; |
170 | break; |
171 | default: |
172 | $right_frame_url = urlencode($right_frame); |
173 | break; |
174 | } |
9a732bb6 |
175 | |
da9a8410 |
176 | $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'. |
177 | _("Folder List") ."\" />\n"; |
178 | $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'. |
179 | _("Message List") ."\" />\n"; |
180 | |
864b1c33 |
181 | if ($location_of_bar == 'right') { |
0e3b9a5a |
182 | $output .= $right_frame . $left_frame; |
864b1c33 |
183 | } |
184 | else { |
0e3b9a5a |
185 | $output .= $left_frame . $right_frame; |
864b1c33 |
186 | } |
0e3b9a5a |
187 | $ret = concat_hook_function('webmail_bottom', $output); |
188 | if($ret != '') { |
189 | $output = $ret; |
190 | } |
191 | echo $output; |
a2b193bc |
192 | |
ad6787f0 |
193 | ?> |
d68323ff |
194 | </frameset> |
0a03f924 |
195 | </html> |