mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -297,6 +297,17 @@ function getDolCurrency()
|
||||
return (string) $conf->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default context page string
|
||||
*
|
||||
* @param string $s Page path
|
||||
* @return string Value returned
|
||||
*/
|
||||
function getDolDefaultContextPage($s)
|
||||
{
|
||||
return str_replace('_', '', basename(dirname($s)).basename($s, '.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Dolibarr user constant string value
|
||||
*
|
||||
@@ -3799,7 +3810,13 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
||||
$offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
|
||||
if (class_exists('DateTimeZone')) {
|
||||
$user_date_tz = new DateTimeZone($offsettzstring);
|
||||
try {
|
||||
$user_date_tz = new DateTimeZone($offsettzstring);
|
||||
} catch (Exception $e) {
|
||||
// Bad value for $offsettzstring
|
||||
dol_syslog("DateInvalidTimeZoneException for timezone string '".$offsettzstring."'. Falling back to UTC.", LOG_ERR);
|
||||
$user_date_tz = new DateTimeZone('UTC'); // Force valid timezone as UTC
|
||||
}
|
||||
$user_dt = new DateTime();
|
||||
$user_dt->setTimezone($user_date_tz);
|
||||
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
|
||||
|
||||
Reference in New Issue
Block a user