From b33b1c56b8c462773ab94d0e400cf96633c47016 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2010 21:56:06 +0000 Subject: [PATCH] Fix: Default language on login page --- ChangeLog | 1 + htdocs/lib/security.lib.php | 8 ++++---- htdocs/main.inc.php | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ca27301334..afcfca98710 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ For users: - Fix: Can change password if has only permission change password. - Fix: Project PDF document show the tasks. - Fix: bug #29278 : SMTP fails with IP +- Fix: Default language on login page. For developers: - More comments in code. diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index cd9aa8260b8..22b44a7f13b 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -35,7 +35,7 @@ function dol_loginfunction($langs,$conf,$mysoc) { global $dolibarr_main_demo,$db; - $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); + $langcode=(empty($_GET["lang"])?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):$_GET["lang"]); $langs->setDefaultLang($langcode); $langs->load("main"); @@ -44,7 +44,7 @@ function dol_loginfunction($langs,$conf,$mysoc) $main_authentication=$conf->file->main_authentication; $session_name=session_name(); - + $dol_url_root = DOL_URL_ROOT; $php_self = $_SERVER['PHP_SELF']; @@ -204,9 +204,9 @@ function dol_loginfunction($langs,$conf,$mysoc) } } $main_home=nl2br($conf->global->MAIN_HOME); - + $dol_loginmesg = $_SESSION["dol_loginmesg"]; - + include($template_dir.'login.tpl.php'); // To use native PHP $_SESSION["dol_loginmesg"] = ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a0a596dc3de..1e119116244 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -338,7 +338,7 @@ if (! defined('NOLOGIN')) // Validation tests user / password // If ok, the variable will be initialized login - // If error, we will put error message in session under the name dol_loginmesg $goontestloop=false; + // If error, we will put error message in session under the name dol_loginmesg $goontestloop=false; if (isset($_SERVER["REMOTE_USER"]) && in_array('http',$authmode)) $goontestloop=true; if (isset($_POST["username"])) $goontestloop=true; @@ -438,8 +438,7 @@ if (! defined('NOLOGIN')) } else { - // It is already in a backup session login - // Remarks: We do not save user object poses for bp in some cases misidentified + // It is already in a session $login=$_SESSION["dol_login"]; $resultFetchUser=$user->fetch($login); dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);