From 8e123cf5f222c88398b6cf2f7d536722d43d9844 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Sun, 11 Aug 2024 13:13:59 +0300 Subject: [PATCH] Adds time range helper function --- public_html/helpers/time_range.php | 17 +++++++++++++++++ public_html/pages/components.php | 16 ++-------------- public_html/pages/conferences.php | 16 ++-------------- public_html/pages/participants.php | 16 ++-------------- 4 files changed, 23 insertions(+), 42 deletions(-) create mode 100644 public_html/helpers/time_range.php diff --git a/public_html/helpers/time_range.php b/public_html/helpers/time_range.php new file mode 100644 index 0000000..15f2924 --- /dev/null +++ b/public_html/helpers/time_range.php @@ -0,0 +1,17 @@ + diff --git a/public_html/pages/components.php b/public_html/pages/components.php index bce8a2e..245e5cb 100644 --- a/public_html/pages/components.php +++ b/public_html/pages/components.php @@ -7,20 +7,8 @@ require 'classes/component.php'; require 'helpers/database.php'; $db = connectDB($config, 'jilo'); -// FIXME move thi sto a special function -$time_range_specified = false; -if (!isset($_REQUEST['from_time']) || (isset($_REQUEST['from_time']) && $_REQUEST['from_time'] == '')) { - $from_time = '0000-01-01'; -} else { - $from_time = $_REQUEST['from_time']; - $time_range_specified = true; -} -if (!isset($_REQUEST['until_time']) || (isset($_REQUEST['until_time']) && $_REQUEST['until_time'] == '')) { - $until_time = '9999-12-31'; -} else { - $until_time = $_REQUEST['until_time']; - $time_range_specified = true; -} +// specify time range +include 'helpers/time_range.php'; // jitsi component events list // we use $_REQUEST, so that both links and forms work diff --git a/public_html/pages/conferences.php b/public_html/pages/conferences.php index 037e962..f868545 100644 --- a/public_html/pages/conferences.php +++ b/public_html/pages/conferences.php @@ -7,20 +7,8 @@ require 'classes/conference.php'; require 'helpers/database.php'; $db = connectDB($config, 'jilo'); -// FIXME move thi sto a special function -$time_range_specified = false; -if (!isset($_REQUEST['from_time']) || (isset($_REQUEST['from_time']) && $_REQUEST['from_time'] == '')) { - $from_time = '0000-01-01'; -} else { - $from_time = $_REQUEST['from_time']; - $time_range_specified = true; -} -if (!isset($_REQUEST['until_time']) || (isset($_REQUEST['until_time']) && $_REQUEST['until_time'] == '')) { - $until_time = '9999-12-31'; -} else { - $until_time = $_REQUEST['until_time']; - $time_range_specified = true; -} +// specify time range +include 'helpers/time_range.php'; // conference id/name are specified when searching specific conference(s) // either id OR name, id has precedence diff --git a/public_html/pages/participants.php b/public_html/pages/participants.php index 15aba56..3ca6521 100644 --- a/public_html/pages/participants.php +++ b/public_html/pages/participants.php @@ -7,20 +7,8 @@ require 'classes/participant.php'; require 'helpers/database.php'; $db = connectDB($config, 'jilo'); -// FIXME move thi sto a special function -$time_range_specified = false; -if (!isset($_REQUEST['from_time']) || (isset($_REQUEST['from_time']) && $_REQUEST['from_time'] == '')) { - $from_time = '0000-01-01'; -} else { - $from_time = $_REQUEST['from_time']; - $time_range_specified = true; -} -if (!isset($_REQUEST['until_time']) || (isset($_REQUEST['until_time']) && $_REQUEST['until_time'] == '')) { - $until_time = '9999-12-31'; -} else { - $until_time = $_REQUEST['until_time']; - $time_range_specified = true; -} +// specify time range +include 'helpers/time_range.php'; // participant id/name/IP are specified when searching specific participant(s) // participant name - this is 'stats_id' in the db