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_ISINT], |
| 7 | ["begins", security::PARAM_ISDATE], |
| 8 | ["ends", security::PARAM_ISDATE] |
| 9 | ])) { |
| 10 | security::go((isset($_POST["id"]) ? "schedule.php?id=".(int)$_POST["id"]."msg=empty" : "users.php")); |
| 11 | } |
| 12 | |
| 13 | $id = $_POST["id"]; |
| 14 | $begins = $_POST["begins"]; |
| 15 | $ends = $_POST["ends"]; |
| 16 | |
| 17 | $status = schedules::edit($id, $begins, $ends); |
| 18 | switch ($status) { |
| 19 | case 0: |
| 20 | security::go("schedule.php?id=".(int)$id."&msg=modified"); |
| 21 | break; |
| 22 | |
| 23 | case 1: |
| 24 | security::go("schedule.php?id=".(int)$id."&msg=overlaps"); |
| 25 | break; |
| 26 | |
| 27 | case 3: |
| 28 | security::go("schedule.php?id=".(int)$id."&msg=order"); |
| 29 | break; |
| 30 | |
| 31 | default: |
| 32 | security::go("schedule.php?id=".(int)$id."&msg=unexpected"); |
| 33 | break; |
| 34 | } |