blob: d0706e4dc260ed5c2b93070484d3d659ecb1568f [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::ADMIN);
4
5if (!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);
18switch ($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}