Subversion Repositories ALCASAR

Rev

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

Rev 40 Rev 112
Line 12... Line 12...
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_exception_IP = "Exception au filtrage";
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";
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";
18
  $l_submit = "Enregistrer";
19
}
19
}
20
else {
20
else {
21
  $l_exception_IP = "Network filtering exceptions";
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";
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";
23
  $l_submit = "Submit";
24
}
24
}
25
if (isset($_POST['choix'])){ 
25
if (isset($_POST['choix'])){ 
26
	switch ($_POST['choix'])
26
	switch ($_POST['choix'])
27
	{
27
	{
28
	case 'IP_exceptions' :
28
	case 'IP_exceptions' :
29
		// réencodage iso + format unix + rc fin de ligne (ouf...)
29
		// réencodage iso + format unix + rc fin de ligne (ouf...)
30
		$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
30
		$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
-
 
31
		if (strlen($ip_list) != 0){
31
		if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;
32
			if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
32
		unset($_POST['exception_list']);
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é
33
		$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
43
		$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
34
		$result = false;
44
		$result = false;
35
		if ($pointeur)
45
		if ($pointeur)
36
			{
46
			{
37
			while (!feof($pointeur))
47
			while (!feof($pointeur))
Line 45... Line 55...
45
				}
55
				}
46
			}
56
			}
47
		fclose($pointeur);
57
		fclose($pointeur);
48
		if ($result)
58
		if ($result)
49
			{
59
			{
50
			$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
-
 
51
			fputs($fichier,$ip_list);
-
 
52
			fclose($fichier);
-
 
53
			exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
60
			exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
54
			}
61
			}
-
 
62
		// test si filtrage réseau activé
55
		$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
63
		$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
56
		$result = False ;
64
		$result = False ;
57
		if ($pointeur)
65
		if ($pointeur)
58
			{
66
			{
59
			while (!feof($pointeur))
67
			while (!feof($pointeur))
Line 67... Line 75...
67
				}
75
				}
68
			}
76
			}
69
		fclose($pointeur);
77
		fclose($pointeur);
70
		if ($result)
78
		if ($result)
71
			{
79
			{
72
			$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
-
 
73
			fputs($fichier, $ip_list);
-
 
74
			fclose($fichier);
-
 
75
			exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
80
			exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
76
			}
81
			}
77
	break;
82
	break;
78
	}	
83
	}	
79
}
84
}