A few more unnecessary urldecodes when not needed. Now we can view headers
[squirrelmail.git] / src / webmail.php
1 <?php
2
3 /**
4 * webmail.php -- Displays the main frameset
5 *
6 * Copyright (c) 1999-2003 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 require_once(SM_PATH . 'functions/global.php');
28
29 if (!function_exists('sqm_baseuri')){
30 require_once(SM_PATH . 'functions/display_messages.php');
31 }
32 $base_uri = sqm_baseuri();
33
34 session_start();
35
36 if (isset($_SESSION['username'])) {
37 $username = $_SESSION['username'];
38 }
39 if (isset($_SESSION['delimiter'])) {
40 $delimiter = $_SESSION['delimiter'];
41 }
42 if (isset($_SESSION['onetimepad'])) {
43 $onetimepad = $_SESSION['onetimepad'];
44 }
45 if (isset($_GET['right_frame'])) {
46 $right_frame = $_GET['right_frame'];
47 }
48 if ( isset($_SESSION['session_expired_post']) ) {
49 sqsession_unregister('session_expired_post');
50 }
51
52 is_logged_in();
53
54 do_hook('webmail_top');
55
56 /**
57 * We'll need this to later have a noframes version
58 *
59 * Check if the user has a language preference, but no cookie.
60 * Send him a cookie with his language preference, if there is
61 * such discrepancy.
62 */
63 $my_language = getPref($data_dir, $username, 'language');
64 if ($my_language != $squirrelmail_language) {
65 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
66 }
67
68 set_up_language(getPref($data_dir, $username, 'language'));
69
70 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
71 "<html><head>\n" .
72 "<title>$org_title</title>\n".
73 "</head>";
74
75 $left_size = getPref($data_dir, $username, 'left_size');
76 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
77
78 if (isset($languages[$squirrelmail_language]['DIR']) &&
79 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
80 $temp_location_of_bar = 'right';
81 } else {
82 $temp_location_of_bar = 'left';
83 }
84
85 if ($location_of_bar == '') {
86 $location_of_bar = $temp_location_of_bar;
87 }
88 $temp_location_of_bar = '';
89
90 if ($left_size == "") {
91 if (isset($default_left_size)) {
92 $left_size = $default_left_size;
93 }
94 else {
95 $left_size = 200;
96 }
97 }
98
99 if ($location_of_bar == 'right') {
100 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
101 }
102 else {
103 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
104 }
105
106 /*
107 * There are three ways to call webmail.php
108 * 1. webmail.php
109 * - This just loads the default entry screen.
110 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
111 * - This loads the frames starting at the given values.
112 * 3. webmail.php?right_frame=folders.php
113 * - Loads the frames with the Folder options in the right frame.
114 *
115 * This was done to create a pure HTML way of refreshing the folder list since
116 * we would like to use as little Javascript as possible.
117 */
118 if (!isset($right_frame)) {
119 $right_frame = '';
120 }
121 if ($right_frame == 'right_main.php') {
122 $urlMailbox = urlencode($mailbox);
123 $right_frame_url =
124 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
125 } elseif ($right_frame == 'options.php') {
126 $right_frame_url = 'options.php';
127 } elseif ($right_frame == 'folders.php') {
128 $right_frame_url = 'folders.php';
129 } else if ($right_frame == '') {
130 $right_frame_url = 'right_main.php';
131 } else {
132 $right_frame_url = $right_frame;
133 }
134
135 if ($location_of_bar == 'right') {
136 echo "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n" .
137 "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n";
138 }
139 else {
140 echo "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n".
141 "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n";
142 }
143 do_hook('webmail_bottom');
144 ?>
145 </frameset>
146 </html>