8ca5aa8e787608eb9c9ad0ca330dbc0cb729b7ea
[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 session_start();
17
18 if (!isset($i18n_php))
19 include ('../functions/i18n.php');
20
21 if(!isset($username)) {
22 set_up_language($squirrelmail_language);
23 include ('../themes/default_theme.php');
24 include ('../functions/display_messages.php');
25 printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
26 $color[8], $color[4], $color[7], $color[7], $color[7]);
27 plain_error_message(_("You need a valid user and password to access this page!")
28 . "<br><a href=\"../src/login.php\">"
29 . _("Click here to log back in.") . "</a>.", $color);
30 echo '</body></html>';
31 exit;
32 }
33
34 if (!isset($strings_php))
35 include ('../functions/strings.php');
36 include ('../config/config.php');
37 include ('../functions/prefs.php');
38 include ('../functions/imap.php');
39 if (!isset($plugin_php))
40 include ('../functions/plugin.php');
41 if (!isset($auth_php))
42 include ('../functions/auth.php');
43
44 include ('../src/load_prefs.php');
45
46 // We'll need this to later have a noframes version
47 set_up_language(getPref($data_dir, $username, 'language'));
48
49 echo "<html><head>\n";
50 echo '<TITLE>';
51 echo $org_title;
52 echo '</TITLE>';
53
54 $bar_size = $left_size;
55
56 if ($location_of_bar == 'right')
57 {
58 echo "<FRAMESET COLS=\"*, $left_size\" NORESIZE=yes BORDER=0>";
59 } else {
60 echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
61 }
62
63 /**
64 There are three ways to call webmail.php
65 1. webmail.php
66 - This just loads the default entry screen.
67 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
68 - This loads the frames starting at the given values.
69 3. webmail.php?right_frame=folders.php
70 - Loads the frames with the Folder options in the right frame.
71
72 This was done to create a pure HTML way of refreshing the folder list since
73 we would like to use as little Javascript as possible.
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\" NAME=\"right\">";
90 echo '<FRAME SRC="left_main.php" NAME="left">';
91 }
92 else
93 {
94 echo '<FRAME SRC="left_main.php" NAME="left">';
95 echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">";
96 }
97
98 ?>
99 </FRAMESET>
100 </HEAD></HTML>