diff --git a/web/minerHelper.php b/web/minerHelper.php index d0e7230..5e6c962 100644 --- a/web/minerHelper.php +++ b/web/minerHelper.php @@ -587,6 +587,16 @@ public static function getClientIp() { */ public static function checkWallet($coin_seo_name = FALSE) { + // Check for the time_zone cookie, if set then reset the default timezone + if (!empty($_COOKIE['userLocalTimeZone'])) { + $time_zone = json_decode($_COOKIE['userLocalTimeZone'], true); + // Make sure there's an available abbreviation before setting the timezone + + if (timezone_name_from_abbr( '', ($time_zone['offset'] - 60) * 60, $time_zone['dst'])) { + date_default_timezone_set( timezone_name_from_abbr('', ($time_zone['offset'] - 60) * 60, $time_zone['dst'])); + } + } + // First check if we have something in get if (!empty($_GET['wallet'])) { // Update cookie @@ -982,6 +992,10 @@ public static function _templateVariables($db = FALSE, $route = null, $data = FA case 'blocks': $blocks = minerHelper::getBlocks($db, $data['coin_id']); + if (!empty($_COOKIE['userLocalTimeZone'])) { + $time_zone = json_decode($_COOKIE['userLocalTimeZone'], true); + } + // Load last 30 blocks return [ 'blocks' => $blocks, @@ -990,6 +1004,7 @@ public static function _templateVariables($db = FALSE, $route = null, $data = FA 'hashrate_user_24_hours' => $hashrate_user_24_hours ?? FALSE, 'coin_seo_name' => $data['coin_seo_name'], 'seo_site_name' => $data['seo_site_name'], + 'offset' => $time_zone['offset'], 'load_blocks_charts' => TRUE ]; break; diff --git a/web/templates/blocks.html.twig b/web/templates/blocks.html.twig index ee652a8..78b7cce 100644 --- a/web/templates/blocks.html.twig +++ b/web/templates/blocks.html.twig @@ -30,6 +30,7 @@ {% endfor %} +

Offset from GMT: {{ offset }} minutes -> times are adjusted to your local timezone!

diff --git a/web/templates/footer.html b/web/templates/footer.html index 1dc2db4..c6d2b45 100644 --- a/web/templates/footer.html +++ b/web/templates/footer.html @@ -24,9 +24,63 @@
Fork based on YiiMP project
{% if load_charts %}