3 * webmail.php -- Displays the main frameset
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.
9 * @copyright 1999-2010 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @package squirrelmail
15 /** This is the webmail page */
16 define('PAGE_NAME', 'webmail');
19 * Include the SquirrelMail initialization file.
21 require('../include/init.php');
23 if (sqgetGlobalVar('sort', $sort)) {
27 if (sqgetGlobalVar('startMessage', $startMessage)) {
28 $startMessage = (int) $startMessage;
31 if (!sqgetGlobalVar('mailbox', $mailbox)) {
35 sqgetGlobalVar('right_frame', $right_frame, SQ_GET
);
37 if (sqgetGlobalVar('mailtodata', $mailtodata)) {
38 $mailtourl = 'mailtodata='.urlencode($mailtodata);
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;
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';
60 $temp_location_of_bar = 'left';
62 if ($location_of_bar == '') {
63 $location_of_bar = $temp_location_of_bar;
66 // this value may be changed by a plugin, but initialize
67 // it first to avoid register_globals headaches
69 $right_frame_url = '';
70 do_hook('webmail_top', $null);
72 // Determine the main frame URL
74 * There are three ways to call webmail.php
76 * - This just loads the default entry screen.
77 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
78 * - This loads the frames starting at the given values.
79 * 3. webmail.php?right_frame=folders.php
80 * - Loads the frames with the Folder options in the right frame.
82 * This was done to create a pure HTML way of refreshing the folder list since
83 * we would like to use as little Javascript as possible.
85 * The test for // should catch any attempt to include off-site webpages into
88 * Note that plugins are allowed to completely and freely override the URI
89 * used for the "right" (content) frame, and they do so by modifying the
90 * global variable $right_frame_url.
93 if (empty($right_frame) ||
(strpos(urldecode($right_frame), '//') !== false)) {
96 if ( strpos($right_frame,'?') ) {
97 $right_frame_file = substr($right_frame,0,strpos($right_frame,'?'));
99 $right_frame_file = $right_frame;
101 if (empty($right_frame_url)) {
102 switch($right_frame) {
103 case 'right_main.php':
104 $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
105 . (!empty($sort)?
"&sort=$sort":'')
106 . (!empty($startMessage)?
"&startMessage=$startMessage":'');
109 $right_frame_url = 'options.php';
112 $right_frame_url = 'folders.php';
115 $right_frame_url = 'compose.php?' . $mailtourl;
118 $right_frame_url = 'right_main.php';
121 $right_frame_url = urlencode($right_frame);
126 $oErrorHandler->setDelayedErrors(true);
128 $oTemplate->assign('nav_size', $left_size);
129 $oTemplate->assign('nav_on_left', $location_of_bar=='left');
130 $oTemplate->assign('right_frame_url', $right_frame_url);
132 displayHtmlHeader($org_title, '', false, true);
134 $oTemplate->display('webmail.tpl');