phpDocumentor updates
[squirrelmail.git] / src / webmail.php
CommitLineData
59177427 1<?php
c6d6fe73 2
864b1c33 3/**
15e6162e 4 * webmail.php -- Displays the main frameset
5 *
15e6162e 6 * This file generates the main frameset. The files that are
7 * shown can be given as parameters. If the user is not logged in
8 * this file will verify username and password.
9 *
4b4abf93 10 * @copyright &copy; 1999-2005 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
30967a1e 12 * @version $Id$
8f6f9ba5 13 * @package squirrelmail
15e6162e 14 */
21c3249f 15
30967a1e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
86725763 20define('SM_PATH','../');
21
22/* SquirrelMail required files. */
23require_once(SM_PATH . 'functions/strings.php');
24require_once(SM_PATH . 'config/config.php');
25require_once(SM_PATH . 'functions/prefs.php');
26require_once(SM_PATH . 'functions/imap.php');
27require_once(SM_PATH . 'functions/plugin.php');
28require_once(SM_PATH . 'functions/i18n.php');
29require_once(SM_PATH . 'functions/auth.php');
a32985a5 30require_once(SM_PATH . 'functions/global.php');
245a6892 31
f3bc099d 32if (!function_exists('sqm_baseuri')){
86725763 33 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 34}
35$base_uri = sqm_baseuri();
88fa922a 36
748ba6c0 37sqsession_is_active();
a32985a5 38
f38b7cf0 39sqgetGlobalVar('username', $username, SQ_SESSION);
40sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
41sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
dcc1cc82 42
ef8d36ad 43if (sqgetGlobalVar('sort', $sort)) {
44 $sort = (int) $sort;
45}
46
47if (sqgetGlobalVar('startMessage', $startMessage)) {
48 $startMessage = (int) $startMessage;
49}
50
a2b193bc 51if (!sqgetGlobalVar('mailbox', $mailbox)) {
ef8d36ad 52 $mailbox = 'INBOX';
53}
54
f38b7cf0 55sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
56
db6a9192 57if ( isset($_SESSION['session_expired_post']) ) {
58 sqsession_unregister('session_expired_post');
59}
c67e4479 60if(!sqgetGlobalVar('mailto', $mailto)) {
61 $mailto = '';
62}
a32985a5 63
864b1c33 64is_logged_in();
1b187352 65
148ee1ef 66do_hook('webmail_top');
67
15e6162e 68/**
864b1c33 69 * We'll need this to later have a noframes version
70 *
71 * Check if the user has a language preference, but no cookie.
72 * Send him a cookie with his language preference, if there is
73 * such discrepancy.
74 */
871ab9eb 75$my_language = getPref($data_dir, $username, 'language');
864b1c33 76if ($my_language != $squirrelmail_language) {
77 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
78}
cf47d363 79
53da506b 80$err=set_up_language(getPref($data_dir, $username, 'language'));
441f2d33 81
0e3b9a5a 82$output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
83 "<html><head>\n" .
f8a1ed5a 84 "<meta name=\"robots\" content=\"noindex,nofollow\">\n" .
0e3b9a5a 85 "<title>$org_title</title>\n".
86 "</head>";
65c3ec94 87
53da506b 88// Japanese translation used without mbstring support
89if ($err==2) {
0e3b9a5a 90 echo $output.
91 "<body>\n".
238d4cfc 92 "<p>You need to have PHP installed with the multibyte string function \n".
134e4174 93 "enabled (using configure option --enable-mbstring).</p>\n".
94 "<p>System assumed that you accidently switched to Japanese translation \n".
53da506b 95 "and reverted your language preference to English.</p>\n".
134e4174 96 "<p>Please refresh this page in order to use webmail.</p>\n".
97 "</body></html>";
53da506b 98 return;
99}
100
871ab9eb 101$left_size = getPref($data_dir, $username, 'left_size');
102$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 103
0c660770 104if (isset($languages[$squirrelmail_language]['DIR']) &&
105 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 106 $temp_location_of_bar = 'right';
107} else {
108 $temp_location_of_bar = 'left';
109}
110
864b1c33 111if ($location_of_bar == '') {
fab3baa6 112 $location_of_bar = $temp_location_of_bar;
864b1c33 113}
fab3baa6 114$temp_location_of_bar = '';
115
864b1c33 116if ($left_size == "") {
117 if (isset($default_left_size)) {
f740c049 118 $left_size = $default_left_size;
864b1c33 119 }
120 else {
121 $left_size = 200;
122 }
65c3ec94 123}
124
864b1c33 125if ($location_of_bar == 'right') {
0e3b9a5a 126 $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
864b1c33 127}
128else {
0e3b9a5a 129 $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
864b1c33 130}
ad6787f0 131
864b1c33 132/*
133 * There are three ways to call webmail.php
134 * 1. webmail.php
135 * - This just loads the default entry screen.
136 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
137 * - This loads the frames starting at the given values.
138 * 3. webmail.php?right_frame=folders.php
139 * - Loads the frames with the Folder options in the right frame.
140 *
141 * This was done to create a pure HTML way of refreshing the folder list since
142 * we would like to use as little Javascript as possible.
143 */
f3fa1c10 144
145if (empty($right_frame) || (strpos(urldecode($right_frame), '://'))) {
793cc001 146 $right_frame = '';
91e0dccc 147}
f3fa1c10 148
864b1c33 149if ($right_frame == 'right_main.php') {
150 $urlMailbox = urlencode($mailbox);
ef8d36ad 151 $right_frame_url = "right_main.php?mailbox=$urlMailbox"
152 . (!empty($sort)?"&amp;sort=$sort":'')
153 . (!empty($startMessage)?"&amp;startMessage=$startMessage":'');
65c3ec94 154} elseif ($right_frame == 'options.php') {
864b1c33 155 $right_frame_url = 'options.php';
65c3ec94 156} elseif ($right_frame == 'folders.php') {
864b1c33 157 $right_frame_url = 'folders.php';
c67e4479 158} elseif ($right_frame == 'compose.php') {
159 $right_frame_url = 'compose.php?' . $mailto;
78194072 160} else if ($right_frame == '') {
871ab9eb 161 $right_frame_url = 'right_main.php';
78194072 162} else {
ef8d36ad 163 $right_frame_url = htmlspecialchars($right_frame);
864b1c33 164}
9a732bb6 165
da9a8410 166$left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'.
167 _("Folder List") ."\" />\n";
168$right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'.
169 _("Message List") ."\" />\n";
170
864b1c33 171if ($location_of_bar == 'right') {
0e3b9a5a 172 $output .= $right_frame . $left_frame;
864b1c33 173}
174else {
0e3b9a5a 175 $output .= $left_frame . $right_frame;
864b1c33 176}
0e3b9a5a 177$ret = concat_hook_function('webmail_bottom', $output);
178if($ret != '') {
179 $output = $ret;
180}
181echo $output;
a2b193bc 182
ad6787f0 183?>
d68323ff 184</frameset>
4b4abf93 185</html>