4 ** webmail.php -- Displays the main frameset
6 ** Copyright (c) 1999-2000 The SquirrelMail development team
7 ** Licensed under the GNU GPL. For full terms see the file COPYING.
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.
15 // Before starting the session, the base URI must be known.
16 // Assuming that this file is in the src/ subdirectory (or
18 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
21 session_set_cookie_params (0, $base_uri);
24 session_register ("base_uri");
26 if(!isset($username)) {
27 echo _("You need a valid user and password to access this page!");
31 setcookie("username", $username, 0, $base_uri);
32 setcookie("key", $key, 0, $base_uri);
33 setcookie("logged_in", 1, 0, $base_uri);
35 // Refresh the language cookie.
36 if (isset($squirrelmail_language)) {
37 setcookie("squirrelmail_language", $squirrelmail_language, time()+
2592000);
40 include ("../config/config.php");
41 include ("../functions/prefs.php");
42 include ("../functions/imap.php");
43 if (!isset($plugin_php))
44 include ("../functions/plugin.php");
45 if (!isset($auth_php))
46 include ("../functions/auth.php");
48 if (!session_is_registered("user_is_logged_in") ||
$logged_in != 1) {
49 do_hook ("login_before");
50 // verify that username and password are correct
51 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
52 do_hook ("login_verified");
55 session_register ("user_is_logged_in");
56 $user_is_logged_in = true;
58 include ("../src/load_prefs.php");
60 echo "<html><head>\n";
64 $ishelp = substr(getenv(REQUEST_URI
),-8); // If calling help, set left frame to 300
65 if ($ishelp == "help.php") {
66 echo "<FRAMESET COLS=\"300, *\" NORESIZE BORDER=0>";
68 echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
72 There are four ways to call webmail.php
74 - This just loads the default entry screen.
75 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
76 - This loads the frames starting at the given values.
77 3. webmail.php?right_frame=folders.php
78 - Loads the frames with the Folder options in the right frame.
79 4. webmail.php?right_frame=help.php
80 - Lets the left frame set up different menu for help and calls the right frame.
82 This was done to create a pure HTML way of refreshing the folder list since
83 we would like to use as little Javascript as possible.
85 if ($right_frame == "right_main.php") {
86 $urlMailbox = urlencode($mailbox);
87 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
88 echo "<FRAME SRC=\"right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\" NAME=\"right\">";
89 } else if ($right_frame == "folders.php") {
90 $urlMailbox = urlencode($mailbox);
91 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
92 echo "<FRAME SRC=\"folders.php\" NAME=\"right\">";
93 } else if ($right_frame == "help.php") {
94 echo "<FRAME SRC=\"left_help.php\" NAME=\"left\">";
95 echo "<FRAME SRC=\"help.php\" NAME=\"right\">";
97 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
98 echo "<FRAME SRC=\"right_main.php\" NAME=\"right\">";