From 888552724a94521817cc64742d8ca6be13b386ef Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 17 Apr 2024 12:53:11 -0400 Subject: [PATCH] Set Timezone in all places and it needs to be set in and sperated it into a seperate include --- check_login.php | 11 +++-------- cron.php | 7 +++---- cron_certificate_refresher.php | 7 +++---- cron_domain_refresher.php | 7 +++---- cron_mail_queue.php | 8 ++++---- cron_ticket_email_parser.php | 7 +++---- guest_ajax.php | 3 +++ guest_download_file.php | 3 +++ guest_header.php | 3 +++ guest_post.php | 3 +++ inc_set_timezone.php | 13 +++++++++++++ login.php | 2 ++ portal/check_login.php | 3 +++ portal/login.php | 6 ++++-- portal/login_microsoft.php | 3 +++ portal/login_reset.php | 4 +++- 16 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 inc_set_timezone.php diff --git a/check_login.php b/check_login.php index feea9eab..a0fd1573 100644 --- a/check_login.php +++ b/check_login.php @@ -22,6 +22,9 @@ if (!isset($_SESSION['logged']) || !$_SESSION['logged']) { exit; } +// Set Timezone +require_once "inc_set_timezone.php"; + // User IP & UA $session_ip = sanitizeInput(getIP()); $session_user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']); @@ -52,14 +55,6 @@ $session_company_name = $row['company_name']; $session_company_country = $row['company_country']; $session_company_locale = $row['company_locale']; $session_company_currency = $row['company_currency']; -$session_timezone = $row['config_timezone']; - -// Set Timezone to the companies timezone -// 2024-02-08 JQ - The option to set the timezone in PHP was disabled to prevent inconsistencies with MariaDB/MySQL, which utilize the system's timezone, It is now consdered best practice to set the timezone on system itself -//date_default_timezone_set($session_timezone); - -// 2024-03-21 JQ - Re-Enabled Timezone setting as new PHP update does not respect System Time but defaulted to UTC -date_default_timezone_set($session_timezone); //Set Currency Format $currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRENCY); diff --git a/cron.php b/cron.php index da0546c5..8ea474b9 100644 --- a/cron.php +++ b/cron.php @@ -5,6 +5,9 @@ chdir(dirname(__FILE__)); require_once "config.php"; +// Set Timezone +require_once "inc_set_timezone.php"; + require_once "functions.php"; @@ -32,7 +35,6 @@ $config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']); $config_invoice_from_name = sanitizeInput($row['config_invoice_from_name']); $config_invoice_late_fee_enable = intval($row['config_invoice_late_fee_enable']); $config_invoice_late_fee_percent = floatval($row['config_invoice_late_fee_percent']); -$config_timezone = sanitizeInput($row['config_timezone']); // Mail Settings $config_smtp_host = $row['config_smtp_host']; @@ -71,9 +73,6 @@ $config_login_remember_me_expire = intval($row['config_login_remember_me_expire' // Set Currency Format $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY); -// Set Timezone -date_default_timezone_set($config_timezone); - $argv = $_SERVER['argv']; // Check cron is enabled diff --git a/cron_certificate_refresher.php b/cron_certificate_refresher.php index 2b1cdc76..3d0e76e5 100644 --- a/cron_certificate_refresher.php +++ b/cron_certificate_refresher.php @@ -2,6 +2,9 @@ require_once "config.php"; +// Set Timezone +require_once "inc_set_timezone.php"; + require_once "functions.php"; @@ -12,10 +15,6 @@ $row = mysqli_fetch_array($sql_settings); // Company Settings $config_enable_cron = intval($row['config_enable_cron']); $config_cron_key = $row['config_cron_key']; -$config_timezone = sanitizeInput($row['config_timezone']); - -// Set Timezone -date_default_timezone_set($config_timezone); $argv = $_SERVER['argv']; diff --git a/cron_domain_refresher.php b/cron_domain_refresher.php index d76fc919..5a312bb6 100644 --- a/cron_domain_refresher.php +++ b/cron_domain_refresher.php @@ -2,6 +2,9 @@ require_once "config.php"; +// Set Timezone +require_once "inc_set_timezone.php"; + require_once "functions.php"; @@ -12,10 +15,6 @@ $row = mysqli_fetch_array($sql_settings); // Company Settings $config_enable_cron = intval($row['config_enable_cron']); $config_cron_key = $row['config_cron_key']; -$config_timezone = sanitizeInput($row['config_timezone']); - -// Set Timezone -date_default_timezone_set($config_timezone); $argv = $_SERVER['argv']; diff --git a/cron_mail_queue.php b/cron_mail_queue.php index 9ec952e8..f6fb6088 100644 --- a/cron_mail_queue.php +++ b/cron_mail_queue.php @@ -1,6 +1,10 @@