Subversion Repositories ALCASAR

Rev

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