From b4b57ea6a41c263250715f72248d48eae22f5476 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 22 Mar 2016 10:08:02 -0700 Subject: [PATCH] Introduced isPost() function to keep things shorter --- WEB-INF/lib/html/HttpRequest.class.php | 7 ++++++- WEB-INF/templates/footer.tpl | 2 +- admin_team_add.php | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/WEB-INF/lib/html/HttpRequest.class.php b/WEB-INF/lib/html/HttpRequest.class.php index 84081c71..cea61226 100644 --- a/WEB-INF/lib/html/HttpRequest.class.php +++ b/WEB-INF/lib/html/HttpRequest.class.php @@ -31,7 +31,12 @@ class ttHttpRequest { function getMethod() { return isset( $_SERVER['REQUEST_METHOD'] ) ? $_SERVER['REQUEST_METHOD'] : false; } - + + // The isPost function determines if a request method is POST. + function isPost() { + return ($this->getMethod() == 'POST'); + } + // The getParameter is the primary function of this class. It returns request parameter, // identified by $name. function getParameter($name = "", $default = null) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 37694d09..5d0b9ca4 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.16.3433 | Copyright © Anuko | +  Anuko Time Tracker 1.9.16.3434 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/admin_team_add.php b/admin_team_add.php index 5ece36dc..06f19bcf 100644 --- a/admin_team_add.php +++ b/admin_team_add.php @@ -36,7 +36,7 @@ if (!ttAccessCheck(right_administer_site)) { exit(); } -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { $cl_team_name = trim($request->getParameter('team_name')); $cl_manager_name = trim($request->getParameter('manager_name')); $cl_manager_login = trim($request->getParameter('manager_login')); @@ -58,7 +58,7 @@ if (!$auth->isPasswordExternal()) { $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_email','value'=>$cl_manager_email)); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit'))); -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { // Validate user input. if (!ttValidString($cl_team_name, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name')); if (!ttValidString($cl_manager_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name')); @@ -93,7 +93,7 @@ if ($request->getMethod() == 'POST') { } else $errors->add($i18n->getKey('error.user_exists')); } -} // POST +} // isPost $smarty->assign('auth_external', $auth->isPasswordExternal()); $smarty->assign('forms', array($form->getName()=>$form->toArray())); -- 2.20.1