SMPATH fix
[squirrelmail.git] / src / webmail.php
... / ...
CommitLineData
1<?php
2
3/**
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 */
15
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');
27
28if (!function_exists('sqm_baseuri')){
29 require_once(SM_PATH . 'functions/display_messages.php');
30}
31$base_uri = sqm_baseuri();
32
33session_start();
34is_logged_in();
35
36do_hook('webmail_top');
37
38/**
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 */
45$my_language = getPref($data_dir, $username, 'language');
46if ($my_language != $squirrelmail_language) {
47 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
48}
49
50set_up_language(getPref($data_dir, $username, 'language'));
51
52echo "<html><head>\n" .
53 "<title>$org_title</title>";
54
55$left_size = getPref($data_dir, $username, 'left_size');
56$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
57
58if (isset($languages[$squirrelmail_language]['DIR']) &&
59 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
60 $temp_location_of_bar = 'right';
61} else {
62 $temp_location_of_bar = 'left';
63}
64
65if ($location_of_bar == '') {
66 $location_of_bar = $temp_location_of_bar;
67}
68$temp_location_of_bar = '';
69
70if ($left_size == "") {
71 if (isset($default_left_size)) {
72 $left_size = $default_left_size;
73 }
74 else {
75 $left_size = 200;
76 }
77}
78
79if ($location_of_bar == 'right') {
80 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
81}
82else {
83 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
84}
85
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)) {
99 $right_frame = '';
100}
101if ($right_frame == 'right_main.php') {
102 $urlMailbox = urlencode($mailbox);
103 $right_frame_url =
104 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
105} elseif ($right_frame == 'options.php') {
106 $right_frame_url = 'options.php';
107} elseif ($right_frame == 'folders.php') {
108 $right_frame_url = 'folders.php';
109} else if ($right_frame == '') {
110 $right_frame_url = 'right_main.php';
111} else {
112 $right_frame_url = urldecode($right_frame);
113}
114
115if ($location_of_bar == 'right') {
116 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
117 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
118}
119else {
120 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
121 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
122}
123do_hook('webmail_bottom');
124?>
125</FRAMESET>
126</HEAD></HTML>