blob: 0f79981d36a29417c16b4f3af3e0b09b69afa666 [file] [log] [blame]
<?php
require_once("core.php");
security::checkType(security::WORKER, security::METHOD_NOTFOUND);
security::checkWorkerUIEnabled();
$url = (security::isAllowed(security::ADMIN) ? "incidents.php" : "userincidents.php?id=".(int)$_SESSION["id"]);
if (!security::checkParams("POST", [
["id", security::PARAM_ISINT],
["name", security::PARAM_NEMPTY]
])) {
security::go(visual::getContinueUrl($url, "unexpected", "POST"));
}
$id = (int)$_POST["id"];
$name = $_POST["name"];
$incident = incidents::get($id, true);
if ($incident === false) security::go(visual::getContinueUrl($url, "unexpected", "POST"));
if (!security::isAllowed(security::ADMIN)) incidents::checkIncidentIsFromPerson($incident["id"]);
security::go(visual::getContinueUrl($url, (incidents::deleteAttachment($id, $name) ? "attachmentdeleted" : "unexpected"), "POST"));