Subversion Repositories ALCASAR

Rev

Rev 520 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log

Rev 520 Rev 715
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>ALCASAR Filter Exceptions</TITLE>
5
<TITLE>ALCASAR Filter Exceptions</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<?
9
<?
10
# Choice of language
10
# Choice of language
11
$Language = 'en';
11
$Language = 'en';
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
if($Language == 'fr'){
15
if($Language == 'fr'){
-
 
16
  $l_error_open_file="Erreur d'ouverture du fichier";
16
  $l_exception_IP = "Exception au filtrage";
17
  $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_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
  $l_submit = "Enregistrer";
19
}
20
}
20
else {
21
else {
-
 
22
  $l_error_open_file="Error opening the file";
21
  $l_exception_IP = "Network filtering exceptions";
23
  $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";
24
  $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";
25
  $l_submit = "Submit";
24
}
26
}
-
 
27
$conf_file="/usr/local/etc/alcasar.conf";
25
if (isset($_POST['choix'])){ 
28
if (isset($_POST['choix'])){ 
26
	switch ($_POST['choix'])
29
	switch ($_POST['choix'])
27
	{
30
	{
28
	case 'IP_exceptions' :
31
	case 'IP_exceptions' :
29
		// réencodage iso + format unix + rc fin de ligne (ouf...)
32
		// réencodage iso + format unix + rc fin de ligne (ouf...)
30
		$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
33
		$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
31
		if (strlen($ip_list) != 0){
34
		if (strlen($ip_list) != 0){
32
			if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
35
			if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
33
		unset($_POST['exception_list']);
36
		unset($_POST['exception_list']);
34
		// écriture exception pour Dansguardian
37
		// écriture exception pour Dansguardian
35
		$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
38
		$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
36
		fputs($fichier,$ip_list);
39
		fputs($fichier,$ip_list);
37
		fclose($fichier);
40
		fclose($fichier);
38
		// écriture exception pour filtrage réseau et filtrage DNS
41
		// écriture exception pour filtrage réseau et filtrage DNS
39
		$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
42
		$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
40
		fputs($fichier, $ip_list);
43
		fputs($fichier, $ip_list);
41
		fclose($fichier);
44
		fclose($fichier);
42
		// test si le filtrage Dansguardian est activé
45
		// test si le filtragei Dansguardian est activés
43
		$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
-
 
44
		$result = false;
-
 
45
		if ($pointeur)
46
		if (is_file ($conf_file))
46
			{
47
			{
47
			while (!feof($pointeur))
48
			$tab=file($conf_file);
-
 
49
			if ($tab)
48
				{
50
				{
49
				$ligne = fgets($pointeur);
51
				foreach ($tab as $line)
50
				if (preg_match("/^reportinglevel = 3/", $ligne, $r))
-
 
51
					{
52
					{
52
					$result = true;
53
					$field=explode("=", $line);
53
					break;
54
					if ($field[0] == "DNS_FILTERING")	{$DNS_FILTERING=trim($field[1]);}
-
 
55
					if ($field[0] == "PROTOCOLS_FILTERING")	{$PROTOCOLS_FILTERING=trim($field[1]);}
54
					}
56
					}
55
				}
57
				}
56
			}
58
			}
57
		fclose($pointeur);
59
		else { echo "$l_error_open_file $conf_file";}
58
		if ($result)
60
		if ($DNS_FILTERING == "on")
59
			{
61
			{
60
			exec ("sudo service dansguardian restart");
62
			exec ("sudo service dansguardian restart");
61
			}
63
			}
-
 
64
		if (($DNS_FILTERING == "on")||($PROTOCOLS_FILTERING == "on"))
-
 
65
			{
62
		exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
66
			exec ("sudo /usr/local/bin/alcasar-iptables.sh"); 
-
 
67
			}
63
	break;
68
	break;
64
	}	
69
	}	
65
}
70
}
66
?>
71
?>
67
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
72
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
68
	<tr><th><?php echo $l_exception_IP ;?></th></tr>
73
	<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>
74
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
70
</TABLE>
75
</TABLE>
71
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
76
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
72
<tr><td valign="middle" align="left">
77
<tr><td valign="middle" align="left">
73
<TABLE width=70% border=0>
78
<TABLE width=70% border=0>
74
<?php
79
<?php
75
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
80
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
76
echo " $l_exception_txt";
81
echo " $l_exception_txt";
77
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
82
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
78
$filename="/usr/local/etc/alcasar-filter-exceptions";
83
$filename="/usr/local/etc/alcasar-filter-exceptions";
79
if (file_exists($filename))
84
if (file_exists($filename))
80
	{
85
	{
81
	if (filesize($filename) != 0)
86
	if (filesize($filename) != 0)
82
		{
87
		{
83
		$pointeur=fopen($filename,"r");
88
		$pointeur=fopen($filename,"r");
84
		$tampon = fread($pointeur, filesize($filename));
89
		$tampon = fread($pointeur, filesize($filename));
85
		fclose($pointeur);
90
		fclose($pointeur);
86
		echo $tampon;
91
		echo $tampon;
87
		}
92
		}
88
	}
93
	}
89
	else
94
	else
90
	{
95
	{
91
	echo "erreur d'ouverture du fichier $filename";
96
	echo "erreur d'ouverture du fichier $filename";
92
	}
97
	}
93
echo "</textarea><BR>";
98
echo "</textarea><BR>";
94
?>
99
?>
95
<input type='hidden' name='choix' value='IP_exceptions'>
100
<input type='hidden' name='choix' value='IP_exceptions'>
96
<input type='submit' value='Enregistrer les modifications'></CENTER>
101
<input type='submit' value='Enregistrer les modifications'></CENTER>
97
</FORM>
102
</FORM>
98
</td></tr>
103
</td></tr>
99
</TABLE>
104
</TABLE>
100
</BODY>
105
</BODY>
101
</HTML>
106
</HTML>
102
 
107