* To reduce on errors, I moved the includes for config.php and strings.php
[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 include ('../functions/strings.php');
17 include ('../config/config.php');
18 include ('../functions/prefs.php');
19 include ('../functions/imap.php');
20 include ('../functions/plugin.php');
21 include ('../functions/auth.php');
22
23 session_start();
24 is_logged_in();
25 checkForPrefs($data_dir, $username);
26
27 // We'll need this to later have a noframes version
28 //
29 // Check if the user has a language preference, but no cookie.
30 // Send him a cookie with his language preference, if there is
31 // such discrepancy.
32 $my_language=getPref($data_dir, $username, "language");
33 if ($my_language != $squirrelmail_language)
34 setcookie('squirrelmail_language', $my_language, time()+2592000);
35
36 set_up_language(getPref($data_dir, $username, 'language'));
37
38 echo "<html><head>\n";
39 echo '<TITLE>';
40 echo $org_title;
41 echo '</TITLE>';
42
43 $left_size = getPref($data_dir, $username, "left_size");
44 $location_of_bar = getPref($data_dir, $username, "location_of_bar");
45 if ($location_of_bar == '')
46 $location_of_bar = 'left';
47 if ($left_size == "") {
48 if (isset($default_left_size))
49 $left_size = $default_left_size;
50 else
51 $left_size = 200;
52 }
53
54 if ($location_of_bar == 'right')
55 {
56 echo "<FRAMESET COLS=\"*, $left_size\" BORDER=0>";
57 } else {
58 echo "<FRAMESET COLS=\"$left_size, *\" BORDER=0>";
59 }
60
61 /**
62 There are three ways to call webmail.php
63 1. webmail.php
64 - This just loads the default entry screen.
65 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
66 - This loads the frames starting at the given values.
67 3. webmail.php?right_frame=folders.php
68 - Loads the frames with the Folder options in the right frame.
69
70 This was done to create a pure HTML way of refreshing the folder list since
71 we would like to use as little Javascript as possible.
72 **/
73 if (!isset($right_frame)) $right_frame = "";
74
75 if ($right_frame == 'right_main.php') {
76 $urlMailbox = urlencode($mailbox);
77 $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
78 } else if ($right_frame == 'options.php') {
79 $right_frame_url = 'options.php';
80 } else if ($right_frame == 'folders.php') {
81 $right_frame_url = 'folders.php';
82 } else {
83 if (!isset($just_logged_in)) $just_logged_in = 0;
84 $right_frame_url = "right_main.php?just_logged_in=$just_logged_in";
85 }
86
87 if ($location_of_bar == 'right')
88 {
89 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
90 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
91 }
92 else
93 {
94 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
95 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
96 }
97
98 ?>
99 </FRAMESET>
100 </HEAD></HTML>