this should read "download as a file"
[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 *
47ccfad4 9 * @copyright &copy; 1999-2006 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
c67e4479 34if(!sqgetGlobalVar('mailto', $mailto)) {
35 $mailto = '';
36}
a32985a5 37
a4467cd7 38// Determine the size of the left frame
39$left_size = getPref($data_dir, $username, 'left_size');
40if ($left_size == "") {
41 if (isset($default_left_size)) {
42 $left_size = $default_left_size;
43 }
44 else {
45 $left_size = 200;
46 }
47}
48
49// Determine where the navigation frame should be
50$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
51if (isset($languages[$squirrelmail_language]['DIR']) &&
52 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
53 $temp_location_of_bar = 'right';
54} else {
55 $temp_location_of_bar = 'left';
56}
57if ($location_of_bar == '') {
58 $location_of_bar = $temp_location_of_bar;
59}
60
61// Determine the main frame URL
62/*
63 * There are three ways to call webmail.php
64 * 1. webmail.php
65 * - This just loads the default entry screen.
66 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
67 * - This loads the frames starting at the given values.
68 * 3. webmail.php?right_frame=folders.php
69 * - Loads the frames with the Folder options in the right frame.
70 *
71 * This was done to create a pure HTML way of refreshing the folder list since
72 * we would like to use as little Javascript as possible.
73 *
74 * The test for // should catch any attempt to include off-site webpages into
75 * our frameset.
76 */
77if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) {
78 $right_frame = '';
79}
80if ( strpos($right_frame,'?') ) {
81 $right_frame_file = substr($right_frame,0,strpos($right_frame,'?'));
82} else {
83 $right_frame_file = $right_frame;
84}
85switch($right_frame) {
86 case 'right_main.php':
87 $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
88 . (!empty($sort)?"&amp;sort=$sort":'')
89 . (!empty($startMessage)?"&amp;startMessage=$startMessage":'');
90 break;
91 case 'options.php':
92 $right_frame_url = 'options.php';
93 break;
94 case 'folders.php':
95 $right_frame_url = 'folders.php';
96 break;
97 case 'compose.php':
98 $right_frame_url = 'compose.php?' . $mailto;
99 break;
100 case '':
101 $right_frame_url = 'right_main.php';
102 break;
103 default:
104 $right_frame_url = urlencode($right_frame);
105 break;
106}
107
108displayHtmlHeader($org_title, '', false, true);
109$oErrorHandler->setDelayedErrors(true);
110
148ee1ef 111do_hook('webmail_top');
112
a4467cd7 113$oTemplate->assign('nav_size', $left_size);
114$oTemplate->assign('nav_on_left', $location_of_bar=='left');
115$oTemplate->assign('right_frame_url', $right_frame_url);
a6f35c16 116
117$oTemplate->display('webmail.tpl');
202bcbcc 118
a4467cd7 119$oTemplate->display('footer.tpl');