From a8277dc19f7521b48a80fd99e7a8730d085321dd Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 13 Apr 2023 12:25:18 +0200 Subject: [PATCH] #10945 Fix timestamp --- .../godmode/setup/setup_general.php | 2 +- pandora_console/operation/events/events.php | 33 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index ad7a40aa8b..82b6392a56 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -431,7 +431,7 @@ $table->data[$i++][] = html_print_label_input_block( $table->colspan[$i][] = 2; $table->data[$i++][] = html_print_label_input_block( - __('Timezone setup'), + __('Server timezone setup'), html_print_div( [ 'class' => '', diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 62a8850b80..86acd90a90 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -538,22 +538,27 @@ if (is_ajax() === true) { ); $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone']; - if (!$user_timezone) { - $timezone = timezone_open(date_default_timezone_get()); - $datetime_eur = date_create('now', timezone_open($config['timezone'])); - $dif = timezone_offset_get($timezone, $datetime_eur); - date($config['date_format'], $dif); - if (!date('I')) { - // For summer -3600sec. - $dif -= 3600; - } + if (empty($user_timezone) === true) { + if (date_default_timezone_get() !== $config['timezone']) { + $timezone = timezone_open(date_default_timezone_get()); + $datetime_eur = date_create('now', timezone_open($config['timezone'])); + $dif = timezone_offset_get($timezone, $datetime_eur); + date($config['date_format'], $dif); + if (!date('I')) { + // For summer -3600sec. + $dif -= 3600; + } - $total_sec = strtotime($tmp->timestamp); - $total_sec += $dif; - $last_contact = date($config['date_format'], $total_sec); - $last_contact_value = ui_print_timestamp($last_contact, true); + $total_sec = strtotime($tmp->timestamp); + $total_sec += $dif; + $last_contact = date($config['date_format'], $total_sec); + $last_contact_value = ui_print_timestamp($last_contact, true); + } else { + $title = date($config['date_format'], strtotime($tmp->timestamp)); + $value = human_time_comparation(strtotime($tmp->timestamp), 'large'); + $last_contact_value = ''.$value.''; + } } else { - $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone']; date_default_timezone_set($user_timezone); $title = date($config['date_format'], strtotime($tmp->timestamp)); $value = human_time_comparation(strtotime($tmp->timestamp), 'large');