r2l by yoav
[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
52if (strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
53 $temp_location_of_bar = 'right';
54} else {
55 $temp_location_of_bar = 'left';
56}
57
864b1c33 58if ($location_of_bar == '') {
fab3baa6 59 $location_of_bar = $temp_location_of_bar;
864b1c33 60}
fab3baa6 61$temp_location_of_bar = '';
62
864b1c33 63if ($left_size == "") {
64 if (isset($default_left_size)) {
f740c049 65 $left_size = $default_left_size;
864b1c33 66 }
67 else {
68 $left_size = 200;
69 }
65c3ec94 70}
71
864b1c33 72if ($location_of_bar == 'right') {
fab3baa6 73 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
864b1c33 74}
75else {
fab3baa6 76 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
864b1c33 77}
ad6787f0 78
864b1c33 79/*
80 * There are three ways to call webmail.php
81 * 1. webmail.php
82 * - This just loads the default entry screen.
83 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
84 * - This loads the frames starting at the given values.
85 * 3. webmail.php?right_frame=folders.php
86 * - Loads the frames with the Folder options in the right frame.
87 *
88 * This was done to create a pure HTML way of refreshing the folder list since
89 * we would like to use as little Javascript as possible.
90 */
91if (!isset($right_frame)) {
793cc001 92 $right_frame = '';
864b1c33 93}
a7ea7540 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";
65c3ec94 105} else {
871ab9eb 106 $right_frame_url = 'right_main.php';
864b1c33 107}
9a732bb6 108
864b1c33 109if ($location_of_bar == 'right') {
793cc001 110 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
111 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
864b1c33 112}
113else {
793cc001 114 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
115 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
864b1c33 116}
753ce838 117do_hook('webmail_bottom');
ad6787f0 118?>
21c3249f 119</FRAMESET>
a507a781 120</HEAD></HTML>