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