<?php
include_once('ressources/class.templates.inc');
session_start();
if(!isset($_SESSION["uid"])){header('location:logon.php');exit;}

if(isset($_GET["ADD_PAGE"])){ADD_PAGE();exit;}
if(isset($_GET["EDIT_PAGE"])){ADD_PAGE();exit;}
if(isset($_GET["DeleteHeaderRule"])){DeleteHeaderRule();exit;}
if(isset($_GET["AddFilterRule"])){AddFilterRule();exit;}
INDEX();


function INDEX(){
	
	$html="<div style='text-align:right'><input type='button' value='&laquo;&nbsp;{add_a_rule}&nbsp;&raquo;' OnClick=\"javascript:AddNewRegxRule();\"></div>".Tableau();
	
	
	
$JS["JS"][]="js/regex.rules.js";
$tpl=new template_users('{content_rules}',$html,0,0,0,0,$JS);
echo $tpl->web_page;		
	
}

function ADD_PAGE(){
	
	
	if(isset($_GET["EDIT_PAGE"])){
		$ldap=new clladp();
		$hash=$ldap->UserDatas($_SESSION["uid"]);	
		if(preg_match('#<header>(.+?)</header><pattern>(.+?)</pattern><regex>(.+?)</regex><action>(.+?)</action>#',$hash["RegexRules"][$_GET["EDIT_PAGE"]],$reg)){
include_once 'ressources/class.templates.inc';
session_start();
if (!isset($_SESSION["uid"])) {
    header('location:logon.php');
    exit;
}
if (isset($_GET["ADD_PAGE"])) {
    ADD_PAGE();
    exit;
}
if (isset($_GET["EDIT_PAGE"])) {
    ADD_PAGE();
    exit;
}
if (isset($_GET["DeleteHeaderRule"])) {
    DeleteHeaderRule();
    exit;
}
if (isset($_GET["AddFilterRule"])) {
    AddFilterRule();
    exit;
}
INDEX();
function INDEX()
{
    $html = "<div style='text-align:right'><input type='button' value='&laquo;&nbsp;{add_a_rule}&nbsp;&raquo;' OnClick=\"javascript:AddNewRegxRule();\"></div>" . Tableau();
    $JS["JS"][] = "js/regex.rules.js";
    $tpl = new template_users('{content_rules}', $html, 0, 0, 0, 0, $JS);
    echo $tpl->web_page;
}
function ADD_PAGE()