Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('group_add')) { //access allowed } else { echo "access denied"; return; } //add multi-lingual support $language = new text; $text = $language->get(); //get the http values and set them as variables if (count($_POST) > 0) { //set the variables $group_name = $_POST["group_name"]; if (permission_exists('group_domain')) { $domain_uuid = $_POST["domain_uuid"]; } else { $domain_uuid = $_SESSION['domain_uuid']; } $group_description = $_POST["group_description"]; //check for global/domain duplicates $sql = "select count(*) from v_groups where "; $sql .= "group_name = :group_name "; if (is_uuid($domain_uuid)) { $sql .= "and domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; } else { $sql .= "and domain_uuid is null "; } $parameters['group_name'] = $group_name; $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); $group_exists = ($num_rows > 0) ? true : false; unset($sql, $parameters, $num_rows); //insert group if (!$group_exists) { $array['groups'][0]['group_uuid'] = uuid(); $array['groups'][0]['domain_uuid'] = is_uuid($domain_uuid) ? $domain_uuid : null; $array['groups'][0]['group_name'] = $group_name; $array['groups'][0]['group_description'] = $group_description; $database = new database; $database->app_name = 'groups'; $database->app_uuid = '2caf27b0-540a-43d5-bb9b-c9871a1e4f84'; $database->save($array); unset($array); message::add($text['message-add']); header("Location: groups.php"); } else { message::add($text['message-group_exists'], 'negative'); header("Location: groupadd.php"); } //redirect the user return; } //include the header include "resources/header.php"; $document['title'] = $text['title-group_add']; //show the content echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['header-group_add']."\n"; echo "

\n"; echo " ".$text['description-group_add']."\n"; echo "
\n"; echo " "; echo " \n"; echo "
\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if (permission_exists('group_domain')) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo $text['label-group_name']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo " ".$text['label-domain']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo $text['description-domain_name']."\n"; echo "
\n"; echo $text['label-group_description']."\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
"; echo " \n"; echo "
\n"; echo "

"; echo "
"; //include the footer include "resources/footer.php"; ?>