Improved access checks on client_delete.php.
authorNik Okuntseff <support@anuko.com>
Mon, 3 Dec 2018 17:46:41 +0000 (17:46 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 3 Dec 2018 17:46:41 +0000 (17:46 +0000)
WEB-INF/templates/footer.tpl
client_delete.php
mobile/client_delete.php

index 00e7a3f..ba7efd4 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4574 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4575 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 22ae9d4..a5f0065 100644 (file)
@@ -39,9 +39,13 @@ if (!$user->isPluginEnabled('cl')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $id = (int)$request->getParameter('id');
 $client = ttClientHelper::getClient($id);
+if (!$client) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
 
 $client_to_delete = $client['name'];
 
@@ -53,16 +57,13 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel')));
 
 if ($request->isPost()) {
-  if(ttClientHelper::getClient($id)) {
-    if ($request->getParameter('btn_delete')) {
-      if (ttClientHelper::delete($id, $request->getParameter('delete_client_entries'))) {
-        header('Location: clients.php');
-        exit();
-      } else
-        $err->add($i18n->get('error.db'));
-    }
-  } else
-    $err->add($i18n->get('error.db'));
+  if ($request->getParameter('btn_delete')) {
+    if (ttClientHelper::delete($id, $request->getParameter('delete_client_entries'))) {
+      header('Location: clients.php');
+      exit();
+    } else
+      $err->add($i18n->get('error.db'));
+  }
 
   if ($request->getParameter('btn_cancel')) {
     header('Location: clients.php');
index 154d893..8e05ccd 100644 (file)
@@ -39,9 +39,13 @@ if (!$user->isPluginEnabled('cl')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $id = (int)$request->getParameter('id');
 $client = ttClientHelper::getClient($id);
+if (!$client) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
 
 $client_to_delete = $client['name'];
 
@@ -53,16 +57,13 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel')));
 
 if ($request->isPost()) {
-  if(ttClientHelper::getClient($id)) {
-    if ($request->getParameter('btn_delete')) {
-      if (ttClientHelper::delete($id, $request->getParameter('delete_client_entries'))) {
-        header('Location: clients.php');
-        exit();
-      } else
-        $err->add($i18n->get('error.db'));
-    }
-  } else 
+  if ($request->getParameter('btn_delete')) {
+    if (ttClientHelper::delete($id, $request->getParameter('delete_client_entries'))) {
+      header('Location: clients.php');
+      exit();
+    } else
       $err->add($i18n->get('error.db'));
+  }
 
   if ($request->getParameter('btn_cancel')) {
     header('Location: clients.php');