Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
28 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 pas de filtrage<BR>Entrez une adresse IP par ligne";
18
  $l_submit = "Enregistrer";
19
}
20
else {
21
  $l_exception_IP = "Network filtering exceptions";
22
  $l_exception_txt="Put here the stations IP address that won't be filtered<BR>Put one IP per row";
23
  $l_submit = "Submit";
24
}
25
if (isset($_POST['choix'])){ 
26
	switch ($_POST['choix'])
27
	{
28
	case 'IP_exceptions' :
29
		$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));  //réencodage (iso + format unix)!!!
30
		unset($_POST['exception_list']);
31
		$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
32
		$result = false;
33
		if ($pointeur)
34
			{
35
			while (!feof($pointeur))
36
				{
37
				$ligne = fgets($pointeur);
38
				if (preg_match("/^reportinglevel = 3/", $ligne, $r))
39
					{
40
					$result = true;
41
					break;
42
					}
43
				}
44
			}
45
		fclose($pointeur);
46
		if ($result)
47
			{
48
			$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
49
			fputs($fichier,$ip_list);
50
			fclose($fichier);
51
			exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
52
			}
53
		$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
54
		$result = False ;
55
		if ($pointeur)
56
			{
57
			while (!feof($pointeur))
58
				{
59
				$ligne = fgets($pointeur);
60
				if (preg_match('/^FILTERING="yes"/', $ligne, $r))
61
					{
62
					$result = True ;
63
					break;
64
					}
65
				}
66
			}
67
		fclose($pointeur);
68
		if ($result)
69
			{
70
			$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
71
			fputs($fichier, $ip_list);
72
			fclose($fichier);
73
			exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
74
			}
75
	break;
76
	}	
77
}
78
?>
79
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
80
	<tr><th><?php echo $l_exception_IP ;?></th></tr>
81
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
82
</TABLE>
83
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
84
<tr><td valign="middle" align="left">
85
<TABLE width=70% border=0>
86
<?php
87
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
88
echo " $l_exception_txt";
89
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
90
$filename="/usr/local/etc/alcasar-filter-exceptions";
91
if (file_exists($filename))
92
	{
93
	if (filesize($filename) != 0)
94
		{
95
		$pointeur=fopen($filename,"r");
96
		$tampon = fread($pointeur, filesize($filename));
97
		fclose($pointeur);
98
		echo $tampon;
99
		}
100
	}
101
	else
102
	{
103
	echo "erreur d'ouverture du fichier $filename";
104
	}
105
echo "</textarea><BR>";
106
?>
107
<input type='hidden' name='choix' value='IP_exceptions'>
108
<input type='submit' value='Enregistrer les modifications'></CENTER>
109
</FORM>
110
</td></tr>
111
</TABLE>
112
</BODY>
113
</HTML>