4) XSS in help.php:
[squirrelmail.git] / src / webmail.php
1 <?php
2
3 /**
4 * webmail.php -- Displays the main frameset
5 *
6 * Copyright (c) 1999-2002 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 /* Path for SquirrelMail required files. */
17 define('SM_PATH','../');
18
19 /* SquirrelMail required files. */
20 require_once(SM_PATH . 'functions/strings.php');
21 require_once(SM_PATH . 'config/config.php');
22 require_once(SM_PATH . 'functions/prefs.php');
23 require_once(SM_PATH . 'functions/imap.php');
24 require_once(SM_PATH . 'functions/plugin.php');
25 require_once(SM_PATH . 'functions/i18n.php');
26 require_once(SM_PATH . 'functions/auth.php');
27
28 if (!function_exists('sqm_baseuri')){
29 require_once(SM_PATH . 'functions/display_messages.php');
30 }
31 $base_uri = sqm_baseuri();
32
33 session_start();
34 is_logged_in();
35
36 do_hook('webmail_top');
37
38 /**
39 * We'll need this to later have a noframes version
40 *
41 * Check if the user has a language preference, but no cookie.
42 * Send him a cookie with his language preference, if there is
43 * such discrepancy.
44 */
45 $my_language = getPref($data_dir, $username, 'language');
46 if ($my_language != $squirrelmail_language) {
47 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
48 }
49
50 set_up_language(getPref($data_dir, $username, 'language'));
51
52 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">'.
53 "<html><head>\n" .
54 "<title>$org_title</title>";
55
56 $left_size = getPref($data_dir, $username, 'left_size');
57 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
58
59 if (isset($languages[$squirrelmail_language]['DIR']) &&
60 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
61 $temp_location_of_bar = 'right';
62 } else {
63 $temp_location_of_bar = 'left';
64 }
65
66 if ($location_of_bar == '') {
67 $location_of_bar = $temp_location_of_bar;
68 }
69 $temp_location_of_bar = '';
70
71 if ($left_size == "") {
72 if (isset($default_left_size)) {
73 $left_size = $default_left_size;
74 }
75 else {
76 $left_size = 200;
77 }
78 }
79
80 if ($location_of_bar == 'right') {
81 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
82 }
83 else {
84 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
85 }
86
87 /*
88 * There are three ways to call webmail.php
89 * 1. webmail.php
90 * - This just loads the default entry screen.
91 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
92 * - This loads the frames starting at the given values.
93 * 3. webmail.php?right_frame=folders.php
94 * - Loads the frames with the Folder options in the right frame.
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 */
99 if (!isset($right_frame)) {
100 $right_frame = '';
101 }
102 if ($right_frame == 'right_main.php') {
103 $urlMailbox = urlencode($mailbox);
104 $right_frame_url =
105 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
106 } elseif ($right_frame == 'options.php') {
107 $right_frame_url = 'options.php';
108 } elseif ($right_frame == 'folders.php') {
109 $right_frame_url = 'folders.php';
110 } else if ($right_frame == '') {
111 $right_frame_url = 'right_main.php';
112 } else {
113 $right_frame_url = urldecode($right_frame);
114 }
115
116 if ($location_of_bar == 'right') {
117 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
118 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
119 }
120 else {
121 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
122 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
123 }
124 do_hook('webmail_bottom');
125 ?>
126 </FRAMESET>
127 </HEAD></HTML>