X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/30f870da6d0f5d73cd6f33ab284ff45559d1ee13..35a538725eb9bc8a651a012a7bccc546aa22e6b2:/notification_add.php diff --git a/notification_add.php b/notification_add.php index e30970af..f1221117 100644 --- a/notification_add.php +++ b/notification_add.php @@ -42,11 +42,24 @@ if (!$user->isPluginEnabled('no')) { header('Location: feature_disabled.php'); exit(); } +if (!$user->exists()) { + header('Location: access_denied.php'); // No users in subgroup. + exit(); +} +if ($request->isPost()) { + // TODO: improve this, perhaps by refactoring elsewhere. + $cl_fav_report = (int) $request->getParameter('fav_report'); + $fav_report = ttFavReportHelper::getReport($cl_fav_report); + if ($user->getUser() != $fav_report['user_id']) { + header('Location: access_denied.php'); // Invalid fav report id in post. + exit(); + } +} +// End of access checks. -$fav_reports = ttFavReportHelper::getReports($user->id); +$fav_reports = ttFavReportHelper::getReports($user->getUser()); if ($request->isPost()) { - $cl_fav_report = trim($request->getParameter('fav_report')); $cl_cron_spec = trim($request->getParameter('cron_spec')); $cl_email = trim($request->getParameter('email')); $cl_cc = trim($request->getParameter('cc')); @@ -86,7 +99,6 @@ if ($request->isPost()) { $next = tdCron::getNextOccurrence($cl_cron_spec, mktime()); if (ttNotificationHelper::insert(array( - 'group_id' => $user->group_id, 'cron_spec' => $cl_cron_spec, 'next' => $next, 'report_id' => $cl_fav_report,