Update
[squirrelmail.git] / src / webmail.php
CommitLineData
59177427 1<?php
c6d6fe73 2
864b1c33 3/**
15e6162e 4 * webmail.php -- Displays the main frameset
5 *
76911253 6 * Copyright (c) 1999-2003 The SquirrelMail development team
15e6162e 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
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.
12 *
13 * $Id$
14 */
21c3249f 15
86725763 16/* Path for SquirrelMail required files. */
17define('SM_PATH','../');
18
19/* SquirrelMail required files. */
20require_once(SM_PATH . 'functions/strings.php');
21require_once(SM_PATH . 'config/config.php');
22require_once(SM_PATH . 'functions/prefs.php');
23require_once(SM_PATH . 'functions/imap.php');
24require_once(SM_PATH . 'functions/plugin.php');
25require_once(SM_PATH . 'functions/i18n.php');
26require_once(SM_PATH . 'functions/auth.php');
a32985a5 27require_once(SM_PATH . 'functions/global.php');
245a6892 28
f3bc099d 29if (!function_exists('sqm_baseuri')){
86725763 30 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 31}
32$base_uri = sqm_baseuri();
88fa922a 33
864b1c33 34session_start();
a32985a5 35
f38b7cf0 36sqgetGlobalVar('username', $username, SQ_SESSION);
37sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
38sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
39
40sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
41
db6a9192 42if ( isset($_SESSION['session_expired_post']) ) {
43 sqsession_unregister('session_expired_post');
44}
a32985a5 45
864b1c33 46is_logged_in();
1b187352 47
148ee1ef 48do_hook('webmail_top');
49
15e6162e 50/**
864b1c33 51 * We'll need this to later have a noframes version
52 *
53 * Check if the user has a language preference, but no cookie.
54 * Send him a cookie with his language preference, if there is
55 * such discrepancy.
56 */
871ab9eb 57$my_language = getPref($data_dir, $username, 'language');
864b1c33 58if ($my_language != $squirrelmail_language) {
59 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
60}
cf47d363 61
864b1c33 62set_up_language(getPref($data_dir, $username, 'language'));
441f2d33 63
7dfa92cb 64echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
ac50138c 65 "<html><head>\n" .
2b55df0c 66 "<title>$org_title</title>\n".
67 "</head>";
65c3ec94 68
871ab9eb 69$left_size = getPref($data_dir, $username, 'left_size');
70$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 71
0c660770 72if (isset($languages[$squirrelmail_language]['DIR']) &&
73 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 74 $temp_location_of_bar = 'right';
75} else {
76 $temp_location_of_bar = 'left';
77}
78
864b1c33 79if ($location_of_bar == '') {
fab3baa6 80 $location_of_bar = $temp_location_of_bar;
864b1c33 81}
fab3baa6 82$temp_location_of_bar = '';
83
864b1c33 84if ($left_size == "") {
85 if (isset($default_left_size)) {
f740c049 86 $left_size = $default_left_size;
864b1c33 87 }
88 else {
89 $left_size = 200;
90 }
65c3ec94 91}
92
864b1c33 93if ($location_of_bar == 'right') {
7dfa92cb 94 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
864b1c33 95}
96else {
7dfa92cb 97 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
864b1c33 98}
ad6787f0 99
864b1c33 100/*
101 * There are three ways to call webmail.php
102 * 1. 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.
108 *
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.
111 */
112if (!isset($right_frame)) {
793cc001 113 $right_frame = '';
78194072 114}
864b1c33 115if ($right_frame == 'right_main.php') {
116 $urlMailbox = urlencode($mailbox);
117 $right_frame_url =
3d570ba0 118 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
65c3ec94 119} elseif ($right_frame == 'options.php') {
864b1c33 120 $right_frame_url = 'options.php';
65c3ec94 121} elseif ($right_frame == 'folders.php') {
864b1c33 122 $right_frame_url = 'folders.php';
78194072 123} else if ($right_frame == '') {
871ab9eb 124 $right_frame_url = 'right_main.php';
78194072 125} else {
fdc9d9b5 126 $right_frame_url = $right_frame;
864b1c33 127}
9a732bb6 128
864b1c33 129if ($location_of_bar == 'right') {
d68323ff 130 echo "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n" .
131 "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n";
864b1c33 132}
133else {
d68323ff 134 echo "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n".
135 "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n";
864b1c33 136}
753ce838 137do_hook('webmail_bottom');
ad6787f0 138?>
d68323ff 139</frameset>
140</html>