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.
16 /* Path for SquirrelMail required files. */
17 define('SM_PATH','../');
19 /* SquirrelMail required files. */
20 require_once(SM_PATH
. 'functions/strings.php');
21 require_once(SM_PATH
. 'config/config.php');
22 require_once(SM_PATH
. 'functions/prefs.php');
23 require_once(SM_PATH
. 'functions/imap.php');
24 require_once(SM_PATH
. 'functions/plugin.php');
25 require_once(SM_PATH
. 'functions/i18n.php');
26 require_once(SM_PATH
. 'functions/auth.php');
27 require_once(SM_PATH
. 'functions/global.php');
29 if (!function_exists('sqm_baseuri')){
30 require_once(SM_PATH
. 'functions/display_messages.php');
32 $base_uri = sqm_baseuri();
36 sqgetGlobalVar('username', $username, SQ_SESSION
);
37 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION
);
38 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
40 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
42 if ( isset($_SESSION['session_expired_post']) ) {
43 sqsession_unregister('session_expired_post');
48 do_hook('webmail_top');
51 * We'll need this to later have a noframes version
53 * Check if the user has a language preference, but no cookie.
54 * Send him a cookie with his language preference, if there is
57 $my_language = getPref($data_dir, $username, 'language');
58 if ($my_language != $squirrelmail_language) {
59 setcookie('squirrelmail_language', $my_language, time()+
2592000, $base_uri);
62 set_up_language(getPref($data_dir, $username, 'language'));
64 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
66 "<title>$org_title</title>\n".
69 $left_size = getPref($data_dir, $username, 'left_size');
70 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
72 if (isset($languages[$squirrelmail_language]['DIR']) &&
73 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
74 $temp_location_of_bar = 'right';
76 $temp_location_of_bar = 'left';
79 if ($location_of_bar == '') {
80 $location_of_bar = $temp_location_of_bar;
82 $temp_location_of_bar = '';
84 if ($left_size == "") {
85 if (isset($default_left_size)) {
86 $left_size = $default_left_size;
93 if ($location_of_bar == 'right') {
94 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
97 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
101 * There are three ways to call webmail.php
103 * - This just loads the default entry screen.
104 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
105 * - This loads the frames starting at the given values.
106 * 3. webmail.php?right_frame=folders.php
107 * - Loads the frames with the Folder options in the right frame.
109 * This was done to create a pure HTML way of refreshing the folder list since
110 * we would like to use as little Javascript as possible.
112 if (!isset($right_frame)) {
115 if ($right_frame == 'right_main.php') {
116 $urlMailbox = urlencode($mailbox);
118 "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
119 } elseif ($right_frame == 'options.php') {
120 $right_frame_url = 'options.php';
121 } elseif ($right_frame == 'folders.php') {
122 $right_frame_url = 'folders.php';
123 } else if ($right_frame == '') {
124 $right_frame_url = 'right_main.php';
126 $right_frame_url = $right_frame;
129 if ($location_of_bar == 'right') {
130 echo "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n" .
131 "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n";
134 echo "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n".
135 "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n";
137 do_hook('webmail_bottom');