blob: 2f706d36cc34b075a8178aeb3365756111a35e37 [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 ["emails", security::PARAM_ISSET],
8 ["parent", security::PARAM_ISSET]
9])) {
10 security::go("categories.php?msg=empty");
11}
12
13$name = $_POST["name"];
14$emails = $_POST["emails"];
15$parent = (int)$_POST["parent"];
16
17if (categories::add($name, $emails, $parent)) {
18 security::go("categories.php?msg=added");
19} else {
20 security::go("categories.php?msg=unexpected");
21}