Adding full locale names. Enabled ukrainian and russian-ukrainian
[squirrelmail.git] / src / webmail.php
CommitLineData
59177427 1<?php
c6d6fe73 2
864b1c33 3/**
15e6162e 4 * webmail.php -- Displays the main frameset
5 *
82d304a0 6 * Copyright (c) 1999-2004 The SquirrelMail development team
15e6162e 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$
8f6f9ba5 14 * @package squirrelmail
15e6162e 15 */
21c3249f 16
8f6f9ba5 17/** Path for SquirrelMail required files. */
86725763 18define('SM_PATH','../');
19
20/* SquirrelMail required files. */
21require_once(SM_PATH . 'functions/strings.php');
22require_once(SM_PATH . 'config/config.php');
23require_once(SM_PATH . 'functions/prefs.php');
24require_once(SM_PATH . 'functions/imap.php');
25require_once(SM_PATH . 'functions/plugin.php');
26require_once(SM_PATH . 'functions/i18n.php');
27require_once(SM_PATH . 'functions/auth.php');
a32985a5 28require_once(SM_PATH . 'functions/global.php');
245a6892 29
f3bc099d 30if (!function_exists('sqm_baseuri')){
86725763 31 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 32}
33$base_uri = sqm_baseuri();
88fa922a 34
748ba6c0 35sqsession_is_active();
a32985a5 36
f38b7cf0 37sqgetGlobalVar('username', $username, SQ_SESSION);
38sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
39sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
dcc1cc82 40
f38b7cf0 41sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
42
db6a9192 43if ( isset($_SESSION['session_expired_post']) ) {
44 sqsession_unregister('session_expired_post');
45}
c67e4479 46if(!sqgetGlobalVar('mailto', $mailto)) {
47 $mailto = '';
48}
a32985a5 49
864b1c33 50is_logged_in();
1b187352 51
148ee1ef 52do_hook('webmail_top');
53
15e6162e 54/**
864b1c33 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 */
871ab9eb 61$my_language = getPref($data_dir, $username, 'language');
864b1c33 62if ($my_language != $squirrelmail_language) {
63 setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
64}
cf47d363 65
53da506b 66$err=set_up_language(getPref($data_dir, $username, 'language'));
441f2d33 67
7dfa92cb 68echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
ac50138c 69 "<html><head>\n" .
2b55df0c 70 "<title>$org_title</title>\n".
71 "</head>";
65c3ec94 72
53da506b 73// Japanese translation used without mbstring support
74if ($err==2) {
75 echo "<body>\n".
76 "<p>You need to have php4 installed with the multibyte string function \n".
77 "enabled (using configure option --enable-mbstring).</p>\n".
78 "<p>System assumed that you accidently switched to Japanese translation \n".
79 "and reverted your language preference to English.</p>\n".
80 "<p>Please refresh this page in order to use webmail.</p>\n".
81 "</body></html>";
82 return;
83}
84
871ab9eb 85$left_size = getPref($data_dir, $username, 'left_size');
86$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
fab3baa6 87
0c660770 88if (isset($languages[$squirrelmail_language]['DIR']) &&
89 strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
fab3baa6 90 $temp_location_of_bar = 'right';
91} else {
92 $temp_location_of_bar = 'left';
93}
94
864b1c33 95if ($location_of_bar == '') {
fab3baa6 96 $location_of_bar = $temp_location_of_bar;
864b1c33 97}
fab3baa6 98$temp_location_of_bar = '';
99
864b1c33 100if ($left_size == "") {
101 if (isset($default_left_size)) {
f740c049 102 $left_size = $default_left_size;
864b1c33 103 }
104 else {
105 $left_size = 200;
106 }
65c3ec94 107}
108
864b1c33 109if ($location_of_bar == 'right') {
7dfa92cb 110 echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
864b1c33 111}
112else {
7dfa92cb 113 echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
864b1c33 114}
ad6787f0 115
864b1c33 116/*
117 * There are three ways to call webmail.php
118 * 1. webmail.php
119 * - This just loads the default entry screen.
120 * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
121 * - This loads the frames starting at the given values.
122 * 3. webmail.php?right_frame=folders.php
123 * - Loads the frames with the Folder options in the right frame.
124 *
125 * This was done to create a pure HTML way of refreshing the folder list since
126 * we would like to use as little Javascript as possible.
127 */
128if (!isset($right_frame)) {
793cc001 129 $right_frame = '';
78194072 130}
864b1c33 131if ($right_frame == 'right_main.php') {
132 $urlMailbox = urlencode($mailbox);
133 $right_frame_url =
3d570ba0 134 "right_main.php?mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage";
65c3ec94 135} elseif ($right_frame == 'options.php') {
864b1c33 136 $right_frame_url = 'options.php';
65c3ec94 137} elseif ($right_frame == 'folders.php') {
864b1c33 138 $right_frame_url = 'folders.php';
c67e4479 139} elseif ($right_frame == 'compose.php') {
140 $right_frame_url = 'compose.php?' . $mailto;
78194072 141} else if ($right_frame == '') {
871ab9eb 142 $right_frame_url = 'right_main.php';
78194072 143} else {
fdc9d9b5 144 $right_frame_url = $right_frame;
864b1c33 145}
9a732bb6 146
da9a8410 147$left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'.
148 _("Folder List") ."\" />\n";
149$right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'.
150 _("Message List") ."\" />\n";
151
864b1c33 152if ($location_of_bar == 'right') {
da9a8410 153 echo $right_frame . $left_frame;
864b1c33 154}
155else {
da9a8410 156 echo $left_frame . $right_frame;
864b1c33 157}
753ce838 158do_hook('webmail_bottom');
ad6787f0 159?>
d68323ff 160</frameset>
161</html>