4 * webmail.php -- Displays the main frameset
6 * Copyright (c) 1999-2003 The SquirrelMail development team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file generates the main frameset. The files that are
10 * shown can be given as parameters. If the user is not logged in
11 * this file will verify username and password.
14 * @package squirrelmail
17 /** Path for SquirrelMail required files. */
18 define('SM_PATH','../');
20 /* SquirrelMail required files. */
21 require_once(SM_PATH
. 'functions/strings.php');
22 require_once(SM_PATH
. 'config/config.php');
23 require_once(SM_PATH
. 'functions/prefs.php');
24 require_once(SM_PATH
. 'functions/imap.php');
25 require_once(SM_PATH
. 'functions/plugin.php');
26 require_once(SM_PATH
. 'functions/i18n.php');
27 require_once(SM_PATH
. 'functions/auth.php');
28 require_once(SM_PATH
. 'functions/global.php');
30 if (!function_exists('sqm_baseuri')){
31 require_once(SM_PATH
. 'functions/display_messages.php');
33 $base_uri = sqm_baseuri();
35 sqsession_is_active();
37 sqgetGlobalVar('username', $username, SQ_SESSION
);
38 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION
);
39 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
41 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
43 if ( isset($_SESSION['session_expired_post']) ) {
44 sqsession_unregister('session_expired_post');
46 if(!sqgetGlobalVar('mailto', $mailto)) {
52 do_hook('webmail_top');
55 * We'll need this to later have a noframes version
57 * Check if the user has a language preference, but no cookie.
58 * Send him a cookie with his language preference, if there is
61 $my_language = getPref($data_dir, $username, 'language');
62 if ($my_language != $squirrelmail_language) {
63 setcookie('squirrelmail_language', $my_language, time()+
2592000, $base_uri);
66 $err=set_up_language(getPref($data_dir, $username, 'language'));
68 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
70 "<title>$org_title</title>\n".
73 // Japanese translation used without mbstring support
76 "<p>You need to have php4 installed with the multibyte string function \n".
77 "enabled (using configure option --enable-mbstring).</p>\n".
78 "<p>System assumed that you accidently switched to Japanese translation \n".
79 "and reverted your language preference to English.</p>\n".
80 "<p>Please refresh this page in order to use webmail.</p>\n".
85 $left_size = getPref($data_dir, $username, 'left_size');
86 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
88 if (isset($languages[$squirrelmail_language]['DIR']) &&
89 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
90 $temp_location_of_bar = 'right';
92 $temp_location_of_bar = 'left';
95 if ($location_of_bar == '') {
96 $location_of_bar = $temp_location_of_bar;
98 $temp_location_of_bar = '';
100 if ($left_size == "") {
101 if (isset($default_left_size)) {
102 $left_size = $default_left_size;
109 if ($location_of_bar == 'right') {
110 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
113 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
117 * There are three ways to call webmail.php
119 * - This just loads the default entry screen.
120 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
121 * - This loads the frames starting at the given values.
122 * 3. webmail.php?right_frame=folders.php
123 * - Loads the frames with the Folder options in the right frame.
125 * This was done to create a pure HTML way of refreshing the folder list since
126 * we would like to use as little Javascript as possible.
128 if (!isset($right_frame)) {
131 if ($right_frame == 'right_main.php') {
132 $urlMailbox = urlencode($mailbox);
134 "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
135 } elseif ($right_frame == 'options.php') {
136 $right_frame_url = 'options.php';
137 } elseif ($right_frame == 'folders.php') {
138 $right_frame_url = 'folders.php';
139 } elseif ($right_frame == 'compose.php') {
140 $right_frame_url = 'compose.php?' . $mailto;
141 } else if ($right_frame == '') {
142 $right_frame_url = 'right_main.php';
144 $right_frame_url = $right_frame;
147 $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'.
148 _("Folder List") ."\" />\n";
149 $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'.
150 _("Message List") ."\" />\n";
152 if ($location_of_bar == 'right') {
153 echo $right_frame . $left_frame;
156 echo $left_frame . $right_frame;
158 do_hook('webmail_bottom');