From 603f7bb72ee02f4d6f5c9c9209cceef85bc83a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9munaire?= Date: Sun, 18 Jan 2015 12:10:52 +0100 Subject: [PATCH] Fix timezone problem --- .../templates/smarty/plugins/modifier.date_format.php | 1 + .../templates/smarty/plugins/shared.make_timestamp.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/onyx/modules/templates/smarty/plugins/modifier.date_format.php b/onyx/modules/templates/smarty/plugins/modifier.date_format.php index 5ad7540b..a0cb2cab 100644 --- a/onyx/modules/templates/smarty/plugins/modifier.date_format.php +++ b/onyx/modules/templates/smarty/plugins/modifier.date_format.php @@ -43,6 +43,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' } else { return; } + $timestamp += 3600; if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) { if (DS == '\\') { $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); diff --git a/onyx/modules/templates/smarty/plugins/shared.make_timestamp.php b/onyx/modules/templates/smarty/plugins/shared.make_timestamp.php index 7c94e5f5..58bea326 100644 --- a/onyx/modules/templates/smarty/plugins/shared.make_timestamp.php +++ b/onyx/modules/templates/smarty/plugins/shared.make_timestamp.php @@ -20,7 +20,7 @@ function smarty_make_timestamp($string) { if (empty($string)) { // use "now": - return time(); + return localtime(); } elseif ($string instanceof DateTime) { return $string->getTimestamp(); } elseif (strlen($string) == 14 && ctype_digit($string)) { @@ -29,13 +29,13 @@ function smarty_make_timestamp($string) substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); } elseif (is_numeric($string)) { // it is a numeric string, we handle it as timestamp - return (int) $string; + return localtime($string); } else { // strtotime should handle it $time = strtotime($string); if ($time == - 1 || $time === false) { // strtotime() was not able to parse $string, use "now": - return time(); + return localtime(); } return $time;