Subversion Repositories ALCASAR

Rev

Rev 1852 | Rev 1874 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1852 Rev 1867
Line 6... Line 6...
6
$bl_dir="/etc/dansguardian/lists/blacklists/";
6
$bl_dir="/etc/dansguardian/lists/blacklists/";
7
$bl_iptables_dir="/usr/local/share/iptables-bl/";
7
$bl_iptables_dir="/usr/local/share/iptables-bl/";
8
$wl_iptables_dir="/usr/local/share/iptables-wl/";
8
$wl_iptables_dir="/usr/local/share/iptables-wl/";
9
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
9
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
10
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-wl/";
10
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-wl/";
-
 
11
if(isset($_GET['ossi'])) $ossi = $_GET['ossi'];
11
# Choice of language
12
# Choice of language
12
$Language = 'en';
13
$Language = 'en';
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
14
{
15
{
15
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
Line 60... Line 61...
60
{
61
{
61
	$liste = $l_error_list;
62
	$liste = $l_error_list;
62
}
63
}
63
if($liste == "bl")
64
if($liste == "bl")
64
{
65
{
-
 
66
	if(isset($ossi))
-
 
67
	{
-
 
68
	$bl_categorie_domain_file = $bl_dnsmasq_dir."-enabled/".$categorie;
-
 
69
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
-
 
70
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
-
 
71
	{
-
 
72
		$nb_domains = $_GET['nb_domains'];
-
 
73
		$nb_ip = $_GET['nb_ip'];
-
 
74
	}
-
 
75
	else
-
 
76
	{
-
 
77
		if (file_exists($bl_categorie_domain_file))
-
 
78
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
-
 
79
		else
-
 
80
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
-
 
81
		if(file_exists($bl_categorie_ip_file))
-
 
82
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
-
 
83
		else
-
 
84
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
-
 
85
	}
-
 
86
	}
-
 
87
	else
-
 
88
	{
-
 
89
	
-
 
90
	
65
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
91
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
66
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
92
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
67
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
93
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
68
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
94
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
69
	{
95
	{
Line 84... Line 110...
84
		if(file_exists($bl_categorie_ip_file))
110
		if(file_exists($bl_categorie_ip_file))
85
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
111
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
86
		else
112
		else
87
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
113
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
88
	}
114
	}
-
 
115
	}
89
}
116
}
90
else
117
else
91
{
118
{
-
 
119
	
-
 
120
	if(isset($ossi))
-
 
121
	{
-
 
122
	$wl_categorie_domain_file = "/usr/local/share/dnsmasq-wl-enabled/".$categorie;
-
 
123
	$wl_categorie_ip_file = "/usr/local/share/iptables-wl-enabled/".$categorie;
-
 
124
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
-
 
125
	{
-
 
126
		$nb_domains = $_GET['nb_domains'];
-
 
127
		$nb_ip = $_GET['nb_ip'];
-
 
128
	}
-
 
129
	else
-
 
130
	{
-
 
131
		if (file_exists($wl_categorie_domain_file))
-
 
132
			$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
-
 
133
		else
-
 
134
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
-
 
135
		if(file_exists($wl_categorie_ip_file))
-
 
136
			$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
-
 
137
		else
-
 
138
			$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
-
 
139
	}
-
 
140
	}
-
 
141
	else
-
 
142
	{	
92
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
143
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
93
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
144
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
94
	if(isset($_GET['nb_domains']))
145
	if(isset($_GET['nb_domains']))
95
	{
146
	{
96
		$nb_domains = $_GET['nb_domains'];
147
		$nb_domains = $_GET['nb_domains'];
Line 104... Line 155...
104
		else
155
		else
105
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
156
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
106
		$nb_urls = 0;
157
		$nb_urls = 0;
107
		$nb_ip = 0;
158
		$nb_ip = 0;
108
	}
159
	}
-
 
160
	}
109
}
161
}
110
$global_usage = file($bl_dir."global_usage");
162
$global_usage = file($bl_dir."global_usage");
111
$langue = strtoupper($Language);
163
$langue = strtoupper($Language);
112
if(isset($categorie))
164
if(isset($categorie) && !isset($ossi))
113
{
165
{
114
	$fin1 = 0; $fin2 = 0;
166
	$fin1 = 0; $fin2 = 0;
115
	foreach($global_usage as $line)
167
	foreach($global_usage as $line)
116
	{
168
	{
117
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
169
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
Line 149... Line 201...
149
		}
201
		}
150
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
202
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
151
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
203
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
152
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
204
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
153
		$compat_categorie=strtr($categorie,"-","_");
205
		$compat_categorie=strtr($categorie,"-","_");
-
 
206
		if(!isset($ossi))
-
 
207
		{
154
		echo "<br><center><b>$l_name_cat</b></center>";
208
		echo "<br><center><b>$l_name_cat</b></center>";
155
		echo "<center><b>$l_description_cat</b></center><br>";
209
		echo "<center><b>$l_description_cat</b></center><br>";
156
		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>";
210
		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>";
157
		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>";
211
		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>";
158
		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>";
212
		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>";
-
 
213
		}
-
 
214
		else
-
 
215
		{
-
 
216
		
-
 
217
		echo "$l_nb_domains <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_domain&titre=domain&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes'>$nb_domains</a></b><br>";
-
 
218
		echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes'>$nb_ip</a></b><br>";
-
 
219
		}
159
		?>
220
		?>
160
	</td></tr>
221
	</td></tr>
161
</TABLE>
222
</TABLE>
162
<br>
223
<br>
163
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
224
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
Line 176... Line 237...
176
	</th></tr>
237
	</th></tr>
177
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
238
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
178
</TABLE>
239
</TABLE>
179
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
240
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
180
	<tr><td valign="middle" align="left">
241
	<tr><td valign="middle" align="left">
181
		<?php
242
<?php
182
		if($titre == "domain")
243
		if($titre == "domain")
183
		{
244
		{
-
 
245
 
-
 
246
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
184
			exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
247
			exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
185
		}
248
		}
186
		elseif($titre == "ip")
249
		elseif($titre == "ip")
187
		{
250
		{
-
 
251
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
188
			exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
252
			exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
189
		}
253
		}
190
		else
254
		else
191
		{
255
		{
192
			exec("head -n 15 $filtre", $resultat);
256
			exec("head -n 15 $filtre", $resultat);