webmail top hook
[squirrelmail.git] / src / webmail.php
1 <?php
2
3 /**
4 * webmail.php -- Displays the main frameset
5 *
6 * Copyright (c) 1999-2002 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 */
15
16 require_once('../functions/strings.php');
17 require_once('../config/config.php');
18 require_once('../functions/prefs.php');
19 require_once('../functions/imap.php');
20 require_once('../functions/plugin.php');
21 require_once('../functions/i18n.php');
22 require_once('../functions/auth.php');
23
24 if (!function_exists('sqm_baseuri')){
25 require_once('../functions/display_messages.php');
26 }
27 $base_uri = sqm_baseuri();
28
29 session_start();
30 is_logged_in();
31
32 do_hook('webmail_top');
33
34 /**
35 * We'll need this to later have a noframes version
36 *
37 * Check if the user has a language preference, but no cookie.
38 * Send him a cookie with his language preference, if there is
39 * such discrepancy.
40 */
41 $my_language = getPref($data_dir, $username, 'language');
42 if ($my_language != $squirrelmail_language) {
43 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
44 }
45
46 set_up_language(getPref($data_dir, $username, 'language'));
47
48 echo "<html><head>\n" .
49 "<title>$org_title</title>";
50
51 $left_size = getPref($data_dir, $username, 'left_size');
52 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
53
54 if (isset($languages[$squirrelmail_language]['DIR']) &&
55 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
56 $temp_location_of_bar = 'right';
57 } else {
58 $temp_location_of_bar = 'left';
59 }
60
61 if ($location_of_bar == '') {
62 $location_of_bar = $temp_location_of_bar;
63 }
64 $temp_location_of_bar = '';
65
66 if ($left_size == "") {
67 if (isset($default_left_size)) {
68 $left_size = $default_left_size;
69 }
70 else {
71 $left_size = 200;
72 }
73 }
74
75 if ($location_of_bar == 'right') {
76 echo "<frameset cols=\"*, $left_size\" border=\"0\" id=\"fs1\">";
77 }
78 else {
79 echo "<frameset cols=\"$left_size, *\" border=\"0\" id=\"fs1\">";
80 }
81
82 /*
83 * There are three ways to call webmail.php
84 * 1. webmail.php
85 * - This just loads the default entry screen.
86 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
87 * - This loads the frames starting at the given values.
88 * 3. webmail.php?right_frame=folders.php
89 * - Loads the frames with the Folder options in the right frame.
90 *
91 * This was done to create a pure HTML way of refreshing the folder list since
92 * we would like to use as little Javascript as possible.
93 */
94 if (!isset($right_frame)) {
95 $right_frame = '';
96 }
97 if ($right_frame == 'right_main.php') {
98 $urlMailbox = urlencode($mailbox);
99 $right_frame_url =
100 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
101 } elseif ($right_frame == 'options.php') {
102 $right_frame_url = 'options.php';
103 } elseif ($right_frame == 'folders.php') {
104 $right_frame_url = 'folders.php';
105 } else if ($right_frame == '') {
106 $right_frame_url = 'right_main.php';
107 } else {
108 $right_frame_url = urldecode($right_frame);
109 }
110
111 if ($location_of_bar == 'right') {
112 echo "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">" .
113 '<FRAME SRC="left_main.php" NORESIZE NAME="left">';
114 }
115 else {
116 echo '<FRAME SRC="left_main.php" NORESIZE NAME="left">'.
117 "<FRAME SRC=\"$right_frame_url\" NORESIZE NAME=\"right\">";
118 }
119 do_hook('webmail_bottom');
120 ?>
121 </FRAMESET>
122 </HEAD></HTML>