2a4e0cdc373ca2ded174f66a7c704a386a9e4bcf
[squirrelmail.git] / src / webmail.php
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 require_once('../functions/strings.php');
17 require_once('../config/config.php');
18 require_once('../functions/prefs.php');
19 require_once('../functions/imap.php');
20 require_once('../functions/plugin.php');
21 require_once('../functions/i18n.php');
22 require_once('../functions/auth.php');
23
24 if (!function_exists('sqm_baseuri')){
25 require_once('../functions/display_messages.php');
26 }
27 $base_uri = sqm_baseuri();
28
29 session_start();
30 is_logged_in();
31
32 /**
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 */
39 $my_language = getPref($data_dir, $username, 'language');
40 if ($my_language != $squirrelmail_language) {
41 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
42 }
43
44 set_up_language(getPref($data_dir, $username, 'language'));
45
46 echo "<html><head>\n" .
47 "<title>$org_title</title>";
48
49 $left_size = getPref($data_dir, $username, 'left_size');
50 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
51
52 if (strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
53 $temp_location_of_bar = 'right';
54 } else {
55 $temp_location_of_bar = 'left';
56 }
57
58 if ($location_of_bar == '') {
59 $location_of_bar = $temp_location_of_bar;
60 }
61 $temp_location_of_bar = '';
62
63 if ($left_size == "") {
64 if (isset($default_left_size)) {
65 $left_size = $default_left_size;
66 }
67 else {
68 $left_size = 200;
69 }
70 }
71
72 if ($location_of_bar == 'right') {
73 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
74 }
75 else {
76 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
77 }
78
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 */
91 if (!isset($right_frame)) {
92 $right_frame = '';
93 }
94 if ($right_frame == 'right_main.php') {
95 $urlMailbox = urlencode($mailbox);
96 $right_frame_url =
97 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
98 } elseif ($right_frame == 'options.php') {
99 $right_frame_url = 'options.php';
100 } elseif ($right_frame == 'folders.php') {
101 $right_frame_url = 'folders.php';
102 } elseif ($right_frame == 'compose.php') {
103 $right_frame_url = "compose.php?send_to=$rcptaddress";
104 } else if ($right_frame == '') {
105 $right_frame_url = 'right_main.php';
106 } else {
107 $right_frame_url = urldecode($right_frame);
108 }
109
110 if ($location_of_bar == 'right') {
111 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
112 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
113 }
114 else {
115 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
116 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
117 }
118 do_hook('webmail_bottom');
119 ?>
120 </FRAMESET>
121 </HEAD></HTML>