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