From 683f9eced9675528b61558ed327be89168b5d33f Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 12 Nov 2015 14:05:31 -0500 Subject: Add timezone conversion for ACB timestamps, server always returns time in US Central time, convert to locally set TZ. Fixes #5250 --- config/autoconfigbackup/autoconfigbackup.php | 11 +++++++++++ config/autoconfigbackup/autoconfigbackup.xml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'config/autoconfigbackup') diff --git a/config/autoconfigbackup/autoconfigbackup.php b/config/autoconfigbackup/autoconfigbackup.php index 5bf40736..d384e3dd 100644 --- a/config/autoconfigbackup/autoconfigbackup.php +++ b/config/autoconfigbackup/autoconfigbackup.php @@ -350,12 +350,23 @@ EOF; // Loop through and create new confvers $data_split = split("\n", $data); $confvers = array(); + + /* Set up time zones for conversion. See #5250 */ + $acbtz = new DateTimeZone('America/Chicago'); + $mytz = new DateTimeZone(date_default_timezone_get()); + foreach ($data_split as $ds) { $ds_split = split($oper_sep, $ds); $tmp_array = array(); $tmp_array['username'] = $ds_split[0]; $tmp_array['reason'] = $ds_split[1]; $tmp_array['time'] = $ds_split[2]; + + /* Convert the time from server time to local. See #5250 */ + $budate = new DateTime($tmp_array['time'], $acbtz); + $budate->setTimezone($mytz); + $tmp_array['time'] = $budate->format(DATE_RFC2822); + if ($ds_split[2] && $ds_split[0]) { $confvers[] = $tmp_array; } diff --git a/config/autoconfigbackup/autoconfigbackup.xml b/config/autoconfigbackup/autoconfigbackup.xml index dd83a9c7..93526a49 100644 --- a/config/autoconfigbackup/autoconfigbackup.xml +++ b/config/autoconfigbackup/autoconfigbackup.xml @@ -43,7 +43,7 @@ Automatically backs up your pfSense configuration. All contents are encrypted before being sent to the server. Requires Gold Subscription from https://portal.pfsense.org pfSense Portal subscription AutoConfigBackup - 1.29 + 1.30 Diagnostics: Auto Configuration Backup Change /usr/local/pkg/autoconfigbackup.inc -- cgit v1.2.3