diff options
author | msquare <msquare@notrademark.de> | 2016-09-30 16:55:47 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-09-30 16:55:47 +0200 |
commit | 1debe567f5f9fdeff5a2afbaa4619992da67f437 (patch) | |
tree | 285c426c316d726f5f5b05eac4a4af56448aebe4 /includes/controller/angeltypes_controller.php | |
parent | 9fce3b22aa76fe68abe81f36b46a763df0535aef (diff) |
simplify user_angeltype_add_controller
Diffstat (limited to 'includes/controller/angeltypes_controller.php')
-rw-r--r-- | includes/controller/angeltypes_controller.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 5607ea7c..cb2bb2fb 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -101,6 +101,7 @@ function angeltype_delete_controller() { function angeltype_edit_controller() { global $privileges, $user; + $angeltype = null; $name = ""; $restricted = false; $description = ""; @@ -266,4 +267,24 @@ function angeltypes_list_controller() { AngelTypes_list_view($angeltypes, in_array('admin_angel_types', $privileges)) ]; } + +/** + * Loads an angeltype from given angeltype_id request param. + */ +function load_angeltype() { + if (! isset($_REQUEST['angeltype_id'])) { + redirect(page_link_to('angeltypes')); + } + + $angeltype = AngelType($_REQUEST['angeltype_id']); + if ($angeltype === false) { + engelsystem_error("Unable to load angeltype."); + } + if ($angeltype == null) { + error(_("Angeltype doesn't exist.")); + redirect(page_link_to('angeltypes')); + } + + return $angeltype; +} ?> |