Fix message highlighting again
[squirrelmail.git] / src / webmail.php
1 <?php
2 /**
3 * webmail.php -- Displays the main frameset
4 *
5 * This file generates the main frameset. The files that are
6 * shown can be given as parameters. If the user is not logged in
7 * this file will verify username and password.
8 *
9 * @copyright &copy; 1999-2007 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @version $Id$
12 * @package squirrelmail
13 */
14
15 /** This is the webmail page */
16 define('PAGE_NAME', 'webmail');
17
18 /**
19 * Include the SquirrelMail initialization file.
20 */
21 require('../include/init.php');
22
23 if (sqgetGlobalVar('sort', $sort)) {
24 $sort = (int) $sort;
25 }
26
27 if (sqgetGlobalVar('startMessage', $startMessage)) {
28 $startMessage = (int) $startMessage;
29 }
30
31 if (!sqgetGlobalVar('mailbox', $mailbox)) {
32 $mailbox = 'INBOX';
33 }
34
35 sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
36
37 if(!sqgetGlobalVar('mailtodata', $mailtodata)) {
38 $mailtourl = 'mailtodata='.urlencode($mailtodata);
39 } else {
40 $mailtourl = '';
41 }
42
43 // Determine the size of the left frame
44 $left_size = getPref($data_dir, $username, 'left_size');
45 if ($left_size == "") {
46 if (isset($default_left_size)) {
47 $left_size = $default_left_size;
48 }
49 else {
50 $left_size = 200;
51 }
52 }
53
54 // Determine where the navigation frame should be
55 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
56 if (isset($languages[$squirrelmail_language]['DIR']) &&
57 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
58 $temp_location_of_bar = 'right';
59 } else {
60 $temp_location_of_bar = 'left';
61 }
62 if ($location_of_bar == '') {
63 $location_of_bar = $temp_location_of_bar;
64 }
65
66 // Determine the main frame URL
67 /*
68 * There are three ways to call webmail.php
69 * 1. webmail.php
70 * - This just loads the default entry screen.
71 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
72 * - This loads the frames starting at the given values.
73 * 3. webmail.php?right_frame=folders.php
74 * - Loads the frames with the Folder options in the right frame.
75 *
76 * This was done to create a pure HTML way of refreshing the folder list since
77 * we would like to use as little Javascript as possible.
78 *
79 * The test for // should catch any attempt to include off-site webpages into
80 * our frameset.
81 */
82 if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) {
83 $right_frame = '';
84 }
85 if ( strpos($right_frame,'?') ) {
86 $right_frame_file = substr($right_frame,0,strpos($right_frame,'?'));
87 } else {
88 $right_frame_file = $right_frame;
89 }
90 switch($right_frame) {
91 case 'right_main.php':
92 $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
93 . (!empty($sort)?"&amp;sort=$sort":'')
94 . (!empty($startMessage)?"&amp;startMessage=$startMessage":'');
95 break;
96 case 'options.php':
97 $right_frame_url = 'options.php';
98 break;
99 case 'folders.php':
100 $right_frame_url = 'folders.php';
101 break;
102 case 'compose.php':
103 $right_frame_url = 'compose.php?' . $mailtourl;
104 break;
105 case '':
106 $right_frame_url = 'right_main.php';
107 break;
108 default:
109 $right_frame_url = urlencode($right_frame);
110 break;
111 }
112
113 $oErrorHandler->setDelayedErrors(true);
114
115 $oTemplate->assign('nav_size', $left_size);
116 $oTemplate->assign('nav_on_left', $location_of_bar=='left');
117 $oTemplate->assign('right_frame_url', $right_frame_url);
118
119 do_hook('webmail_top', $null);
120
121 displayHtmlHeader($org_title, '', false, true);
122
123 $oTemplate->display('webmail.tpl');
124