Subversion Repositories ALCASAR

Rev

Rev 841 | Go to most recent revision | Blame | Last modification | View Log

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy - 3abtux -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Exceptions</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
<?
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
$domain_allowed_list="/usr/local/etc/alcasar-uamdomain";
$url_allowed_list="/usr/local/etc/alcasar-uamallowed";
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
  $l_error_open_file = "Erreur d'ouverture du fichier";
  $l_trusted_sites = "Noms de domaine et adresses IP Internet de confiance";
  $l_trusted_sites_explain1 = "Entrez ici les noms de domaine ou les adresses IP situés sur Internet pouvant &ecirc;tre joints sans authentification";
  $l_trusted_sites_explain2 = "Entrez un nom de domaine ou une adresse IP par ligne";
  $l_trusted_sites_list = "Liste des noms de domaine de confiance";
  $l_trusted_urls_list = "Liste d'adresses IP ou d'adresses de réseau de confiance";
  $l_submit = "Enregistrer";
}
else {
  $l_error_open_file = "File open error";
  $l_trusted_sites = "Trusted Internet domain names and IP addresses";
  $l_trusted_sites_explain1 = "Enter domain names or IP addresses situated on Internet that could be joined without authentication";
  $l_trusted_sites_explain2 = "Enter one domain name ou one IP address per line";
  $l_trusted_sites_list = "Trusted Internet domain names list";
  $l_trusted_urls_list = "Trusted IP addresses or networks addresses list";
  $l_submit = "Submit";
}
if (isset($_POST['choix'])){ 
        switch ($_POST['choix'])
        {
        case 'MAJ_UAMALLOWED' :
                $tab_domains = explode ("\n", $_POST['trusted_domains']);
                $fichier=fopen($domain_allowed_list,"w+");
                foreach ($tab_domains as $domain ){
                        $tr_domain=trim($domain);
                        if ($tr_domain != ""){
                                fputs ($fichier, "uamdomain=\"".$tr_domain."\"\n");}
                        }       
                fclose($fichier);
                unset($_POST['trusted_domains']);
                $tab_urls = explode ("\n", $_POST['trusted_urls']);
                $fichier=fopen($url_allowed_list,"w+");
                foreach ($tab_urls as $url ){
                        $tr_url=trim($url);
                        if ($tr_url != ""){
                                fputs ($fichier, "uamallowed=\"".$tr_url."\"\n");}
                        }
                fclose($fichier);
                unset($_POST['trusted_urls']);
                exec ("sudo service chilli restart");
                unset ($_POST['choix']);
                break;
        }       
}
?>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><th><?php echo $l_trusted_sites ;?></th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
        <tr bgcolor="#666666"><td>
        <TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
                <tr><td valign="middle" align="left">
                <center><?php
                echo "$l_trusted_sites_explain1 <BR>";
                echo "$l_trusted_sites_explain2" ;
                echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
                <TABLE cellspacing=2 cellpadding=3 border=1>
                <tr><td width=50% height=100% align=center>
                        <H3><?php echo $l_trusted_sites_list ;?></H3>
                        exemple1 : www.domain1.org<BR>
                        exemple2 : domain2.net<BR>
                        <?php
                                echo "<textarea name='trusted_domains' rows=5 cols=40>";
                                $ouvre=fopen($domain_allowed_list,"r");
                                if ($ouvre)
                                        {
                                        while (!feof ($ouvre))
                                                {
                                                $tampon = fgets($ouvre, 4096);
                                                $domain_list_l = substr($tampon,10);
                                                $domain_list = trim ($domain_list_l,"\"\n\t ");
                                                $tab_domains = explode (",", $domain_list);
                                                foreach ($tab_domains as $domain ){
                                                        if ($domain) { echo $domain."\n";}
                                                        }
                                                }
                                        }
                                else    {
                                        echo "failed to open $domain_allowed_list";
                                        }
                                fclose($ouvre);
                                echo "</textarea>";
                        ?>
                </td>
                <td  width=50% height=100% align=center>
                        <H3><?php echo $l_trusted_urls_list ;?></H3>
                        exemple1 : 192.168.0.10<BR>
                        exemple2 : 172.16.20.0/24<BR>
                        <?php
                                echo "<textarea name='trusted_urls' rows=5 cols=40>";
                                $ouvre=fopen($url_allowed_list,"r");
                                if ($ouvre)
                                        {
                                        while (!feof ($ouvre))
                                                {
                                                $tampon = fgets($ouvre, 4096);
                                                $url_list_l = substr($tampon,11);
                                                $url_list = trim ($url_list_l,"\"\n\t ");
                                                $tab_urls = explode (",", $url_list);
                                                foreach ($tab_urls as $url ){
                                                        if ($url) echo $url."\n";
                                                        }
                                                }
                                        }
                                else    {
                                        echo "failed to open $url_allowed_list";
                                        }
                                fclose($ouvre);
                                echo "</textarea>";
                        ?>
                </td></tr>
                </TABLE>
                <input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
                <input type='submit' value='<?php echo $l_submit ;?>'>
                </FORM>
        </td></tr>
        </TABLE>
</TABLE>
</BODY>
</HTML>