Files
ops-Gazelle/sections/requests/interim.php
T
2024-01-01 13:14:09 +01:00

25 lines
640 B
PHP

<?php
$request = (new Gazelle\Manager\Request)->findById((int)$_GET['id']);
if (is_null($request)) {
error(404);
}
$action = $_GET['action'];
if ($action === 'unfill') {
if (!in_array($Viewer->id(), [$request->userId(), $request->fillerId()]) && !$Viewer->permitted('site_moderate_requests')) {
error(403);
}
} elseif ($action === 'delete') {
if ($Viewer->id() != $request->userId() && !$Viewer->permitted('site_moderate_requests')) {
error(403);
}
} else {
error(0);
}
echo $Twig->render('request/interim.twig', [
'action' => $action,
'request' => $request,
'viewer' => $Viewer,
]);