SMPATH fix
[squirrelmail.git] / src / webmail.php
CommitLineData
59177427 1<?php
c6d6fe73 2
864b1c33 3/**
15e6162e 4 * webmail.php -- Displays the main frameset
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail development team
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');
245a6892 27
f3bc099d 28if (!function_exists('sqm_baseuri')){
86725763 29 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 30}
31$base_uri = sqm_baseuri();
88fa922a 32
864b1c33 33session_start();
34is_logged_in();
1b187352 35
148ee1ef 36do_hook('webmail_top');
37
15e6162e 38/**
864b1c33 39 * We'll need this to later have a noframes version
40 *
41 * Check if the user has a language preference, but no cookie.
42 * Send him a cookie with his language preference, if there is
43 * such discrepancy.
44 */
871ab9eb 45$my_language = getPref($data_dir, $username, 'language');
864b1c33 46if ($my_language != $squirrelmail_language) {
47 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
48}
cf47d363 49
864b1c33 50set_up_language(getPref($data_dir, $username, 'language'));
441f2d33 51
65c3ec94 52echo "<html><head>\n" .
fab3baa6 53 "<title>$org_title</title>";
65c3ec94 54
871ab9eb 55$left_size = getPref($data_dir, $username, 'left_size');
56$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 57
0c660770 58if (isset($languages[$squirrelmail_language]['DIR']) &&
59 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 60 $temp_location_of_bar = 'right';
61} else {
62 $temp_location_of_bar = 'left';
63}
64
864b1c33 65if ($location_of_bar == '') {
fab3baa6 66 $location_of_bar = $temp_location_of_bar;
864b1c33 67}
fab3baa6 68$temp_location_of_bar = '';
69
864b1c33 70if ($left_size == "") {
71 if (isset($default_left_size)) {
f740c049 72 $left_size = $default_left_size;
864b1c33 73 }
74 else {
75 $left_size = 200;
76 }
65c3ec94 77}
78
864b1c33 79if ($location_of_bar == 'right') {
fab3baa6 80 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
864b1c33 81}
82else {
fab3baa6 83 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
864b1c33 84}
ad6787f0 85
864b1c33 86/*
87 * There are three ways to call webmail.php
88 * 1. webmail.php
89 * - This just loads the default entry screen.
90 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
91 * - This loads the frames starting at the given values.
92 * 3. webmail.php?right_frame=folders.php
93 * - Loads the frames with the Folder options in the right frame.
94 *
95 * This was done to create a pure HTML way of refreshing the folder list since
96 * we would like to use as little Javascript as possible.
97 */
98if (!isset($right_frame)) {
793cc001 99 $right_frame = '';
78194072 100}
864b1c33 101if ($right_frame == 'right_main.php') {
102 $urlMailbox = urlencode($mailbox);
103 $right_frame_url =
3d570ba0 104 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
65c3ec94 105} elseif ($right_frame == 'options.php') {
864b1c33 106 $right_frame_url = 'options.php';
65c3ec94 107} elseif ($right_frame == 'folders.php') {
864b1c33 108 $right_frame_url = 'folders.php';
78194072 109} else if ($right_frame == '') {
871ab9eb 110 $right_frame_url = 'right_main.php';
78194072 111} else {
112 $right_frame_url = urldecode($right_frame);
864b1c33 113}
9a732bb6 114
864b1c33 115if ($location_of_bar == 'right') {
793cc001 116 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
117 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
864b1c33 118}
119else {
793cc001 120 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
121 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
864b1c33 122}
753ce838 123do_hook('webmail_bottom');
ad6787f0 124?>
21c3249f 125</FRAMESET>
a507a781 126</HEAD></HTML>