r2l by Yoav
[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 if ($location_of_bar == '') {
52 $location_of_bar = 'left';
53 }
54 if ($left_size == "") {
55 if (isset($default_left_size)) {
56 $left_size = $default_left_size;
57 }
58 else {
59 $left_size = 200;
60 }
61 }
62
63 if ($location_of_bar == 'right') {
64 echo "<FRAMESET COLS=\"*, $left_size\" BORDER=0 ID=fs1>";
65 }
66 else {
67 echo "<FRAMESET COLS=\"$left_size, *\" BORDER=0 ID=fs1>";
68 }
69
70 /*
71 * There are three ways to call webmail.php
72 * 1. webmail.php
73 * - This just loads the default entry screen.
74 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
75 * - This loads the frames starting at the given values.
76 * 3. webmail.php?right_frame=folders.php
77 * - Loads the frames with the Folder options in the right frame.
78 *
79 * This was done to create a pure HTML way of refreshing the folder list since
80 * we would like to use as little Javascript as possible.
81 */
82 if (!isset($right_frame)) {
83 $right_frame = '';
84 }
85
86 if ($right_frame == 'right_main.php') {
87 $urlMailbox = urlencode($mailbox);
88 $right_frame_url =
89 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
90 } elseif ($right_frame == 'options.php') {
91 $right_frame_url = 'options.php';
92 } elseif ($right_frame == 'folders.php') {
93 $right_frame_url = 'folders.php';
94 } elseif ($right_frame == 'compose.php') {
95 $right_frame_url = "compose.php?send_to=$rcptaddress";
96 } else {
97 $right_frame_url = 'right_main.php';
98 }
99
100 if ($location_of_bar == 'right') {
101 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
102 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
103 }
104 else {
105 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
106 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
107 }
108 do_hook('webmail_bottom');
109 ?>
110 </FRAMESET>
111 </HEAD></HTML>