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 | ["id", security::PARAM_NEMPTY] |
| 7 | ])) { |
| 8 | security::go("users.php?msg=unexpected"); |
| 9 | } |
| 10 | |
| 11 | $id = (int)$_POST["id"]; |
| 12 | |
| 13 | $s = schedules::get($id); |
| 14 | |
| 15 | if ($s === false) { |
| 16 | security::go("users.php?msg=unexpected"); |
| 17 | } |
| 18 | |
| 19 | $w = workers::get($s["worker"]); |
| 20 | |
| 21 | if ($w === false) { |
| 22 | security::go("users.php?msg=unexpected"); |
| 23 | } |
| 24 | |
| 25 | if (schedules::remove($id)) { |
| 26 | security::go("userschedule.php?id=".(int)$w["person"]."&msg=deleted"); |
| 27 | } else { |
| 28 | security::go("userschedule.php?id=".(int)$w["person"]."&msg=unexpected"); |
| 29 | } |