13,15 → 13,18 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_error_open_file="Erreur d'ouverture du fichier"; |
$l_exception_IP = "Exception au filtrage"; |
$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"; |
$l_submit = "Enregistrer"; |
} |
else { |
$l_error_open_file="Error opening the file"; |
$l_exception_IP = "Network filtering exceptions"; |
$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"; |
$l_submit = "Submit"; |
} |
$conf_file="/usr/local/etc/alcasar.conf"; |
if (isset($_POST['choix'])){ |
switch ($_POST['choix']) |
{ |
39,27 → 42,29 |
$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+"); |
fputs($fichier, $ip_list); |
fclose($fichier); |
// test si le filtrage Dansguardian est activé |
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r"); |
$result = false; |
if ($pointeur) |
// test si le filtragei Dansguardian est activés |
if (is_file ($conf_file)) |
{ |
while (!feof($pointeur)) |
$tab=file($conf_file); |
if ($tab) |
{ |
$ligne = fgets($pointeur); |
if (preg_match("/^reportinglevel = 3/", $ligne, $r)) |
foreach ($tab as $line) |
{ |
$result = true; |
break; |
$field=explode("=", $line); |
if ($field[0] == "DNS_FILTERING") {$DNS_FILTERING=trim($field[1]);} |
if ($field[0] == "PROTOCOLS_FILTERING") {$PROTOCOLS_FILTERING=trim($field[1]);} |
} |
} |
} |
fclose($pointeur); |
if ($result) |
else { echo "$l_error_open_file $conf_file";} |
if ($DNS_FILTERING == "on") |
{ |
exec ("sudo service dansguardian restart"); |
} |
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on"); |
if (($DNS_FILTERING == "on")||($PROTOCOLS_FILTERING == "on")) |
{ |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
break; |
} |
} |