mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-17 23:11:29 +01:00
New: Function dol_now('tzuser') is now supported.
This commit is contained in:
@@ -176,15 +176,15 @@ if (function_exists('date_default_timezone_get'))
|
|||||||
print "</td></tr>\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
print "</td></tr>\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||||
}
|
}
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("PHPServerOffsetWithGreenwich")."</td><td>".(- dol_mktime(0,0,0,1,1,1970))."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("PHPServerOffsetWithGreenwich")."</td><td>".(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970))."</td></tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CurrentHour")."</td><td>".dol_print_date(dol_now('tzserver'),'dayhour')."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CurrentHour")."</td><td>".dol_print_date(dol_now('tzserver'),'dayhour')."</td></tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].'><td width="300">=> dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext")."</td>";
|
print "<tr ".$bc[$var].'><td width="300">=> dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext")."</td>";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false)." (with dol_print_date() or idate() = ".dol_print_date(dol_get_first_day(1970,1,false),'dayhour').")</td>";
|
print "<tr ".$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,false)</td><td>'.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').")</td>";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true)." (with dol_print_date() or idate() = ".dol_print_date(dol_get_first_day(1970,1,true),'dayhour').")</td>";
|
print "<tr ".$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,true)</td><td>'.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').")</td>";
|
||||||
# Parent company
|
# Parent company
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CompanyTZ")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CompanyTZ")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
||||||
@@ -193,10 +193,12 @@ $var=!$var;
|
|||||||
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CompanyHour")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CompanyHour")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
||||||
# Client
|
# Client
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ClientTZ")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ClientTZ")."</td><td>".($_SESSION['dol_tz']>=0?'+':'').$_SESSION['dol_tz']."</td></tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
#print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientHour")."</td><td>".dol_print_date(dol_now('tzuser'),'dayhour')."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientOffsetWithGreenwich")."</td><td>".($_SESSION['dol_tz']>=0?'+':'').($_SESSION['dol_tz']*60*60)."</td></tr>\n";
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientHour")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientHour")."</td><td>".dol_print_date(dol_now('tzuser'),'dayhour')."</td></tr>\n";
|
||||||
|
#print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientHour")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
||||||
|
|||||||
@@ -31,9 +31,8 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
|||||||
<head>
|
<head>
|
||||||
<meta name="robots" content="noindex,nofollow">
|
<meta name="robots" content="noindex,nofollow">
|
||||||
<title><?php echo $langs->trans('Login'); ?></title>
|
<title><?php echo $langs->trans('Login'); ?></title>
|
||||||
|
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-1.4.3.min.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
|
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<!--
|
<!--
|
||||||
#login {
|
#login {
|
||||||
@@ -50,26 +49,48 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
|||||||
}
|
}
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function donnefocus() {
|
|
||||||
document.getElementById('<?php echo $focus_element; ?>').focus();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php echo $conf->global->MAIN_HTML_HEADER ?>
|
<?php echo $conf->global->MAIN_HTML_HEADER ?>
|
||||||
|
|
||||||
<!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> -->
|
<!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="body" onload="donnefocus();">
|
<body class="body">
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
// Set focus on correct field
|
||||||
|
<?php if ($focus_element) { ?>jQuery('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
|
||||||
|
// Detect and save TZ and DST
|
||||||
|
var rightNow = new Date();
|
||||||
|
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
|
||||||
|
var temp = jan1.toGMTString();
|
||||||
|
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
|
||||||
|
var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
|
||||||
|
var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
|
||||||
|
temp = june1.toGMTString();
|
||||||
|
var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
|
||||||
|
var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
|
||||||
|
var dst;
|
||||||
|
if (std_time_offset == daylight_time_offset) {
|
||||||
|
dst = "0"; // daylight savings time is NOT observed
|
||||||
|
} else {
|
||||||
|
dst = "1"; // daylight savings time is observed
|
||||||
|
}
|
||||||
|
jQuery('#tz').val(std_time_offset); // returns TZ
|
||||||
|
jQuery('#dst').val(dst); // returns DST
|
||||||
|
// Detect and save screen resolution
|
||||||
|
jQuery('#screenwidth').val(jQuery(window).width()); // returns width of browser viewport
|
||||||
|
jQuery('#screenheight').val(jQuery(window).height()); // returns width of browser viewport
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
|
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
<input type="hidden" name="loginfunction" value="loginfunction" />
|
<input type="hidden" name="loginfunction" value="loginfunction" />
|
||||||
<!-- Add fields to send local user information -->
|
<!-- Add fields to send local user information -->
|
||||||
<input type="hidden" name="tz" value="" />
|
<input type="hidden" name="tz" id="tz" value="" />
|
||||||
<input type="hidden" name="screenwidth" value="" />
|
<input type="hidden" name="dst" id="dst" value="" />
|
||||||
<input type="hidden" name="screenheight" value="" />
|
<input type="hidden" name="screenwidth" id="screenwidth" value="" />
|
||||||
|
<input type="hidden" name="screenheight" id="screenheight" value="" />
|
||||||
|
|
||||||
<table class="login" summary="<?php echo $title; ?>" cellpadding="0" cellspacing="0" border="0" align="center">
|
<table class="login" summary="<?php echo $title; ?>" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||||
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
|
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ ClientHour=Hour client (user)
|
|||||||
OSTZ=Time Zone OS server
|
OSTZ=Time Zone OS server
|
||||||
PHPTZ=Time Zone PHP server
|
PHPTZ=Time Zone PHP server
|
||||||
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
|
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
|
||||||
|
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
|
||||||
CurrentHour=PHP server hour
|
CurrentHour=PHP server hour
|
||||||
CompanyTZ= Time Zone company (main company)
|
CompanyTZ= Time Zone company (main company)
|
||||||
CompanyHour= Hour company (main company)
|
CompanyHour= Hour company (main company)
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ ClientHour= Heure client (utilisateur)
|
|||||||
OSTZ= Time Zone OS
|
OSTZ= Time Zone OS
|
||||||
PHPTZ= Time Zone config PHP
|
PHPTZ= Time Zone config PHP
|
||||||
PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes)
|
PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes)
|
||||||
|
ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes)
|
||||||
CurrentHour= Heure serveur PHP
|
CurrentHour= Heure serveur PHP
|
||||||
CompanyTZ= Time Zone société (maison mère)
|
CompanyTZ= Time Zone société (maison mère)
|
||||||
CompanyHour= Heure société (maison mère)
|
CompanyHour= Heure société (maison mère)
|
||||||
|
|||||||
@@ -119,7 +119,8 @@ function dol_now($mode='tzserver')
|
|||||||
else if ($mode == 'tzuser') // Time for now where the user is located
|
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
|
// 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;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,10 +366,14 @@ if (! defined('NOLOGIN'))
|
|||||||
$passwordtotest=$_POST["password"];
|
$passwordtotest=$_POST["password"];
|
||||||
$function='check_user_password_'.$mode;
|
$function='check_user_password_'.$mode;
|
||||||
$login=$function($usertotest,$passwordtotest);
|
$login=$function($usertotest,$passwordtotest);
|
||||||
if ($login)
|
if ($login) // Login is successfull
|
||||||
{
|
{
|
||||||
$test=false;
|
$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
|
else
|
||||||
@@ -451,11 +455,11 @@ if (! defined('NOLOGIN'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// It is already in a session
|
// We are already into an authenticated session
|
||||||
$login=$_SESSION["dol_login"];
|
$login=$_SESSION["dol_login"];
|
||||||
$resultFetchUser=$user->fetch('',$login);
|
|
||||||
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
||||||
|
|
||||||
|
$resultFetchUser=$user->fetch('',$login);
|
||||||
if ($resultFetchUser <= 0)
|
if ($resultFetchUser <= 0)
|
||||||
{
|
{
|
||||||
// Account has been removed after login
|
// Account has been removed after login
|
||||||
@@ -490,7 +494,7 @@ if (! defined('NOLOGIN'))
|
|||||||
}
|
}
|
||||||
else
|
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
|
// Call triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
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"]))
|
if (! isset($_SESSION["dol_login"]))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// New session for this login
|
// New session for this login
|
||||||
$_SESSION["dol_login"]=$user->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;
|
$_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
if ($conf->multicompany->enabled) $_SESSION["dol_entity"]=$conf->entity;
|
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());
|
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
|
// Set liste_limit
|
||||||
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0
|
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0
|
||||||
|
|||||||
Reference in New Issue
Block a user