Tyler Akins 24 роки тому
батько
коміт
a50adf45b4
8 змінених файлів з 13 додано та 28 видалено
  1. 5 3
      functions/auth.php
  2. 0 2
      functions/i18n.php
  3. 1 14
      functions/page_header.php
  4. 0 1
      src/download.php
  5. 0 1
      src/login.php
  6. 6 6
      src/redirect.php
  7. 0 1
      src/signout.php
  8. 1 0
      src/validate.php

+ 5 - 3
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 "<html><body bgcolor=\"ffffff\">\n";
       echo "<br><br>";
       echo "<center>";

+ 0 - 2
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(){

+ 1 - 14
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;

+ 0 - 1
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);

+ 0 - 1
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

+ 6 - 6
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 "<html><body bgcolor=\"ffffff\">\n";
       echo "<br><br>";
       echo "<center>";
@@ -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');
    }
 

+ 0 - 1
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) {

+ 1 - 0
src/validate.php

@@ -13,6 +13,7 @@
    define ('validate_php', true); 
 
    session_start();
+   include ('../functions/i18n.php');
    include ('../functions/auth.php');
    
    is_logged_in();