2
0
forked from Wavyzz/dolibarr

Fix for PHP < 5.3

This commit is contained in:
Laurent Destailleur
2012-06-05 12:27:42 +02:00
parent 50f3e480c9
commit dadc36ad18
2 changed files with 2 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ function getServerTimeZoneString()
function getServerTimeZoneInt($refgmtdate='now') function getServerTimeZoneInt($refgmtdate='now')
{ {
global $conf; global $conf;
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE)) if (method_exists('DateTimeZone','getOffset') && ! empty($conf->global->MAIN_NEW_DATE))
{ {
// Method 1 (include daylight) // Method 1 (include daylight)
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d'); $gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');

View File

@@ -960,7 +960,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
if ($second< 0 || $second > 60) return ''; if ($second< 0 || $second > 60) return '';
} }
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE)) if (method_exists('DateTime','getTimestamp') && ! empty($conf->global->MAIN_NEW_DATE))
{ {
if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get()); if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get());
else $localtz = new DateTimeZone('UTC'); else $localtz = new DateTimeZone('UTC');