<?
if ($_SESSION['username'] == "admin") {

if ($_POST['spaceQuota'] == "limited") {
	$spaceQuota = $str->fromHTML($_POST['spaceQuotaSize'])*1024*1024;
} else {
	$spaceQuota = "";
}

if ($_POST['trafficQuota'] == "limited") {
	$trafficQuota = $str->fromHTML($_POST['trafficQuotaSize'])*1024*1024;
} else {
	$trafficQuota = "";
}


$gid = $str->fromHTML($_GET['gid']);

$oldGroupInfo = $auth->getGroupInfo($gid);
$gid = $oldGroupInfo['id'];

$data['name'] = $oldGroupInfo['name'];
$data['path'] = ($settings->config['demomode'])?$settings->config['demorestrictedfolder']:cleanPath(rawurldecode($_POST['grouppath']));
$data['spacequota'] = $spaceQuota;
$data['trafficquota'] = $trafficQuota;
$data['upload'] = ($_POST['upload'])?"1":"0";
$data['download'] = ($_POST['download'])?"1":"0";
$data['readonly'] = ($_POST['notReadOnly'])?"0":"1";
$data['sendbyemail'] = ($_POST['sendbyemail'])?"1":"0";
$data['sharing'] = ($_POST['sharing'])?"1":"0";
$data['shareaccess'] = ($_POST['shareaccess'])?"1":"0";

$data['downloadnotice'] = ($_POST['downloadNotice'])?"1":"0";
$data['uploadnotice'] = ($_POST['uploadNotice'])?"1":"0";
$data['ui_type'] = ($_POST['ui_type'])?($_POST['ui_type']):"AFIAN_STANDARD";
$data['ui_has_tree'] = "1";


	if ($_POST['view_others'] == "specific") {
		$data['view_others'] = $str->fromHTML($_POST['view_others_specific']);
	} else {
		$data['view_others'] = $str->fromHTML($_POST['view_others']);
	}




if (strlen($data['path']) > 0 && !is_dir($data['path'])) {
	$msg = $lang->get("The path you have entered doesn't point to a valid folder.");
	$statusBarMessage[] = array($msg, 1);
} else {
	//$db->debug=1;
	$auth->updateGroup($gid, $data);
	//$db->debug=0;
	if (!$auth->errorMsg) {
		$log->act("0", "group update", $data['name']." (".$gid.")");
		$msg = $lang->get("Group \"%1\" updated", array($data['name']));
		$statusBarMessage[] = array($msg, 0);
		
	} else {
		$log->act("1", "group update", $_GET['group']."(".$gid."): ".$auth->errorMsg);
		$msg = $lang->get("Failed to update group \"%1\"", array($data['name']));
		$statusBarMessage[] = array($msg, 1);
	}
}


}
?>