Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
28 richard 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>ALCASAR WEB filtering</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
8
<body>
9
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
10
<?
11
# Choice of language
12
$Language = 'en';
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
14
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
16
if($Language == 'fr'){
17
  $l_title = "Filtrage WEB";
18
  $l_webfilter_on="Le filtrage WEB est actuellement activé";
19
  $l_webfilter_off="Le filtrage WEB est actuellement désactivé";
20
  $l_switch_on="Activer le filtrage WEB";
21
  $l_switch_off="Désactiver le filtrage WEB";
22
  $l_comment_on="(la consultation WEB est filtrée selon les critères définis ci-dessous)";
23
  $l_comment_off="(la consultation WEB est autorisée sans restriction)";
24
  $l_main_bl="Liste noire principale (version actuelle : ";
25
  $l_download="Télécharger la dernière version";
26
  $l_warning="<B>Attention</B> : ce téléchargement dure plusieurs minutes.";
27
  $l_secondary_bl="Liste noire et liste blanche secondaires";
28
}
29
else {
30
  $l_title = "WEB Filter";
31
  $l_webfilter_on="Actually, the WEB filter is on";
32
  $l_webfilter_off="Actually, the WEB filter is off";
33
  $l_switch_on="Switch the WebFilter on";
34
  $l_switch_off="Switch the WebFilter off";
35
  $l_comment_on="(The WEB consultation is filtered as defined below)";
36
  $l_comment_off="(The WEB consultation is allowed without any restriction)";
37
  $l_main_bl="Main blacklist (current version : ";
38
  $l_download="Download the last version";
39
  $l_warning="<B>Be carefull</B> : this download is estimate to fiew minutes.";
40
  $l_secondary_bl="Secondary blacklist and whitelist";
41
}
42
echo "
43
	<tr><th>$l_title</th></tr>
44
	<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
45
</TABLE>";
46
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
47
switch ($choix)
48
{
49
case 'BL_On' :
50
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -on");
51
	break;
52
case 'BL_Off' :
53
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -off");
54
	break;
55
case 'MAJ_bl' :
56
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -download");
57
	break;
58
case 'MAJ_OSSI' :
59
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
60
	fputs($fichier, $_POST['OSSI_bl_domains']);
61
	fclose($fichier);
62
	unset($_POST['OSSI_bl_domains']);
63
	$fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
64
	fputs($fichier, $_POST['OSSI_wl_domains']);
65
	fclose($fichier);
66
	unset($_POST['OSSI_wl_domains']);
67
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
68
	fputs($fichier, $_POST['OSSI_bl_urls']);
69
	fclose($fichier);
70
	unset($_POST['OSSI_bl_urls']);
71
	$fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
72
	fputs($fichier, $_POST['OSSI_wl_urls']);
73
	fclose($fichier);
74
	unset($_POST['OSSI_wl_urls']);
75
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
76
	break;
77
}
78
?>
79
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
80
	<tr><td valign="middle" align="left">
81
<?php
82
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
83
$result = false;
84
if ($pointeur)
85
	{
86
  	while (!feof($pointeur))
87
		{
88
    		$ligne = fgets($pointeur);
89
    		if (preg_match("/^reportinglevel = 3/", $ligne, $r))
90
			{
91
			$result = true;
92
			break;
93
			}
94
    		}
95
  	}
96
fclose($pointeur);
97
if ($result)
98
	{
99
	echo "<CENTER><H3>$l_webfilter_on</H3>$l_comment_on</CENTER>";
100
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
101
	echo "<input type=hidden name='choix' value=\"BL_Off\">";
102
	echo "<input type=submit value=\"$l_switch_off\">";
103
}
104
else
105
	{
106
	echo "<CENTER><H3>$l_webfilter_off</H3>$l_comment_off</CENTER>";
107
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
108
	echo "<input type=hidden name='choix' value=\"BL_On\">";
109
	echo "<input type=submit value=\"$l_switch_on\">";
110
	}
111
echo "</FORM>";
112
echo "</td></tr>";
113
echo "</TABLE>";
114
if ($result) require ('web_filter2.php');
115
?>
116
</BODY>
117
</HTML>