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