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