Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
504 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_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 neither WEB filtered nor network 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
		// 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 et filtrage DNS
39
		$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
40
		fputs($fichier, $ip_list);
41
		fclose($fichier);
42
		// test si le filtrage Dansguardian est 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 service dansguardian restart");
61
			}
520 richard 62
		exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
504 richard 63
	break;
64
	}	
65
}
66
?>
67
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
68
	<tr><th><?php echo $l_exception_IP ;?></th></tr>
69
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
70
</TABLE>
71
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
72
<tr><td valign="middle" align="left">
73
<TABLE width=70% border=0>
74
<?php
75
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
76
echo " $l_exception_txt";
77
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
78
$filename="/usr/local/etc/alcasar-filter-exceptions";
79
if (file_exists($filename))
80
	{
81
	if (filesize($filename) != 0)
82
		{
83
		$pointeur=fopen($filename,"r");
84
		$tampon = fread($pointeur, filesize($filename));
85
		fclose($pointeur);
86
		echo $tampon;
87
		}
88
	}
89
	else
90
	{
91
	echo "erreur d'ouverture du fichier $filename";
92
	}
93
echo "</textarea><BR>";
94
?>
95
<input type='hidden' name='choix' value='IP_exceptions'>
96
<input type='submit' value='Enregistrer les modifications'></CENTER>
97
</FORM>
98
</td></tr>
99
</TABLE>
100
</BODY>
101
</HTML>