Some fixup:
[squirrelmail.git] / src / webmail.php
1 <?php
2
3 /**
4 ** webmail.php -- Displays the main frameset
5 **
6 ** Copyright (c) 1999-2000 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 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
25 $base_uri = $regs[1];
26
27 session_start();
28 is_logged_in();
29 checkForPrefs($data_dir, $username);
30
31 // We'll need this to later have a noframes version
32 //
33 // Check if the user has a language preference, but no cookie.
34 // Send him a cookie with his language preference, if there is
35 // such discrepancy.
36 $my_language=getPref($data_dir, $username, "language");
37 if ($my_language != $squirrelmail_language)
38 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
39
40 set_up_language(getPref($data_dir, $username, 'language'));
41
42 echo "<html><head>\n";
43 echo '<TITLE>';
44 echo $org_title;
45 echo '</TITLE>';
46
47 $left_size = getPref($data_dir, $username, "left_size");
48 $location_of_bar = getPref($data_dir, $username, "location_of_bar");
49 if ($location_of_bar == '')
50 $location_of_bar = 'left';
51 if ($left_size == "") {
52 if (isset($default_left_size))
53 $left_size = $default_left_size;
54 else
55 $left_size = 200;
56 }
57
58 if ($location_of_bar == 'right')
59 {
60 echo "<FRAMESET COLS=\"*, $left_size\" BORDER=0>";
61 } else {
62 echo "<FRAMESET COLS=\"$left_size, *\" BORDER=0>";
63 }
64
65 /**
66 There are three ways to call webmail.php
67 1. webmail.php
68 - This just loads the default entry screen.
69 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
70 - This loads the frames starting at the given values.
71 3. webmail.php?right_frame=folders.php
72 - Loads the frames with the Folder options in the right frame.
73
74 This was done to create a pure HTML way of refreshing the folder list since
75 we would like to use as little Javascript as possible.
76 **/
77 if (!isset($right_frame)) $right_frame = "";
78
79 if ($right_frame == 'right_main.php') {
80 $urlMailbox = urlencode($mailbox);
81 $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
82 } else if ($right_frame == 'options.php') {
83 $right_frame_url = 'options.php';
84 } else if ($right_frame == 'folders.php') {
85 $right_frame_url = 'folders.php';
86 } else if ($right_frame == 'compose.php') {
87 $right_frame_url = "compose.php?send_to=$rcptaddress";
88 } else {
89 $right_frame_url = "right_main.php";
90 }
91
92 if ($location_of_bar == 'right')
93 {
94 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
95 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
96 }
97 else
98 {
99 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
100 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
101 }
102
103 ?>
104 </FRAMESET>
105 </HEAD></HTML>