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 | ["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 | |
| 17 | if (categories::add($name, $emails, $parent)) { |
| 18 | security::go("categories.php?msg=added"); |
| 19 | } else { |
| 20 | security::go("categories.php?msg=unexpected"); |
| 21 | } |