Improved access checks for invoices.
authorNik Okuntseff <support@anuko.com>
Mon, 26 Mar 2018 17:09:46 +0000 (17:09 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 26 Mar 2018 17:09:46 +0000 (17:09 +0000)
WEB-INF/templates/footer.tpl
invoice_add.php
invoice_delete.php
invoice_send.php
invoice_view.php

index 3e9eb18..2aa36a2 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.17.73.4177 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.73.4178 | 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 5267056..ad9c3cf 100644 (file)
@@ -40,6 +40,7 @@ if (!$user->isPluginEnabled('iv')) {
   header('Location: feature_disabled.php');
   exit();
 }
+// End of access checks.
 
 if ($request->isPost()) {
   $cl_date = $request->getParameter('date');
index 2bca58c..ffdcf2c 100644 (file)
@@ -39,9 +39,14 @@ if (!$user->isPluginEnabled('iv')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $cl_invoice_id = (int)$request->getParameter('id');
 $invoice = ttInvoiceHelper::getInvoice($cl_invoice_id);
+if (!$invoice) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
+
 $invoice_to_delete = $invoice['name'];
 
 $form = new Form('invoiceDeleteForm');
index f0e30bc..20c3c18 100644 (file)
@@ -40,14 +40,15 @@ if (!$user->isPluginEnabled('iv')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $cl_invoice_id = (int)$request->getParameter('id');
-$invoice = ttInvoiceHelper::getInvoice($cl_invoice_id); 
-$sc = new ttSysConfig($user->id);
+$invoice = ttInvoiceHelper::getInvoice($cl_invoice_id);
+if (!$invoice) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
 
-// Security check.
-if (!$cl_invoice_id || !$invoice)
-  die ($i18n->get('error.sys'));
+$sc = new ttSysConfig($user->id);
 
 if ($request->isPost()) {
   $cl_receiver = trim($request->getParameter('receiver'));
index 62f0cbb..fd8424a 100644 (file)
@@ -41,15 +41,13 @@ if (!$user->isPluginEnabled('iv')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
-$cl_id = (int)$request->getParameter('id');
-$invoice = ttInvoiceHelper::getInvoice($cl_id);
-// Temporary fix for invalid invoice id. TODO: implement properly and review security of other pages,
-// where item id is passed (or posted) as parameter.
+$cl_invoice_id = (int)$request->getParameter('id');
+$invoice = ttInvoiceHelper::getInvoice($cl_invoice_id);
 if (!$invoice) {
   header('Location: access_denied.php');
   exit();
 }
+// End of access checks.
 
 $invoice_date = new DateAndTime(DB_DATEFORMAT, $invoice['date']);
 $client = ttClientHelper::getClient($invoice['client_id'], true);