diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 5efd560e31d..58fdbbdc473 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -176,15 +176,15 @@ if (function_exists('date_default_timezone_get')) print "\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php } $var=!$var; -print "=> ".$langs->trans("PHPServerOffsetWithGreenwich")."".(- dol_mktime(0,0,0,1,1,1970))."\n"; +print "=> ".$langs->trans("PHPServerOffsetWithGreenwich")."".(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970))."\n"; $var=!$var; print "=> ".$langs->trans("CurrentHour")."".dol_print_date(dol_now('tzserver'),'dayhour')."\n"; $var=!$var; print "=> dol_print_date(0,"dayhourtext")'.dol_print_date(0,"dayhourtext").""; $var=!$var; -print "=> dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false)."     (with dol_print_date() or idate() = ".dol_print_date(dol_get_first_day(1970,1,false),'dayhour').")"; +print "=> dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false)."     (=> dol_print_date() or idate() of this value = ".dol_print_date(dol_get_first_day(1970,1,false),'dayhour').")"; $var=!$var; -print "=> dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true)."     (with dol_print_date() or idate() = ".dol_print_date(dol_get_first_day(1970,1,true),'dayhour').")"; +print "=> dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true)."     (=> dol_print_date() or idate() of this value = ".dol_print_date(dol_get_first_day(1970,1,true),'dayhour').")"; # Parent company $var=!$var; print "".$langs->trans("CompanyTZ")."".$langs->trans("FeatureNotYetAvailable")."\n"; @@ -193,10 +193,12 @@ $var=!$var; print "=> ".$langs->trans("CompanyHour")."".$langs->trans("FeatureNotYetAvailable")."\n"; # Client $var=!$var; -print "".$langs->trans("ClientTZ")."".$langs->trans("FeatureNotYetAvailable")."\n"; +print "".$langs->trans("ClientTZ")."".($_SESSION['dol_tz']>=0?'+':'').$_SESSION['dol_tz']."\n"; $var=!$var; -#print "=> ".$langs->trans("ClientHour")."".dol_print_date(dol_now('tzuser'),'dayhour')."\n"; -print "=> ".$langs->trans("ClientHour")."".$langs->trans("FeatureNotYetAvailable")."\n"; +print "=> ".$langs->trans("ClientOffsetWithGreenwich")."".($_SESSION['dol_tz']>=0?'+':'').($_SESSION['dol_tz']*60*60)."\n"; +$var=!$var; +print "=> ".$langs->trans("ClientHour")."".dol_print_date(dol_now('tzuser'),'dayhour')."\n"; +#print "=> ".$langs->trans("ClientHour")."".$langs->trans("FeatureNotYetAvailable")."\n"; $var=!$var; $filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index d7004d56745..c49ca8cb684 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,9 +31,8 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client); <?php echo $langs->trans('Login'); ?> - + - - - - global->MAIN_HTML_HEADER ?> - - + + + +
- - - + + + + diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f89ba08b153..cd0975e0c96 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -103,6 +103,7 @@ ClientHour=Hour client (user) OSTZ=Time Zone OS server PHPTZ=Time Zone PHP server PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds) +ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds) CurrentHour=PHP server hour CompanyTZ= Time Zone company (main company) CompanyHour= Hour company (main company) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index ae6d910934b..2f54a9b6400 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -103,6 +103,7 @@ ClientHour= Heure client (utilisateur) OSTZ= Time Zone OS PHPTZ= Time Zone config PHP PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes) +ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes) CurrentHour= Heure serveur PHP CompanyTZ= Time Zone société (maison mère) CompanyHour= Heure société (maison mère) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index b74318f7512..fda6c7b7027 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -119,7 +119,8 @@ function dol_now($mode='tzserver') else if ($mode == 'tzuser') // Time for now where the user is located { // TODO Should use the timezone of the user instead of timezone of server - $ret=mktime(); + $tz=isset($_SESSION['dol_tz'])?$_SESSION['dol_tz']:0; + $ret=gmmktime()+($tz*24*60*60); } return $ret; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2e2cafbc6c7..cb939fbbfa4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -366,10 +366,14 @@ if (! defined('NOLOGIN')) $passwordtotest=$_POST["password"]; $function='check_user_password_'.$mode; $login=$function($usertotest,$passwordtotest); - if ($login) + if ($login) // Login is successfull { $test=false; - $conf->authmode=$mode; // This properties is defined only when logged + $dol_authmode=$mode; // This properties is defined only when logged to say what mode was successfully used + $dol_tz=$_POST["tz"]; + $dol_dst=$_POST["dst"]; + $dol_screenwidth=$_POST["screenwidth"]; + $dol_screenheight=$_POST["screenheight"]; } } else @@ -451,11 +455,11 @@ if (! defined('NOLOGIN')) } else { - // It is already in a session + // We are already into an authenticated session $login=$_SESSION["dol_login"]; - $resultFetchUser=$user->fetch('',$login); dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login); + $resultFetchUser=$user->fetch('',$login); if ($resultFetchUser <= 0) { // Account has been removed after login @@ -490,7 +494,7 @@ if (! defined('NOLOGIN')) } else { - if (! empty($conf->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) + if (! empty($conf->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default { // Call triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); @@ -502,14 +506,19 @@ if (! defined('NOLOGIN')) } } - // Is it a new session ? + // Is it a new session that has started ? + // If we are here this means authentication was successfull. if (! isset($_SESSION["dol_login"])) { $error=0; // New session for this login $_SESSION["dol_login"]=$user->login; - $_SESSION["dol_authmode"]=$conf->authmode; + $_SESSION["dol_authmode"]=isset($dol_authmode)?$dol_authmode:''; + $_SESSION["dol_tz"]=isset($dol_tz)?$dol_tz:''; + $_SESSION["dol_dst"]=isset($dol_dst)?$dol_dst:''; + $_SESSION["dol_screenwidth"]=isset($dol_screenwidth)?$dol_screenwidth:''; + $_SESSION["dol_screenheight"]=isset($dol_screenheight)?$dol_screenheight:''; $_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM; if ($conf->multicompany->enabled) $_SESSION["dol_entity"]=$conf->entity; dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); @@ -596,8 +605,7 @@ if (! defined('NOLOGIN')) } /* - * Overwrite configs global par configs perso - * ------------------------------------------ + * Overwrite configs global by peronal configs */ // Set liste_limit if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0