Subversion Repositories ALCASAR

Rev

Rev 1325 | Rev 1377 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
318 richard 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<?
6
$bl_dir="/etc/dansguardian/lists/blacklists/";
1332 richard 7
$bl_iptables_dir="/usr/local/share/iptables-bl/";
8
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
9
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-wl/";
318 richard 10
# Choice of language
11
$Language = 'en';
1332 richard 12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
13
{
14
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
	 $Language = strtolower(substr(chop($Langue[0]),0,2));
318 richard 16
}
1332 richard 17
if($Language == 'fr')
18
{
19
	 $l_title = "Catégories de la liste noire";
20
	 $l_error_open_file="Erreur d'ouverture du fichier";
21
	 $l_close="Fermer";
22
	 $l_description_cat="Cette catégorie n'est pas décrite";
23
	 $l_description_ossi="Catégorie personnelle";
24
	 $l_nb_domains="Nombre de noms de domaine filtrés :";
25
	 $l_nb_urls="Nombre d'URL filtrés :";
26
	 $l_nb_ip="Nombre d'IP filtrées :";
27
	 $l_example="Exemple(s) : ";
318 richard 28
}
29
else
1332 richard 30
{
31
	$l_title = "Blacklist categories";
32
	$l_error_open_file="Error opening the file";
33
	$l_close="Close";
34
	$l_description_cat="This category isn't describe";
35
	$l_description_ossi="Personal category";
36
	$l_nb_domains="Number of filtered domain names :";
37
	$l_nb_urls="Number of filtered URL :";
38
	$l_nb_ip="Number of filtered IP :";
39
	$l_example="Example(s) : ";
40
}
41
if(isset($_GET['cat']))
42
{
43
	$categorie = $_GET['cat'];
44
} 
45
if(isset($_GET['liste']))
46
{
47
	$liste = $_GET['liste'];
48
}
49
if($liste == "bl")
50
{
51
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
52
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
53
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
54
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
55
	{
56
		$nb_domains = $_GET['nb_domains'];
57
		$nb_urls = $_GET['nb_urls'];
58
		$nb_ip = $_GET['nb_ip'];
59
	}
60
	else
61
	{
62
		if (file_exists($bl_categorie_domain_file))
63
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
64
		else
65
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
66
		if (file_exists($bl_categorie_url_file))
67
			$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
68
		else
69
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
70
		if(file_exists($bl_categorie_ip_file))
71
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
72
		else
73
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
74
	}
75
}
318 richard 76
else
1332 richard 77
{
78
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
79
	$wl_categorie_url_file = "";
80
	$wl_categorie_ip_file = "";
81
	if (file_exists($wl_categorie_domain_file))
82
		$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
83
	else
84
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
85
	$nb_urls = 0;
86
	$nb_ip = 0;
87
}
1325 richard 88
$global_usage = file($bl_dir."global_usage");
89
$langue = strtoupper($Language);
1332 richard 90
if($categorie == "ossi")
1325 richard 91
{
1332 richard 92
	$l_description_cat = $l_description_ossi;
93
}
94
else
95
{
96
	for($i=0; $i<count($global_usage); $i++)
1325 richard 97
	{
1332 richard 98
		if(preg_match("#^NAME:.$categorie$#", $global_usage[$i]) == 1)
99
		{
1325 richard 100
			$i++;
1332 richard 101
			while(preg_match("#^DESC.$langue:#", $global_usage[$i]) == 0)
102
				$i++;
103
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $global_usage[$i]);
104
			break;
105
		}
1325 richard 106
	}
107
}
318 richard 108
echo "<TITLE>$l_title</TITLE>";
109
?>
110
<link rel="stylesheet" href="/css/style.css" type="text/css">
111
</HEAD>
112
<body>
113
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
114
	<tr><th><?php echo $categorie ;?></th></tr>
115
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
116
</TABLE>
117
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
1332 richard 118
	<tr><td valign="middle" align="left">
119
		<?php
120
		if(isset($_GET["filtre"]))
121
		{
122
			$filtre = $_GET["filtre"];
123
		}
124
		else
125
		{
126
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
127
		}
128
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
129
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : $wl_categorie_url_file;
130
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
131
		$compat_categorie=strtr($categorie,"-","_");
132
		echo "<br><center><b>$l_description_cat</b></center><br>";
133
		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>";
134
		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>";
135
		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>";
136
		?>
137
	</td></tr>
318 richard 138
</TABLE>
139
<br>
1332 richard 140
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
141
	<tr><th>
142
		<?php
143
		if(isset($_GET["titre"]))
144
		{
145
			$titre = $_GET["titre"];
146
		}
147
		else
148
		{
149
			$titre = "domain";
150
		}
151
		echo $l_example.$titre;
152
		?>
153
	</th></tr>
154
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
155
</TABLE>
156
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
157
	<tr><td valign="middle" align="left">
158
		<?php
159
		if($titre == "domain")
160
		{
161
			exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
162
		}
163
		elseif($titre == "ip")
164
		{
165
			exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
166
		}
167
		else
168
		{
169
			exec("head -n 15 $filtre", $resultat);
170
		}
171
		for($i=0; $i<15; $i++)
172
			echo $resultat[$i]."<br/>";
173
		?>
174
	</td></tr>
175
</TABLE>
318 richard 176
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
177
</BODY>
178
</HTML>