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