<?php
$locale->setSection("Admin: Groups");

if (!$users->userPerms->canDeleteGroups()) {
	jsonFeedback(false, "You are not allowed to delete groups.");
}

$groupId = $str->fromHTML($_REQUEST['id']);
$groupInfo = $groups->selectOne("*", array("id", "=", "'".$groupId."'"));

if (!$users->userPerms->canManageGroup($groupInfo)) {
	jsonFeedback(false, "You are not allowed to manage this group.");
}

if ($config['misc']['demoMode']) {
	jsonFeedback(false, "Action unavailable in this demo version of the software!");
} else {
	$rs = $groups->deleteGroup($groupId);
	if ($rs) {
		jsonFeedback(true, "Group succcessfuly deleted!");
	} else {
		jsonFeedback(false, "Failed to delete group!");
	}
}
?>