From a4ff0f10071c4ed03a11df127dc55c9bc5bd5160 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 2 Aug 2022 12:59:09 -0600 Subject: [PATCH] Format the date and time with the time zone. --- app/event_guard/event_guard_logs.php | 55 +++++++++++++++++----------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/app/event_guard/event_guard_logs.php b/app/event_guard/event_guard_logs.php index 9d53beb890..4604e3af11 100644 --- a/app/event_guard/event_guard_logs.php +++ b/app/event_guard/event_guard_logs.php @@ -1,24 +1,23 @@ - Portions created by the Initial Developer are Copyright (C) 2022 - the Initial Developer. All Rights Reserved. + Copyright (C) 2022 Mark J Crane + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ //includes @@ -111,11 +110,22 @@ list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; +//set the time zone + if (isset($_SESSION['domain']['time_zone']['name'])) { + $time_zone = $_SESSION['domain']['time_zone']['name']; + } + else { + $time_zone = date_default_timezone_get(); + } + $parameters['time_zone'] = $time_zone; + //get the list $sql = "select "; $sql .= "event_guard_log_uuid, "; $sql .= "hostname, "; $sql .= "log_date, "; + $sql .= "to_char(timezone(:time_zone, log_date), 'DD Mon YYYY') as log_date_formatted, \n"; + $sql .= "to_char(timezone(:time_zone, log_date), 'HH12:MI:SS am') as log_time_formatted, \n"; $sql .= "filter, "; $sql .= "ip_address, "; $sql .= "extension, "; @@ -200,7 +210,8 @@ echo " \n"; } echo th_order_by('hostname', $text['label-hostname'], $order_by, $order); - echo th_order_by('log_date', $text['label-log_date'], $order_by, $order); + echo "".$text['label-date']."\n"; + echo "".$text['label-time']."\n"; echo th_order_by('filter', $text['label-filter'], $order_by, $order); echo th_order_by('ip_address', $text['label-ip_address'], $order_by, $order); echo th_order_by('extension', $text['label-extension'], $order_by, $order); @@ -232,7 +243,9 @@ echo " ".escape($row['hostname']); } echo " \n"; - echo " ".escape($row['log_date'])."\n"; + echo " ".escape($row['log_date_formatted'])."\n"; + echo " ".escape($row['log_time_formatted'])."\n"; + echo " ".escape($row['filter'])."\n"; echo " ".escape($row['ip_address'])."\n"; echo " ".escape($row['extension'])."\n";