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/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');
30 require_once(SM_PATH
. 'functions/global.php');
32 if (!function_exists('sqm_baseuri')){
33 require_once(SM_PATH
. 'functions/display_messages.php');
35 $base_uri = sqm_baseuri();
37 sqsession_is_active();
39 sqgetGlobalVar('username', $username, SQ_SESSION
);
40 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION
);
41 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
43 if (sqgetGlobalVar('sort', $sort)) {
47 if (sqgetGlobalVar('startMessage', $startMessage)) {
48 $startMessage = (int) $startMessage;
51 if (!sqgetGlobalVar('mailbox', $mailbox)) {
55 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
57 if ( isset($_SESSION['session_expired_post']) ) {
58 sqsession_unregister('session_expired_post');
60 if(!sqgetGlobalVar('mailto', $mailto)) {
66 do_hook('webmail_top');
69 * We'll need this to later have a noframes version
71 * Check if the user has a language preference, but no cookie.
72 * Send him a cookie with his language preference, if there is
75 $my_language = getPref($data_dir, $username, 'language');
76 if ($my_language != $squirrelmail_language) {
77 sqsetcookie('squirrelmail_language', $my_language, time()+
2592000, $base_uri);
80 $err=set_up_language(getPref($data_dir, $username, 'language'));
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".
85 "<meta name=\"robots\" content=\"noindex,nofollow\">\n" .
86 "<title>$org_title</title>\n".
89 // Japanese translation used without mbstring support
93 "<p>You need to have PHP installed with the multibyte string function \n".
94 "enabled (using configure option --enable-mbstring).</p>\n".
95 "<p>System assumed that you accidently switched to Japanese translation \n".
96 "and reverted your language preference to English.</p>\n".
97 "<p>Please refresh this page in order to use webmail.</p>\n".
102 $left_size = getPref($data_dir, $username, 'left_size');
103 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
105 if (isset($languages[$squirrelmail_language]['DIR']) &&
106 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
107 $temp_location_of_bar = 'right';
109 $temp_location_of_bar = 'left';
112 if ($location_of_bar == '') {
113 $location_of_bar = $temp_location_of_bar;
115 $temp_location_of_bar = '';
117 if ($left_size == "") {
118 if (isset($default_left_size)) {
119 $left_size = $default_left_size;
126 if ($location_of_bar == 'right') {
127 $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
130 $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
134 * There are three ways to call 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.
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.
145 * The test for // should catch any attempt to include off-site webpages into
149 if (empty($right_frame) ||
(strpos(urldecode($right_frame), '//') !== false)) {
153 switch($right_frame) {
154 case 'right_main.php':
155 $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
156 . (!empty($sort)?
"&sort=$sort":'')
157 . (!empty($startMessage)?
"&startMessage=$startMessage":'');
160 $right_frame_url = 'options.php';
163 $right_frame_url = 'folders.php';
166 $right_frame_url = 'compose.php?' . $mailto;
169 $right_frame_url = 'right_main.php';
172 $right_frame_url = urlencode($right_frame);
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";
181 if ($location_of_bar == 'right') {
182 $output .= $right_frame . $left_frame;
185 $output .= $left_frame . $right_frame;
187 $ret = concat_hook_function('webmail_bottom', $output);