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
);
40 sqgetGlobalVar('use_frames', $use_frames, SQ_COOKIE
);
41 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
43 if ( isset($_SESSION['session_expired_post']) ) {
44 sqsession_unregister('session_expired_post');
48 switch ($allow_frames) {
49 case 4: // if $use_frames unset, fall through to case 2
50 if (isset($use_frames))
52 case 2: // Do not use frames
55 case 3: // if $use_frames unset, fall through to case 1
56 if (isset($use_frames))
58 default: // default is also to use frames
64 if(!sqgetGlobalVar('mailto', $mailto)) {
70 do_hook('webmail_top');
73 * We'll need this to later have a noframes version
75 * Check if the user has a language preference, but no cookie.
76 * Send him a cookie with his language preference, if there is
79 $my_language = getPref($data_dir, $username, 'language');
80 if ($my_language != $squirrelmail_language) {
81 setcookie('squirrelmail_language', $my_language, time()+
2592000, $base_uri);
84 set_up_language(getPref($data_dir, $username, 'language'));
86 if (isset($use_frames) && !$use_frames) {
87 if (!isset($right_frame))
89 if ($right_frame == 'right_main.php') {
90 $urlMailbox = urlencode($mailbox);
91 $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
92 } elseif ($right_frame == 'options.php') {
93 $right_frame_url = 'options.php';
94 } elseif ($right_frame == 'folders.php') {
95 $right_frame_url = 'folders.php';
96 } else if ($right_frame == '') {
97 $right_frame_url = 'right_main.php';
99 $right_frame_url = $right_frame;
101 header("Location: $right_frame_url");
105 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
107 "<title>$org_title</title>\n".
110 $left_size = getPref($data_dir, $username, 'left_size');
111 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
113 if (isset($languages[$squirrelmail_language]['DIR']) &&
114 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
115 $temp_location_of_bar = 'right';
117 $temp_location_of_bar = 'left';
120 if ($location_of_bar == '') {
121 $location_of_bar = $temp_location_of_bar;
123 $temp_location_of_bar = '';
125 if ($left_size == "") {
126 if (isset($default_left_size)) {
127 $left_size = $default_left_size;
134 if ($location_of_bar == 'right') {
135 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
138 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
142 * There are three ways to call webmail.php
144 * - This just loads the default entry screen.
145 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
146 * - This loads the frames starting at the given values.
147 * 3. webmail.php?right_frame=folders.php
148 * - Loads the frames with the Folder options in the right frame.
150 * This was done to create a pure HTML way of refreshing the folder list since
151 * we would like to use as little Javascript as possible.
153 if (!isset($right_frame)) {
156 if ($right_frame == 'right_main.php') {
157 $urlMailbox = urlencode($mailbox);
159 "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
160 } elseif ($right_frame == 'options.php') {
161 $right_frame_url = 'options.php';
162 } elseif ($right_frame == 'folders.php') {
163 $right_frame_url = 'folders.php';
164 } elseif ($right_frame == 'compose.php') {
165 $right_frame_url = 'compose.php?' . $mailto;
166 } else if ($right_frame == '') {
167 $right_frame_url = 'right_main.php';
169 $right_frame_url = $right_frame;
172 $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'.
173 _("Folder List") ."\" />\n";
174 $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'.
175 _("Message List") ."\" />\n";
177 if ($location_of_bar == 'right') {
178 echo $right_frame . $left_frame;
181 echo $left_frame . $right_frame;
183 do_hook('webmail_bottom');