aboutsummaryrefslogtreecommitdiffstats
path: root/config/autoconfigbackup
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-11-12 14:05:31 -0500
committerjim-p <jimp@pfsense.org>2015-11-12 14:05:31 -0500
commit683f9eced9675528b61558ed327be89168b5d33f (patch)
tree259c402c34bacc595394824c2abbe1c55018eb95 /config/autoconfigbackup
parent6a9837c9abd3011d22eccb31175e56fc02b9f286 (diff)
downloadpfsense-packages-683f9eced9675528b61558ed327be89168b5d33f.tar.gz
pfsense-packages-683f9eced9675528b61558ed327be89168b5d33f.tar.bz2
pfsense-packages-683f9eced9675528b61558ed327be89168b5d33f.zip
Add timezone conversion for ACB timestamps, server always returns time in US Central time, convert to locally set TZ. Fixes #5250
Diffstat (limited to 'config/autoconfigbackup')
-rw-r--r--config/autoconfigbackup/autoconfigbackup.php11
-rw-r--r--config/autoconfigbackup/autoconfigbackup.xml2
2 files changed, 12 insertions, 1 deletions
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 @@
<description>Automatically backs up your pfSense configuration. All contents are encrypted before being sent to the server. Requires Gold Subscription from https://portal.pfsense.org</description>
<requirements>pfSense Portal subscription</requirements>
<name>AutoConfigBackup</name>
- <version>1.29</version>
+ <version>1.30</version>
<title>Diagnostics: Auto Configuration Backup</title>
<savetext>Change</savetext>
<include_file>/usr/local/pkg/autoconfigbackup.inc</include_file>