86ac26545285f96b3590bcab58dc3a1c6497abb5
4 * webmail.php -- Displays the main frameset
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.
10 * @copyright © 1999-2006 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @package squirrelmail
17 * Path for SquirrelMail required files.
20 define('SM_PATH','../');
22 /* SquirrelMail required files. */
23 require_once(SM_PATH
. 'functions/global.php');
24 require_once(SM_PATH
. 'functions/strings.php');
25 require_once(SM_PATH
. 'config/config.php');
26 require_once(SM_PATH
. 'functions/prefs.php');
27 require_once(SM_PATH
. 'functions/imap.php');
28 require_once(SM_PATH
. 'functions/plugin.php');
29 require_once(SM_PATH
. 'functions/i18n.php');
30 require_once(SM_PATH
. 'functions/auth.php');
32 $base_uri = sqm_baseuri();
34 sqsession_is_active();
36 sqgetGlobalVar('username', $username, SQ_SESSION
);
37 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION
);
38 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
40 if (sqgetGlobalVar('sort', $sort)) {
44 if (sqgetGlobalVar('startMessage', $startMessage)) {
45 $startMessage = (int) $startMessage;
48 if (!sqgetGlobalVar('mailbox', $mailbox)) {
52 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
54 if ( isset($_SESSION['session_expired_post']) ) {
55 sqsession_unregister('session_expired_post');
57 if(!sqgetGlobalVar('mailto', $mailto)) {
63 do_hook('webmail_top');
66 * We'll need this to later have a noframes version
68 * Check if the user has a language preference, but no cookie.
69 * Send him a cookie with his language preference, if there is
72 $my_language = getPref($data_dir, $username, 'language');
73 if ($my_language != $squirrelmail_language) {
74 sqsetcookie('squirrelmail_language', $my_language, time()+
2592000, $base_uri);
77 $err=set_up_language(getPref($data_dir, $username, 'language'));
79 $output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n".
80 " \"http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd\">\n".
82 "<meta name=\"robots\" content=\"noindex,nofollow\">\n" .
83 "<title>$org_title</title>\n".
86 // Japanese translation used without mbstring support
90 "<p>You need to have PHP installed with the multibyte string function \n".
91 "enabled (using configure option --enable-mbstring).</p>\n".
92 "<p>System assumed that you accidently switched to Japanese translation \n".
93 "and reverted your language preference to English.</p>\n".
94 "<p>Please refresh this page in order to use webmail.</p>\n".
99 $left_size = getPref($data_dir, $username, 'left_size');
100 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
102 if (isset($languages[$squirrelmail_language]['DIR']) &&
103 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
104 $temp_location_of_bar = 'right';
106 $temp_location_of_bar = 'left';
109 if ($location_of_bar == '') {
110 $location_of_bar = $temp_location_of_bar;
112 $temp_location_of_bar = '';
114 if ($left_size == "") {
115 if (isset($default_left_size)) {
116 $left_size = $default_left_size;
123 if ($location_of_bar == 'right') {
124 $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
127 $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
131 * There are three ways to call webmail.php
133 * - This just loads the default entry screen.
134 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
135 * - This loads the frames starting at the given values.
136 * 3. webmail.php?right_frame=folders.php
137 * - Loads the frames with the Folder options in the right frame.
139 * This was done to create a pure HTML way of refreshing the folder list since
140 * we would like to use as little Javascript as possible.
142 * The test for // should catch any attempt to include off-site webpages into
146 if (empty($right_frame) ||
(strpos(urldecode($right_frame), '//') !== false)) {
150 if ( strpos($right_frame,'?') ) {
151 $right_frame_file = substr($right_frame,0,strpos($right_frame,'?'));
153 $right_frame_file = $right_frame;
156 switch($right_frame) {
157 case 'right_main.php':
158 $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
159 . (!empty($sort)?
"&sort=$sort":'')
160 . (!empty($startMessage)?
"&startMessage=$startMessage":'');
163 $right_frame_url = 'options.php';
166 $right_frame_url = 'folders.php';
169 $right_frame_url = 'compose.php?' . $mailto;
172 $right_frame_url = 'right_main.php';
175 $right_frame_url = urlencode($right_frame);
179 $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'.
180 _("Folder List") ."\" />\n";
181 $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'.
182 _("Message List") ."\" />\n";
184 if ($location_of_bar == 'right') {
185 $output .= $right_frame . $left_frame;
188 $output .= $left_frame . $right_frame;
190 $ret = concat_hook_function('webmail_bottom', $output);