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