Spanish Update
[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
ac50138c 52echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">'.
53 "<html><head>\n" .
fab3baa6 54 "<title>$org_title</title>";
65c3ec94 55
871ab9eb 56$left_size = getPref($data_dir, $username, 'left_size');
57$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 58
0c660770 59if (isset($languages[$squirrelmail_language]['DIR']) &&
60 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 61 $temp_location_of_bar = 'right';
62} else {
63 $temp_location_of_bar = 'left';
64}
65
864b1c33 66if ($location_of_bar == '') {
fab3baa6 67 $location_of_bar = $temp_location_of_bar;
864b1c33 68}
fab3baa6 69$temp_location_of_bar = '';
70
864b1c33 71if ($left_size == "") {
72 if (isset($default_left_size)) {
f740c049 73 $left_size = $default_left_size;
864b1c33 74 }
75 else {
76 $left_size = 200;
77 }
65c3ec94 78}
79
864b1c33 80if ($location_of_bar == 'right') {
fab3baa6 81 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
864b1c33 82}
83else {
fab3baa6 84 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
864b1c33 85}
ad6787f0 86
864b1c33 87/*
88 * There are three ways to call webmail.php
89 * 1. webmail.php
90 * - This just loads the default entry screen.
91 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
92 * - This loads the frames starting at the given values.
93 * 3. webmail.php?right_frame=folders.php
94 * - Loads the frames with the Folder options in the right frame.
95 *
96 * This was done to create a pure HTML way of refreshing the folder list since
97 * we would like to use as little Javascript as possible.
98 */
99if (!isset($right_frame)) {
793cc001 100 $right_frame = '';
78194072 101}
864b1c33 102if ($right_frame == 'right_main.php') {
103 $urlMailbox = urlencode($mailbox);
104 $right_frame_url =
3d570ba0 105 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
65c3ec94 106} elseif ($right_frame == 'options.php') {
864b1c33 107 $right_frame_url = 'options.php';
65c3ec94 108} elseif ($right_frame == 'folders.php') {
864b1c33 109 $right_frame_url = 'folders.php';
78194072 110} else if ($right_frame == '') {
871ab9eb 111 $right_frame_url = 'right_main.php';
78194072 112} else {
113 $right_frame_url = urldecode($right_frame);
864b1c33 114}
9a732bb6 115
864b1c33 116if ($location_of_bar == 'right') {
793cc001 117 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
118 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
864b1c33 119}
120else {
793cc001 121 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
122 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
864b1c33 123}
753ce838 124do_hook('webmail_bottom');
ad6787f0 125?>
21c3249f 126</FRAMESET>
a507a781 127</HEAD></HTML>