Seems I forgot to add a file.....
[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$
8f6f9ba5 14 * @package squirrelmail
15e6162e 15 */
21c3249f 16
8f6f9ba5 17/** Path for SquirrelMail required files. */
86725763 18define('SM_PATH','../');
19
20/* SquirrelMail required files. */
21require_once(SM_PATH . 'functions/strings.php');
22require_once(SM_PATH . 'config/config.php');
23require_once(SM_PATH . 'functions/prefs.php');
24require_once(SM_PATH . 'functions/imap.php');
25require_once(SM_PATH . 'functions/plugin.php');
26require_once(SM_PATH . 'functions/i18n.php');
27require_once(SM_PATH . 'functions/auth.php');
a32985a5 28require_once(SM_PATH . 'functions/global.php');
245a6892 29
f3bc099d 30if (!function_exists('sqm_baseuri')){
86725763 31 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 32}
33$base_uri = sqm_baseuri();
88fa922a 34
748ba6c0 35sqsession_is_active();
a32985a5 36
f38b7cf0 37sqgetGlobalVar('username', $username, SQ_SESSION);
38sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
39sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
1d80c108 40sqgetGlobalVar('use_frames', $use_frames, SQ_COOKIE);
f38b7cf0 41sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
42
db6a9192 43if ( isset($_SESSION['session_expired_post']) ) {
44 sqsession_unregister('session_expired_post');
45}
1d80c108 46global $plugins;
47
48switch ($allow_frames) {
49 case 4: // if $use_frames unset, fall through to case 2
50 if (isset($use_frames))
51 break;
52 case 2: // Do not use frames
53 $use_frames = 0;
54 break;
55 case 3: // if $use_frames unset, fall through to case 1
56 if (isset($use_frames))
57 break;
58 default: // default is also to use frames
59 case 1: // use frames
60 $use_frames = 1;
61 break;
62}
63
c67e4479 64if(!sqgetGlobalVar('mailto', $mailto)) {
65 $mailto = '';
66}
a32985a5 67
864b1c33 68is_logged_in();
1b187352 69
148ee1ef 70do_hook('webmail_top');
71
15e6162e 72/**
864b1c33 73 * We'll need this to later have a noframes version
74 *
75 * Check if the user has a language preference, but no cookie.
76 * Send him a cookie with his language preference, if there is
77 * such discrepancy.
78 */
871ab9eb 79$my_language = getPref($data_dir, $username, 'language');
864b1c33 80if ($my_language != $squirrelmail_language) {
81 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
82}
cf47d363 83
864b1c33 84set_up_language(getPref($data_dir, $username, 'language'));
441f2d33 85
1d80c108 86if (isset($use_frames) && !$use_frames) {
87 if (!isset($right_frame))
88 $right_frame = '';
89 if ($right_frame == 'right_main.php') {
90 $urlMailbox = urlencode($mailbox);
91 $right_frame_url = "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;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';
98 } else {
99 $right_frame_url = $right_frame;
100 }
101 header("Location: $right_frame_url");
102}
103
104
7dfa92cb 105echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
ac50138c 106 "<html><head>\n" .
2b55df0c 107 "<title>$org_title</title>\n".
108 "</head>";
65c3ec94 109
871ab9eb 110$left_size = getPref($data_dir, $username, 'left_size');
111$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 112
0c660770 113if (isset($languages[$squirrelmail_language]['DIR']) &&
114 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 115 $temp_location_of_bar = 'right';
116} else {
117 $temp_location_of_bar = 'left';
118}
119
864b1c33 120if ($location_of_bar == '') {
fab3baa6 121 $location_of_bar = $temp_location_of_bar;
864b1c33 122}
fab3baa6 123$temp_location_of_bar = '';
124
864b1c33 125if ($left_size == "") {
126 if (isset($default_left_size)) {
f740c049 127 $left_size = $default_left_size;
864b1c33 128 }
129 else {
130 $left_size = 200;
131 }
65c3ec94 132}
133
864b1c33 134if ($location_of_bar == 'right') {
7dfa92cb 135 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
864b1c33 136}
137else {
7dfa92cb 138 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
864b1c33 139}
ad6787f0 140
864b1c33 141/*
142 * There are three ways to call webmail.php
143 * 1. 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.
149 *
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.
152 */
153if (!isset($right_frame)) {
793cc001 154 $right_frame = '';
78194072 155}
864b1c33 156if ($right_frame == 'right_main.php') {
157 $urlMailbox = urlencode($mailbox);
158 $right_frame_url =
3d570ba0 159 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
65c3ec94 160} elseif ($right_frame == 'options.php') {
864b1c33 161 $right_frame_url = 'options.php';
65c3ec94 162} elseif ($right_frame == 'folders.php') {
864b1c33 163 $right_frame_url = 'folders.php';
c67e4479 164} elseif ($right_frame == 'compose.php') {
165 $right_frame_url = 'compose.php?' . $mailto;
78194072 166} else if ($right_frame == '') {
871ab9eb 167 $right_frame_url = 'right_main.php';
78194072 168} else {
fdc9d9b5 169 $right_frame_url = $right_frame;
864b1c33 170}
9a732bb6 171
da9a8410 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";
176
864b1c33 177if ($location_of_bar == 'right') {
da9a8410 178 echo $right_frame . $left_frame;
864b1c33 179}
180else {
da9a8410 181 echo $left_frame . $right_frame;
864b1c33 182}
753ce838 183do_hook('webmail_bottom');
ad6787f0 184?>
d68323ff 185</frameset>
186</html>