From 1026ec43722b0261aa89415b7be105fc98db0115 Mon Sep 17 00:00:00 2001 From: fidian Date: Tue, 15 May 2001 19:11:58 +0000 Subject: [PATCH] * More minor changes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1367 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/auth.php | 8 +++++--- functions/i18n.php | 2 -- functions/page_header.php | 15 +-------------- src/download.php | 1 - src/login.php | 1 - src/redirect.php | 12 ++++++------ src/signout.php | 1 - src/validate.php | 1 + 8 files changed, 13 insertions(+), 28 deletions(-) diff --git a/functions/auth.php b/functions/auth.php index ea692eeb..8cddd002 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -12,12 +12,14 @@ return; define ('auth_php', true); - include '../functions/i18n.php'; - function is_logged_in () { + global $squirrelmail_language; + if (session_is_registered('user_is_logged_in')) return; - + + set_up_language($squirrelmail_language, true); + echo "\n"; echo "

"; echo "
"; diff --git a/functions/i18n.php b/functions/i18n.php index fec6daff..0c30fa19 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -793,9 +793,7 @@ bindtextdomain('squirrelmail', '../locale/'); textdomain('squirrelmail'); header ('Content-Type: text/html; charset=' . $languages[$sm_language]['CHARSET']); - $charset_headers_sent=true; } - return $charset_headers_sent; } function set_my_charset(){ diff --git a/functions/page_header.php b/functions/page_header.php index 6b6663ed..2bc87506 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -11,20 +11,7 @@ return; define('page_header_php', true); - include('../src/validate.php'); - include("../functions/prefs.php"); - include("../functions/plugin.php"); - - // Check to see if gettext is installed - $headers_sent=set_up_language(getPref($data_dir, $username, "language")); - - // This is done to ensure that the character set is correct. - // But first checks whether we have already sent headers - // with charset when we were setting up the user language. - // Otherwise user ends up with the default charset overriding - // his selected one. - if (!$headers_sent && $default_charset != "") - header ("Content-Type: text/html; charset=$default_charset"); + // Always set up the language before calling these functions function displayHtmlHeader ($title="SquirrelMail") { global $theme_css; diff --git a/src/download.php b/src/download.php index 5cf6fb83..b9976a8d 100644 --- a/src/download.php +++ b/src/download.php @@ -109,7 +109,6 @@ if (isset($absolute_dl) && $absolute_dl == "true") { switch($type0) { case "text": - set_up_language(getPref($data_dir, $username, "language")); DumpHeaders($type0, $type1, $filename, 1); $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); diff --git a/src/login.php b/src/login.php index b9905252..4b7218e9 100644 --- a/src/login.php +++ b/src/login.php @@ -34,7 +34,6 @@ setcookie("username", '', 0, $base_uri); setcookie("key", '', 0, $base_uri); - setcookie("logged_in", 0, 0, $base_uri); header ("Pragma: no-cache"); // In case the last session was not terminated properly, make sure diff --git a/src/redirect.php b/src/redirect.php index fa3d601b..074fe366 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -14,7 +14,7 @@ **/ include('../functions/i18n.php'); - include ('../functions/strings.php'); + include('../functions/strings.php'); include('../config/config.php'); // Before starting the session, the base URI must be known. @@ -32,10 +32,11 @@ session_unregister ('user_is_logged_in'); session_register ('base_uri'); + if (! isset($squirrelmail_language)) + $squirrelmail_language = ''; + set_up_language($squirrelmail_language, true); + if(!isset($login_username)) { - if (! isset($squirrelmail_language)) - $squirrelmail_language = ''; - set_up_language($squirrelmail_language, true); echo "\n"; echo "

"; echo "
"; @@ -56,7 +57,7 @@ include ('../functions/imap.php'); include ('../functions/plugin.php'); - if (!session_is_registered('user_is_logged_in') || $logged_in != 1) { + if (!session_is_registered('user_is_logged_in')) { do_hook ('login_before'); $onetimepad = OneTimePadCreate(strlen($secretkey)); @@ -80,7 +81,6 @@ setcookie('username', $login_username, 0, $base_uri); setcookie('key', $key, 0, $base_uri); - setcookie('logged_in', 1, 0, $base_uri); do_hook ('login_verified'); } diff --git a/src/signout.php b/src/signout.php index 413473f3..10f9b63a 100644 --- a/src/signout.php +++ b/src/signout.php @@ -35,7 +35,6 @@ do_hook('logout'); setcookie('username', '', 0, $base_uri); setcookie('key', '', 0, $base_uri); - setcookie('logged_in', '', 0, $base_uri); session_destroy(); if ($signout_page) { diff --git a/src/validate.php b/src/validate.php index e8542ce9..83d22e32 100644 --- a/src/validate.php +++ b/src/validate.php @@ -13,6 +13,7 @@ define ('validate_php', true); session_start(); + include ('../functions/i18n.php'); include ('../functions/auth.php'); is_logged_in(); -- 2.25.1