blob: ab6df650bf7a17a8a63aaf99b0ae38879219a398 [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 ["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);
18switch ($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}