Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3178 → Rev 3179

/web/acc/admin/bl_categories_help.php
10,13 → 10,11
$wl_unbound_dir="/usr/local/share/unbound-wl/";
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2));
}
if($Language == 'fr')
{
if($Language == 'fr'){
$l_title = "Catégories de la liste noire";
$l_error_open_file="Erreur d'ouverture du fichier";
$l_close="Fermer";
53,107 → 51,54
$l_error_cat = "Error category";
$l_error_list = "Error listing";
}
if(isset($_GET['cat']))
{
if(isset($_GET['cat'])){
$categorie = $_GET['cat'];
}
else
{
else {
$categorie = $l_error_cat;
}
if(isset($_GET['liste']))
{
$liste = $_GET['liste'];
$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
$bl_categorie_url_file = $bl_dir.$categorie."/urls";
$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
//don't calc again on reload (click on the number of domain/urls/ip)
if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip'])){
$nb_domains = $_GET['nb_domains'];
$nb_urls = $_GET['nb_urls'];
$nb_ip = $_GET['nb_ip'];
}
else
{
$liste = $l_error_list;
}
if($liste == "bl")
{
$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
$bl_categorie_url_file = $bl_dir.$categorie."/urls";
$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
//don't calc again on reload (click on the number of domain/urls/ip)
if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
{
$nb_domains = $_GET['nb_domains'];
$nb_urls = $_GET['nb_urls'];
$nb_ip = $_GET['nb_ip'];
}
else
{
if (file_exists($bl_categorie_domain_file))
{
else {
if (file_exists($bl_categorie_domain_file)){
# two lines per domain
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2;
}
else
{
else {
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
}
 
if (file_exists($bl_categorie_url_file))
{
if (file_exists($bl_categorie_url_file)){
$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
}
else
{
else {
$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
}
 
if(file_exists($bl_categorie_ip_file))
{
if(file_exists($bl_categorie_ip_file)){
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
}
else
{
else {
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
}
}
}
else
{
$wl_categorie_domain_file = $wl_unbound_dir.$categorie.".conf";
$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
if (file_exists($wl_categorie_domain_file))
{
$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
}
else
{
$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
}
 
if (file_exists($wl_categorie_ip_file))
{
$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
}
else
{
$nb_ip = 0;
//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
}
 
$nb_urls = 0; //no urls in WL
}
$global_usage = file($bl_dir."global_usage");
$langue = strtoupper($Language);
if(isset($categorie))
{
if(isset($categorie)){
$fin1 = 0; $fin2 = 0;
foreach ($global_usage as $line)
{
if(preg_match("#^NAME:.$categorie$#", $line) == 1)
{
foreach ($global_usage as $line){
if(preg_match("#^NAME:.$categorie$#", $line) == 1){
$fin1 = 1;
}
if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
{
if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1){
$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
}
if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
{
if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1){
$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
$fin2 = 1;
}
172,23 → 117,12
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
<tr><td valign="middle" align="left">
<?php
if(isset($_GET["filtre"]))
{
$filtre = $_GET["filtre"];
}
else
{
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
}
$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
$compat_categorie=strtr($categorie,"-","_");
echo "<br><center><b>$l_name_cat</b></center>";
echo "<center><b>$l_description_cat</b></center><br>";
echo "$l_nb_domains <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_domain&titre=domain&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_domains</a></b><br>";
echo "$l_nb_urls <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_url&titre=url&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_urls</a></b><br>";
echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_ip</a></b><br>";
echo "$l_nb_domains <b><a href='?cat=$categorie&filtre=$bl_categorie_domain_file&titre=domain&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_domains</a></b><br>";
echo "$l_nb_urls <b><a href='?cat=$categorie&filtre=$bl_categorie_url_file&titre=url&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_urls</a></b><br>";
echo "$l_nb_ip <b><a href='?cat=$categorie&filtre=$bl_categorie_ip_file&titre=ip&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_ip</a></b><br>";
?>
</td></tr>
</TABLE>
196,12 → 130,10
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th>
<?php
if(isset($_GET["titre"]))
{
if(isset($_GET["titre"])){
$titre = $_GET["titre"];
}
else
{
else {
$titre = "domain";
}
echo $l_example.$titre;
212,23 → 144,16
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
<tr><td valign="middle" align="left">
<?php
if($titre == "domain")
{
 
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
exec("head -n 15 ".escapeshellarg($filtre)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
if($titre == "domain"){
exec("head -n 15 ".escapeshellarg($bl_categorie_domain_file)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
}
elseif($titre == "ip")
{
$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat);
elseif($titre == "ip"){
exec("head -n 15 ".escapeshellarg($bl_categorie_ip_file)." | cut -d ' ' -f3", $resultat);
}
else
{
exec("head -n 15 ".escapeshellarg($filtre), $resultat);
else {
exec("head -n 15 ".escapeshellarg($bl_categorie_ip_file), $resultat);
}
for($i=0; $i<count($resultat); $i++)
{
for($i=0; $i<count($resultat); $i++){
echo $resultat[$i]."<br/>";
}
?>