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 | ["name", security::PARAM_NEMPTY] |
| 7 | ])) { |
| 8 | security::go("incidenttypes.php?msg=empty"); |
| 9 | } |
| 10 | |
| 11 | $name = $_POST["name"]; |
| 12 | $present = ((isset($_POST["present"]) && $_POST["present"] == 1) ? 1 : 0); |
| 13 | $paid = ((isset($_POST["paid"]) && $_POST["paid"] == 1) ? 1 : 0); |
| 14 | $workerfill = ((isset($_POST["workerfill"]) && $_POST["workerfill"] == 1) ? 1 : 0); |
| 15 | $notifies = ((isset($_POST["notifies"]) && $_POST["notifies"] == 1) ? 1 : 0); |
| 16 | $autovalidates = ((isset($_POST["autovalidates"]) && $_POST["autovalidates"] == 1) ? 1 : 0); |
| 17 | $hidden = ((isset($_POST["hidden"]) && $_POST["hidden"] == 1) ? 1 : 0); |
| 18 | |
| 19 | if (incidents::addType($name, $present, $paid, $workerfill, $notifies, $autovalidates, $hidden)) { |
| 20 | security::go("incidenttypes.php?msg=added"); |
| 21 | } else { |
| 22 | security::go("incidenttypes.php?msg=unexpected"); |
| 23 | } |