Made call for help bring up left_help.php for left frame source.
[squirrelmail.git] / src / webmail.php
1 <?php
2 /**
3 ** webmail.php
4 **
5 ** This simply creates the frames.
6 **
7 **/
8
9 session_start();
10
11 if(!isset($username)) {
12 echo _("You need a valid user and password to access this page!");
13 exit;
14 }
15
16 setcookie("username", $username, 0, "/");
17 setcookie("key", $key, 0, "/");
18 setcookie("logged_in", 1, 0, "/");
19
20 // Refresh the language cookie.
21 if (isset($squirrelmail_language)) {
22 setcookie("squirrelmail_language", $squirrelmail_language, time()+2592000);
23 }
24 ?>
25 <HTML><HEAD>
26 <?php
27 include ("../config/config.php");
28 include ("../functions/prefs.php");
29 include ("../functions/imap.php");
30
31 // verify that username and password are correct
32 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
33
34 include ("../src/load_prefs.php");
35
36 echo "<TITLE>";
37 echo "$org_title";
38 echo "</TITLE>";
39 $ishelp = substr(getenv(REQUEST_URI),-8); // If calling help, set left frame to 300
40 if ($ishelp == "help.php") {
41 echo "<FRAMESET COLS=\"300, *\" NORESIZE BORDER=0>";
42 } else {
43 echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
44 }
45
46 /**
47 There are four ways to call webmail.php
48 1. webmail.php
49 - This just loads the default entry screen.
50 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
51 - This loads the frames starting at the given values.
52 3. webmail.php?right_frame=folders.php
53 - Loads the frames with the Folder options in the right frame.
54 4. webmail.php?right_frame=help.php
55 - Lets the left frame set up different menu for help and calls the right frame.
56
57 This was done to create a pure HTML way of refreshing the folder list since
58 we would like to use as little Javascript as possible.
59 **/
60 if ($right_frame == "right_main.php") {
61 $urlMailbox = urlencode($mailbox);
62 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
63 echo "<FRAME SRC=\"right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\" NAME=\"right\">";
64 } else if ($right_frame == "folders.php") {
65 $urlMailbox = urlencode($mailbox);
66 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
67 echo "<FRAME SRC=\"folders.php\" NAME=\"right\">";
68 } else if ($right_frame == "help.php") {
69 echo "<FRAME SRC=\"left_help.php\" NAME=\"left\">";
70 echo "<FRAME SRC=\"help.php\" NAME=\"right\">";
71 } else {
72 echo "<FRAME SRC=\"left_main.php\" NAME=\"left\">";
73 echo "<FRAME SRC=\"right_main.php\" NAME=\"right\">";
74 }
75
76 ?>
77 </FRAMESET>
78 </HEAD></HTML>