59177427 |
1 | <?php |
c6d6fe73 |
2 | |
21c3249f |
3 | /** |
5bbe20e4 |
4 | ** webmail.php -- Displays the main frameset |
21c3249f |
5 | ** |
c6d6fe73 |
6 | ** Copyright (c) 1999-2000 The SquirrelMail development team |
5bbe20e4 |
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. |
21c3249f |
12 | ** |
13 | **/ |
14 | |
5bbe20e4 |
15 | // Before starting the session, the base URI must be known. |
16 | // Assuming that this file is in the src/ subdirectory (or |
17 | // something). |
18 | ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs); |
19 | $base_uri = $regs[1]; |
20 | |
21 | session_set_cookie_params (0, $base_uri); |
2a32fc83 |
22 | session_start(); |
23 | |
5bbe20e4 |
24 | session_register ("base_uri"); |
25 | |
21c3249f |
26 | if(!isset($username)) { |
b581fa60 |
27 | echo _("You need a valid user and password to access this page!"); |
21c3249f |
28 | exit; |
29 | } |
30 | |
288491a4 |
31 | // Refresh the language cookie. |
2a32fc83 |
32 | if (isset($squirrelmail_language)) { |
9f2215a1 |
33 | setcookie("squirrelmail_language", $squirrelmail_language, time()+2592000); |
2a32fc83 |
34 | } |
1b187352 |
35 | |
b731cd83 |
36 | |
7ce342dc |
37 | include ("../config/config.php"); |
65b14f90 |
38 | include ("../functions/prefs.php"); |
19acd99f |
39 | include ("../functions/imap.php"); |
27e81758 |
40 | if (!isset($plugin_php)) |
41 | include ("../functions/plugin.php"); |
3c13b9fb |
42 | if (!isset($auth_php)) |
43 | include ("../functions/auth.php"); |
52eefafc |
44 | if (!isset($strings_php)) |
45 | include ("../functions/strings.php"); |
27e81758 |
46 | |
c6d6fe73 |
47 | if (!session_is_registered("user_is_logged_in") || $logged_in != 1) { |
27e81758 |
48 | do_hook ("login_before"); |
52eefafc |
49 | |
50 | $onetimepad = OneTimePadCreate(strlen($secretkey)); |
51 | $key = OneTimePadEncrypt($secretkey, $onetimepad); |
52 | session_register("onetimepad"); |
27e81758 |
53 | // verify that username and password are correct |
54 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
1195c340 |
55 | sqimap_logout($imapConnection); |
52eefafc |
56 | |
57 | setcookie("username", $username, 0, $base_uri); |
58 | setcookie("key", $key, 0, $base_uri); |
59 | setcookie("logged_in", 1, 0, $base_uri); |
60 | |
27e81758 |
61 | do_hook ("login_verified"); |
62 | } |
63 | |
3c13b9fb |
64 | session_register ("user_is_logged_in"); |
65 | $user_is_logged_in = true; |
2848c630 |
66 | |
67 | include ("../src/load_prefs.php"); |
1b187352 |
68 | |
3c13b9fb |
69 | echo "<html><head>\n"; |
8105d00f |
70 | echo "<TITLE>"; |
7ce342dc |
71 | echo "$org_title"; |
8105d00f |
72 | echo "</TITLE>"; |
07103a66 |
73 | $ishelp = substr(getenv(REQUEST_URI),-8); // If calling help, set left frame to 300 |
9a732bb6 |
74 | |
75 | if (ishelp == 'help.php') |
76 | $bar_size = 300; |
77 | else |
78 | $bar_size = $left_size; |
79 | |
80 | if ($location_of_bar == 'right') |
81 | { |
82 | echo "<FRAMESET COLS=\"*, $left_size\" NORESIZE=yes BORDER=0>"; |
07103a66 |
83 | } else { |
84 | echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>"; |
85 | } |
ad6787f0 |
86 | |
87 | /** |
5a7af78b |
88 | There are three ways to call webmail.php |
ad6787f0 |
89 | 1. webmail.php |
a2222aa3 |
90 | - This just loads the default entry screen. |
907165ca |
91 | 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
ad6787f0 |
92 | - This loads the frames starting at the given values. |
907165ca |
93 | 3. webmail.php?right_frame=folders.php |
94 | - Loads the frames with the Folder options in the right frame. |
ad6787f0 |
95 | |
96 | This was done to create a pure HTML way of refreshing the folder list since |
97 | we would like to use as little Javascript as possible. |
98 | **/ |
907165ca |
99 | if ($right_frame == "right_main.php") { |
ad6787f0 |
100 | $urlMailbox = urlencode($mailbox); |
9a732bb6 |
101 | $right_frame_url = "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage"; |
c36ed9cf |
102 | } else if ($right_frame == "options.php") { |
9a732bb6 |
103 | $right_frame_url = "options.php"; |
907165ca |
104 | } else if ($right_frame == "folders.php") { |
9a732bb6 |
105 | $right_frame_url = "folders.php"; |
ad6787f0 |
106 | } else { |
a37f3771 |
107 | if (!isset($just_logged_in)) $just_logged_in = 0; |
9a732bb6 |
108 | $right_frame_url = "right_main.php?just_logged_in=$just_logged_in"; |
109 | } |
110 | |
111 | if ($location_of_bar == 'right') |
112 | { |
113 | echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">"; |
114 | echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">"; |
115 | } |
116 | else |
117 | { |
118 | echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">"; |
119 | echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">"; |
ad6787f0 |
120 | } |
a2222aa3 |
121 | |
ad6787f0 |
122 | ?> |
21c3249f |
123 | </FRAMESET> |
124 | </HEAD></HTML> |