66eb3af3a462623f7c599648d54b02db272fa7a4
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 // Refresh the language cookie.
32 if (isset($squirrelmail_language)) {
33 setcookie("squirrelmail_language", $squirrelmail_language, time()+
2592000);
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 if (!isset($strings_php))
44 include ("../functions/strings.php");
46 if ($force_username_lowercase)
47 $username = strtolower($username);
49 if (!session_is_registered("user_is_logged_in") ||
$logged_in != 1) {
50 do_hook ("login_before");
52 $onetimepad = OneTimePadCreate(strlen($secretkey));
53 $key = OneTimePadEncrypt($secretkey, $onetimepad);
54 session_register("onetimepad");
55 // verify that username and password are correct
56 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
57 sqimap_logout($imapConnection);
59 setcookie("username", $username, 0, $base_uri);
60 setcookie("key", $key, 0, $base_uri);
61 setcookie("logged_in", 1, 0, $base_uri);
63 do_hook ("login_verified");
66 session_register ("user_is_logged_in");
67 $user_is_logged_in = true;
69 include ("../src/load_prefs.php");
71 echo "<html><head>\n";
75 $ishelp = substr(getenv(REQUEST_URI
),-8); // If calling help, set left frame to 300
77 if (ishelp
== 'help.php')
80 $bar_size = $left_size;
82 if ($location_of_bar == 'right')
84 echo "<FRAMESET COLS=\"*, $left_size\" NORESIZE=yes BORDER=0>";
86 echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
90 There are three ways to call webmail.php
92 - This just loads the default entry screen.
93 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
94 - This loads the frames starting at the given values.
95 3. webmail.php?right_frame=folders.php
96 - Loads the frames with the Folder options in the right frame.
98 This was done to create a pure HTML way of refreshing the folder list since
99 we would like to use as little Javascript as possible.
101 if ($right_frame == "right_main.php") {
102 $urlMailbox = urlencode($mailbox);
103 $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
104 } else if ($right_frame == "options.php") {
105 $right_frame_url = "options.php";
106 } else if ($right_frame == "folders.php") {
107 $right_frame_url = "folders.php";
109 if (!isset($just_logged_in)) $just_logged_in = 0;
110 $right_frame_url = "right_main.php?just_logged_in=$just_logged_in";
113 if ($location_of_bar == 'right')
115 echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">";
116 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
120 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
121 echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">";