X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=mobile%2Ftime_edit.php;h=a1a56e37ce22375bf112c55c554c38d936c648d2;hb=a575a9147976a06263d8a7eae006d6ba3372446e;hp=683bab74f32ec1db9936936ce2395006af489e2c;hpb=fd0872d9e582113346fa1e93557f370286c5c9f2;p=timetracker.git diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 683bab74..a1a56e37 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -34,11 +34,19 @@ import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); -// Access check. +// Access checks. if (!ttAccessAllowed('track_own_time')) { header('Location: access_denied.php'); exit(); } +$cl_id = (int)$request->getParameter('id'); +$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser()); +if (!$time_rec || $time_rec['invoice_id']) { + // Prohibit editing not ours or invoiced records. + header('Location: access_denied.php'); + exit(); +} +// End of access checks. // Use custom fields plugin if it is enabled. if ($user->isPluginEnabled('cf')) { @@ -47,14 +55,6 @@ if ($user->isPluginEnabled('cf')) { $smarty->assign('custom_fields', $custom_fields); } -$cl_id = $request->getParameter('id'); - -// Get the time record we are editing. -$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser()); - -// Prohibit editing invoiced records. -if ($time_rec['invoice_id']) die($i18n->get('error.sys')); - $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']); // Initialize variables.