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 |
<TITLE>ALCASAR Filter Exceptions</TITLE>
|
|
|
6 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
7 |
</HEAD>
|
|
|
8 |
<body>
|
|
|
9 |
<?
|
|
|
10 |
# Choice of language
|
|
|
11 |
$Language = 'en';
|
|
|
12 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
|
|
13 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
14 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
|
|
15 |
if($Language == 'fr'){
|
|
|
16 |
$l_exception_IP = "Exception au filtrage";
|
|
|
17 |
$l_exception_txt="Entrez ici les adresses IP des stations du réseau de consultation ne subissant ni filtrage WEB ni filtrage réseau<BR>Entrez une adresse IP par ligne";
|
|
|
18 |
$l_record="Enregistrer les modifications";
|
|
|
19 |
}
|
|
|
20 |
else {
|
|
|
21 |
$l_exception_IP = "Network filtering exceptions";
|
|
|
22 |
$l_exception_txt="Put here the stations IP address that won't be neither WEB filtered nor network filtered<BR>Put one IP adress per row";
|
|
|
23 |
$l_record="Save changes";
|
|
|
24 |
}
|
|
|
25 |
if (isset($_POST['choix'])){
|
|
|
26 |
switch ($_POST['choix'])
|
|
|
27 |
{
|
|
|
28 |
case 'IP_exceptions' :
|
|
|
29 |
// réencodage iso + format unix + rc fin de ligne (ouf...)
|
|
|
30 |
$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
|
|
|
31 |
if (strlen($ip_list) != 0){
|
|
|
32 |
if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
|
|
|
33 |
unset($_POST['exception_list']);
|
|
|
34 |
// écriture exception pour Dansguardian
|
|
|
35 |
$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
|
|
|
36 |
fputs($fichier,$ip_list);
|
|
|
37 |
fclose($fichier);
|
|
|
38 |
// écriture exception pour filtrage réseau
|
|
|
39 |
$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
|
|
|
40 |
fputs($fichier, $ip_list);
|
|
|
41 |
fclose($fichier);
|
|
|
42 |
// test si Dansguardian activé
|
|
|
43 |
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
|
|
|
44 |
$result = false;
|
|
|
45 |
if ($pointeur)
|
|
|
46 |
{
|
|
|
47 |
while (!feof($pointeur))
|
|
|
48 |
{
|
|
|
49 |
$ligne = fgets($pointeur);
|
|
|
50 |
if (preg_match("/^reportinglevel = 3/", $ligne, $r))
|
|
|
51 |
{
|
|
|
52 |
$result = true;
|
|
|
53 |
break;
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
fclose($pointeur);
|
|
|
58 |
if ($result)
|
|
|
59 |
{
|
|
|
60 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
|
|
|
61 |
}
|
|
|
62 |
// test si filtrage réseau activé
|
|
|
63 |
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
|
|
|
64 |
$result = False ;
|
|
|
65 |
if ($pointeur)
|
|
|
66 |
{
|
|
|
67 |
while (!feof($pointeur))
|
|
|
68 |
{
|
|
|
69 |
$ligne = fgets($pointeur);
|
|
|
70 |
if (preg_match('/^FILTERING="yes"/', $ligne, $r))
|
|
|
71 |
{
|
|
|
72 |
$result = True ;
|
|
|
73 |
break;
|
|
|
74 |
}
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
fclose($pointeur);
|
|
|
78 |
if ($result)
|
|
|
79 |
{
|
|
|
80 |
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
|
|
|
81 |
}
|
|
|
82 |
break;
|
|
|
83 |
}
|
|
|
84 |
}
|
|
|
85 |
?>
|
|
|
86 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
87 |
<tr><th><?php echo $l_exception_IP ;?></th></tr>
|
|
|
88 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
89 |
</TABLE>
|
|
|
90 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
91 |
<tr><td valign="middle" align="left">
|
|
|
92 |
<?php
|
|
|
93 |
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
|
|
|
94 |
echo " $l_exception_txt";
|
|
|
95 |
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
|
|
|
96 |
$filename="/usr/local/etc/alcasar-filter-exceptions";
|
|
|
97 |
if (file_exists($filename))
|
|
|
98 |
{
|
|
|
99 |
if (filesize($filename) != 0)
|
|
|
100 |
{
|
|
|
101 |
$pointeur=fopen($filename,"r");
|
|
|
102 |
$tampon = fread($pointeur, filesize($filename));
|
|
|
103 |
fclose($pointeur);
|
|
|
104 |
echo $tampon;
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
else
|
|
|
108 |
{
|
|
|
109 |
echo "erreur d'ouverture du fichier $filename";
|
|
|
110 |
}
|
|
|
111 |
echo "</textarea><BR>";
|
|
|
112 |
?>
|
|
|
113 |
<input type='hidden' name='choix' value='IP_exceptions'>
|
|
|
114 |
<input type='submit' value='<?php echo "$l_record"; ?>'>
|
|
|
115 |
</FORM>
|
|
|
116 |
</td></tr>
|
|
|
117 |
</TABLE>
|
|
|
118 |
</BODY>
|
|
|
119 |
</HTML>
|