header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
$user = new usersMenus();
if (!$user->AsDansGuardianAdministrator) {
    $tpl = new templates();
    FATAL_ERROR_SHOW_128("{ERROR_NO_PRIVS}");
    exit;
}
if (isset($_GET["rule-js"])) {
    rule_js();
    exit;
}
if (isset($_GET["delete-js"])) {
    rule_delete_js();
    exit;
}
if (isset($_GET["list"])) {
    rules_list();
    exit;
}
if (isset($_GET["rule-popup"])) {
    rule_popup();
    exit;
}
if (isset($_POST["rule"])) {
    rule_save();
    exit;
}
if (isset($_POST["delete"])) {
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.dansguardian.inc');
	header("Pragma: no-cache");	
	header("Expires: 0");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-cache, must-revalidate");	
	$user=new usersMenus();
	if(!$user->AsDansGuardianAdministrator){
		$tpl=new templates();
		FATAL_ERROR_SHOW_128("{ERROR_NO_PRIVS}");
		exit;
		
	}
	if(isset($_GET["rule-js"])){rule_js();exit;}
	if(isset($_GET["delete-js"])){rule_delete_js();exit;}
	if(isset($_GET["list"])){rules_list();exit;}
	if(isset($_GET["rule-popup"])){rule_popup();exit;}
	if(isset($_POST["rule"])){rule_save();exit;}
	if(isset($_POST["delete"])){rule_delete();exit;}
	
table();


function rule_delete_js(){
	header("content-type: application/x-javascript");
	$md5=$_GET["delete-js"];
	$page=CurrentPageName();
	$tpl=new templates();
	$q=new mysql_squid_builder();
	$txt=$tpl->javascript_parse_text("{delete}");