From 704d09fab8234dda51765058b15393f6c68191f3 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 19 Jan 2018 16:30:22 +0000 Subject: [PATCH] More consistent use of isGet() and isPost() functions. --- WEB-INF/lib/html/HttpRequest.class.php | 8 ++++---- WEB-INF/templates/footer.tpl | 2 +- mobile/expenses.php | 4 ++-- mobile/time.php | 8 ++++---- mobile/timer.php | 2 +- reports.php | 2 +- time.php | 8 ++++---- week.php | 8 ++++---- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/WEB-INF/lib/html/HttpRequest.class.php b/WEB-INF/lib/html/HttpRequest.class.php index cd66a8cc..2eb26f0a 100644 --- a/WEB-INF/lib/html/HttpRequest.class.php +++ b/WEB-INF/lib/html/HttpRequest.class.php @@ -42,17 +42,17 @@ class ttHttpRequest { return ($this->getMethod() == 'POST'); } - // The getParameter is the primary function of this class. It returns request parameter, + // The getParameter is the primary function of this class. It returns request parameter // identified by $name. - function getParameter($name = "", $default = null) { + function getParameter($name = '', $default = null) { switch ($this->getMethod()) { case 'GET': - if (isset($_GET[$name]) && ($_GET[$name] != "")) + if (isset($_GET[$name]) && ($_GET[$name] != '')) return $_GET[$name]; case 'POST': - if (isset($_POST[$name]) && ($_POST[$name] != "")) + if (isset($_POST[$name]) && ($_POST[$name] != '')) return $_POST[$name]; } return $default; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index f994bf1b..af0b60e8 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.15.0.3760 | Copyright © Anuko | +  Anuko Time Tracker 1.15.0.3761 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/expenses.php b/mobile/expenses.php index fafe1373..790a7ace 100644 --- a/mobile/expenses.php +++ b/mobile/expenses.php @@ -54,9 +54,9 @@ $next_date = date('Y-m-d', strtotime('+1 day', strtotime($cl_date))); // Initialize variables. $on_behalf_id = $request->getParameter('onBehalfUser', (isset($_SESSION['behalf_id']) ? $_SESSION['behalf_id'] : $user->id)); -$cl_client = $request->getParameter('client', ($request->getMethod()=='POST' ? null : @$_SESSION['client'])); +$cl_client = $request->getParameter('client', ($request->isPost() ? null : @$_SESSION['client'])); $_SESSION['client'] = $cl_client; -$cl_project = $request->getParameter('project', ($request->getMethod()=='POST' ? null : @$_SESSION['project'])); +$cl_project = $request->getParameter('project', ($request->isPost() ? null : @$_SESSION['project'])); $_SESSION['project'] = $cl_project; $cl_item_name = $request->getParameter('item_name'); $cl_cost = $request->getParameter('cost'); diff --git a/mobile/time.php b/mobile/time.php index db8aa34b..0c634f3a 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -66,7 +66,7 @@ $cl_finish = trim($request->getParameter('finish')); $cl_duration = trim($request->getParameter('duration')); $cl_note = trim($request->getParameter('note')); // Custom field. -$cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1']))); +$cl_cf_1 = trim($request->getParameter('cf_1', ($request->isPost() ? null : @$_SESSION['cf_1']))); $_SESSION['cf_1'] = $cl_cf_1; $cl_billable = 1; if ($user->isPluginEnabled('iv')) { @@ -77,11 +77,11 @@ if ($user->isPluginEnabled('iv')) { if (isset($_SESSION['billable'])) $cl_billable = $_SESSION['billable']; } -$cl_client = $request->getParameter('client', ($request->getMethod()=='POST'? null : @$_SESSION['client'])); +$cl_client = $request->getParameter('client', ($request->isPost() ? null : @$_SESSION['client'])); $_SESSION['client'] = $cl_client; -$cl_project = $request->getParameter('project', ($request->getMethod()=='POST'? null : @$_SESSION['project'])); +$cl_project = $request->getParameter('project', ($request->isPost() ? null : @$_SESSION['project'])); $_SESSION['project'] = $cl_project; -$cl_task = $request->getParameter('task', ($request->getMethod()=='POST'? null : @$_SESSION['task'])); +$cl_task = $request->getParameter('task', ($request->isPost() ? null : @$_SESSION['task'])); $_SESSION['task'] = $cl_task; // Elements of timeRecordForm. diff --git a/mobile/timer.php b/mobile/timer.php index cdb32c7b..1fa6c137 100644 --- a/mobile/timer.php +++ b/mobile/timer.php @@ -61,7 +61,7 @@ if ($user->isPluginEnabled('cf')) { $cl_start = trim($request->getParameter('browser_time')); $cl_finish = trim($request->getParameter('browser_time')); // Custom field. -$cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1']))); +$cl_cf_1 = trim($request->getParameter('cf_1', ($request->isPost() ? null : @$_SESSION['cf_1']))); $_SESSION['cf_1'] = $cl_cf_1; $cl_billable = 1; if ($user->isPluginEnabled('iv')) { diff --git a/reports.php b/reports.php index f6d9cf05..710de524 100644 --- a/reports.php +++ b/reports.php @@ -231,7 +231,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->ge $bean = new ActionForm('reportBean', $form, $request); // At this point form values are obtained from session if they are there. -if (($request->getMethod() == 'GET') && !$bean->isSaved()) { +if ($request->isGet() && !$bean->isSaved()) { // No previous form data were found in session. Use the following default values. $form->setValueByElement('users', array_keys($user_list)); $period = new Period(INTERVAL_THIS_MONTH, new DateAndTime($user->date_format)); diff --git a/time.php b/time.php index c001f21f..caab2bd7 100644 --- a/time.php +++ b/time.php @@ -81,7 +81,7 @@ $cl_finish = trim($request->getParameter('finish')); $cl_duration = trim($request->getParameter('duration')); $cl_note = trim($request->getParameter('note')); // Custom field. -$cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1']))); +$cl_cf_1 = trim($request->getParameter('cf_1', ($request->isPost() ? null : @$_SESSION['cf_1']))); $_SESSION['cf_1'] = $cl_cf_1; $cl_billable = 1; if ($user->isPluginEnabled('iv')) { @@ -93,11 +93,11 @@ if ($user->isPluginEnabled('iv')) { $cl_billable = $_SESSION['billable']; } $on_behalf_id = $request->getParameter('onBehalfUser', (isset($_SESSION['behalf_id'])? $_SESSION['behalf_id'] : $user->id)); -$cl_client = $request->getParameter('client', ($request->getMethod()=='POST'? null : @$_SESSION['client'])); +$cl_client = $request->getParameter('client', ($request->isPost() ? null : @$_SESSION['client'])); $_SESSION['client'] = $cl_client; -$cl_project = $request->getParameter('project', ($request->getMethod()=='POST'? null : @$_SESSION['project'])); +$cl_project = $request->getParameter('project', ($request->isPost() ? null : @$_SESSION['project'])); $_SESSION['project'] = $cl_project; -$cl_task = $request->getParameter('task', ($request->getMethod()=='POST'? null : @$_SESSION['task'])); +$cl_task = $request->getParameter('task', ($request->isPost() ? null : @$_SESSION['task'])); $_SESSION['task'] = $cl_task; // Elements of timeRecordForm. diff --git a/week.php b/week.php index 5db40a25..16fd79ba 100644 --- a/week.php +++ b/week.php @@ -89,7 +89,7 @@ if ($user->isPluginEnabled('mq')){ // Initialize variables. // Custom field. -$cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1']))); +$cl_cf_1 = trim($request->getParameter('cf_1', ($request->isPost() ? null : @$_SESSION['cf_1']))); $_SESSION['cf_1'] = $cl_cf_1; $cl_billable = 1; if ($user->isPluginEnabled('iv')) { @@ -101,11 +101,11 @@ if ($user->isPluginEnabled('iv')) { $cl_billable = $_SESSION['billable']; } $on_behalf_id = $request->getParameter('onBehalfUser', (isset($_SESSION['behalf_id'])? $_SESSION['behalf_id'] : $user->id)); -$cl_client = $request->getParameter('client', ($request->getMethod()=='POST'? null : @$_SESSION['client'])); +$cl_client = $request->getParameter('client', ($request->isPost() ? null : @$_SESSION['client'])); $_SESSION['client'] = $cl_client; -$cl_project = $request->getParameter('project', ($request->getMethod()=='POST'? null : @$_SESSION['project'])); +$cl_project = $request->getParameter('project', ($request->isPost() ? null : @$_SESSION['project'])); $_SESSION['project'] = $cl_project; -$cl_task = $request->getParameter('task', ($request->getMethod()=='POST'? null : @$_SESSION['task'])); +$cl_task = $request->getParameter('task', ($request->isPost() ? null : @$_SESSION['task'])); $_SESSION['task'] = $cl_task; // Get the data we need to display week view. -- 2.20.1