Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 611 → Rev 612

/web/acc/admin/net_filter.php
8,7 → 8,6
<body>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
<?
$services_list="/usr/local/etc/alcasar-services";
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
56,10 → 55,8
$l_add_to_list="Add to the list";
$l_save_modif="Save modifications";
}
echo "
<tr><th>$l_title_antivir</th></tr>
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
</TABLE>";
$services_list="/usr/local/etc/alcasar-services";
$conf_file="/usr/local/etc/alcasar.conf";
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
switch ($choix)
{
147,33 → 144,30
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
break;
}
# default values
if (is_file ($conf_file))
{
$tab=file($conf_file);
if ($tab)
{
foreach ($tab as $line)
{
$field=explode("=", $line);
if ($field[0] == "PROTOCOLS_FILTERING") {$PROTOCOLS_FILTERING=trim($field[1]);}
if ($field[0] == "WEB_ANTIVIRUS") {$WEB_ANTIVIRUS=trim($field[1]);}
}
}
}
else { echo "$l_error_open_file $conf_file";}
echo "<tr><th>$l_title_antivir</th></tr>";
?>
<tr bgcolor=#FFCC66><td><img src=/images/pix.gif width=1 height=2></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
<tr><td valign="middle" align="left">
<?php
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
$antivir_filter = false; $DG_filter = false; $out=0;
if ($pointeur)
if ($WEB_ANTIVIRUS == "on")
{
while (!feof($pointeur))
{
$ligne = fgets($pointeur);
if (preg_match("/^proxyport = 8090/", $ligne, $r))
{
$antivir_filter = true;
$out++;
}
if (preg_match("/^reportinglevel = 3/", $ligne, $r)) // non utilisé mais on garde pour l'exemple
{
$DG_filter = true;
$out++;
}
if ($out == 2) break;
}
}
fclose($pointeur);
if ($antivir_filter)
{
echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
echo "<input type=hidden name='choix' value=\"AV_Off\">";
197,23 → 191,8
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
<tr><td valign="middle" align="left">
<?
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
$result = False ;
if ($pointeur)
if ($PROTOCOLS_FILTERING == "on")
{
while (!feof($pointeur))
{
$ligne = fgets($pointeur);
if (preg_match('/^PROTO_FILTERING="yes"/', $ligne, $r))
{
$result = True ;
break;
}
}
}
fclose($pointeur);
if ($result)
{
echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>";
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
echo "<input type=hidden name='choix' value=\"NF_Off\">";
229,7 → 208,7
echo "</FORM>";
echo "</td></tr>";
echo "</TABLE>";
if ($result) require ('net_filter2.php');
if ($PROTOCOLS_FILTERING == "on") require ('net_filter2.php');
?>
</BODY>
</HTML>