Subversion Repositories ALCASAR

Rev

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

Rev 520 Rev 715
Line 11... Line 11...
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...)
Line 37... Line 40...
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">