From: Nik Okuntseff Date: Wed, 28 Nov 2018 20:00:35 +0000 (+0000) Subject: Refactoring in ttAdmin class. X-Git-Tag: timetracker_1.19-1~531 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fd6aa4c43cecf1754280ae8abb9f58add8c6c977;p=timetracker.git Refactoring in ttAdmin class. --- diff --git a/WEB-INF/lib/ttAdmin.class.php b/WEB-INF/lib/ttAdmin.class.php index 747274f1..3b6b008a 100644 --- a/WEB-INF/lib/ttAdmin.class.php +++ b/WEB-INF/lib/ttAdmin.class.php @@ -344,7 +344,7 @@ class ttAdmin { } // getGroupDetails obtains group name and its top manager details. - function getGroupDetails($group_id) { + static function getGroupDetails($group_id) { $result = array(); $mdb2 = getConnection(); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index ae1e68c7..0cafe7ee 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.28.4534 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4535 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/admin_group_delete.php b/admin_group_delete.php index 7c7df615..fea57365 100644 --- a/admin_group_delete.php +++ b/admin_group_delete.php @@ -35,13 +35,13 @@ if (!ttAccessAllowed('administer_site')) { header('Location: access_denied.php'); exit(); } -// End of access checks. - $group_id = (int)$request->getParameter('id'); - -$admin = new ttAdmin(); -$group_details = $admin->getGroupDetails($group_id); -$group_name = $group_details['group_name']; +$group_details = ttAdmin::getGroupDetails($group_id); +if (!($group_id && $group_details)) { + header('Location: access_denied.php'); + exit(); +} +// End of access checks. $form = new Form('groupForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$group_id)); @@ -50,8 +50,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get( if ($request->isPost()) { if ($request->getParameter('btn_delete')) { - $result = $admin->markGroupDeleted($group_id); - if ($result) { + if (ttAdmin::markGroupDeleted($group_id)) { header('Location: admin_groups.php'); exit(); } else @@ -64,7 +63,7 @@ if ($request->isPost()) { } } // isPost -$smarty->assign('group_to_delete', $group_name); +$smarty->assign('group_to_delete', $group_details['group_name']); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('title', $i18n->get('title.delete_group')); $smarty->assign('content_page_name', 'admin_group_delete.tpl');