Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once("core.php"); |
| 3 | security::checkType(security::ADMIN); |
| 4 | |
| 5 | if (!security::checkParams("POST", [ |
| 6 | ["incidents", security::PARAM_ISARRAY] |
| 7 | ])) { |
| 8 | security::go("incidents.php?msg=empty"); |
| 9 | } |
| 10 | |
| 11 | $allOk = true; |
| 12 | foreach ($_POST["incidents"] as $id) { |
| 13 | $incident = incidents::get($id, true); |
| 14 | if ($incident === false) security::go($returnURL."msg=unexpected"); |
| 15 | |
| 16 | $istatus = incidents::getStatus($incident); |
| 17 | |
| 18 | if (in_array($istatus, incidents::$canRemoveStates)) { |
| 19 | if (!incidents::remove($id)) $allOk = false; |
| 20 | } elseif (in_array($istatus, incidents::$canInvalidateStates)) { |
| 21 | if (!incidents::invalidate($id)) $allOk = false; |
| 22 | } else $allOk = false; |
| 23 | } |
| 24 | |
| 25 | security::go("incidents.php?msg=deleteincidentsbulk".($allOk ? "success" : "partialsuccess")); |