Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
318 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 DNS filtering</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
8
<body>
9
<?
10
$bl_categories="/usr/local/etc/alcasar-bl-categories";
11
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled";
12
$dir_blacklist="/etc/dansguardian/lists/blacklist/";
13
# Choice of language
14
$Language = 'en';
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
18
if($Language == 'fr'){
19
  $l_title1 = "Filtrage de noms de domaine et d'URL";
20
  $l_error_open_file="Erreur d'ouverture du fichier";
21
  $l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
22
  $l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
23
  $l_switch_filtering_on="Activer le filtrage";
24
  $l_switch_filtering_off="Désactiver le filtrage";
25
  $l_main_bl="Liste noire principale";
26
  $l_bl_version="Version actuelle :";
27
  $l_bl_categories="Choix des catégories à filtrer";
28
  $l_download="Télécharger la dernière version";
29
  $l_warning="<B>Attention</B> : ce téléchargement peut durer plusieurs minutes.";
30
  $l_secondary_bl="Liste noire et liste blanche secondaires";
31
  $l_forbidden_dns="Noms de domaine filtrés";
32
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : domaine.org)";
33
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : domaine.org)";
34
  $l_rehabilitated_dns="Noms de domaine réhabilités";
35
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire principale <BR> que vous désirez réhabiliter.";
36
  $l_forbidden_url="URL filtrés";
37
  $l_forbidden_url_explain="Entrez une URL par ligne (exemple : domaine.org/perso.index.htm)";
38
  $l_rehabilitated_url="URL réhabilités";
39
  $l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire principale <BR> que vous désirez réhabiliter.";
40
  $l_one_url="Entrez une URL par ligne (exemple : domaine.org/perso.index.htm)";
41
  $l_record="Enregistrer les modifications";
42
}
43
else {
44
  $l_title1 = "Domain names and URL filtering";
45
  $l_error_open_file="Error opening the file";
46
  $l_dnsfilter_on="Actually, the Domain name and URL filter is on";
47
  $l_dnsfilter_off="Actually, the Domain name and URL filter is off";
48
  $l_switch_filtering_on="Switch the Filter on";
49
  $l_switch_filtering_off="Switch the Filter off";
50
  $l_main_bl="Main blacklist";
51
  $l_bl_version="Current version : ";
52
  $l_bl_categories="Choice of filtered categories";
53
  $l_download="Download the last version";
54
  $l_warning="<B>Be carefull</B> : this download is estimate to fiew minutes.";
55
  $l_secondary_bl="Secondary blacklist and whitelist";
56
  $l_forbidden_dns="Filtered domain names";
57
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : domain.org)";
58
  $l_one_dns="Enter one domain name per row (exemple : domain.org)";
59
  $l_rehabilitated_dns="Rehabilitated domain names";
60
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
61
  $l_forbidden_url="Filtered URL";
62
  $l_forbidden_url_explain="Enter one URL per row (exemple : www.domaine.org/perso/index.htm)";
63
  $l_rehabilitated_url="Rehabilitated URL";
64
  $l_rehabilitated_url_explain="Enter here URL that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
65
  $l_one_url="Enter one URL per row (exemple : www.domaine.org/perso/index.htm)";
66
  $l_record="Save changes";
67
}
68
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
69
switch ($choix)
70
{
71
case 'BL_On' :
72
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -on");
73
	break;
74
case 'BL_Off' :
75
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -off");
76
	break;
77
case 'MAJ_bl' :
78
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -download");
79
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
80
	break;
81
case 'MAJ_cat' :
82
	$tab=file($bl_categories_enabled);	
83
	if ($tab)
84
		{
85
		$pointeur=fopen($bl_categories_enabled, "w+");
86
		foreach ($_POST as $key => $value)
87
			{
88
			if (strstr($key,'chk-'))
89
				{	
90
				$line=str_replace('chk-','',$key)."\n";
91
				fwrite($pointeur,$line);
92
				}
93
			}
94
		fclose($pointeur);
95
		}
96
	else {echo "$l_error_open_file $bl_categories_enabled";}
97
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
98
	break;
99
case 'MAJ_OSSI' :
100
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
101
	fputs($fichier, $_POST['OSSI_bl_domains']);
102
	fclose($fichier);
103
	unset($_POST['OSSI_bl_domains']);
104
	$fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
105
	fputs($fichier, $_POST['OSSI_wl_domains']);
106
	fclose($fichier);
107
	unset($_POST['OSSI_wl_domains']);
108
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
109
	fputs($fichier, $_POST['OSSI_bl_urls']);
110
	fclose($fichier);
111
	unset($_POST['OSSI_bl_urls']);
112
	$fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
113
	fputs($fichier, $_POST['OSSI_wl_urls']);
114
	fclose($fichier);
115
	unset($_POST['OSSI_wl_urls']);
116
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
117
	break;
118
}
119
?>
120
</TABLE>
121
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
122
<tr><th><?php echo "$l_title1"; ?></th></tr>
123
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
124
</TABLE>
125
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
126
	<tr><td valign="middle" align="left">
127
<?php
128
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
129
$result_filter = false; $out=0;
130
if ($pointeur)
131
	{
132
  	while (!feof($pointeur))
133
		{
134
    		$ligne = fgets($pointeur);
135
    		if (preg_match("/^reportinglevel = 3/", $ligne, $r))
136
			{
137
			$result_filter = true;
138
			$out++;
139
			}
140
		if ($out == 2) break;
141
    		}
142
  	}
143
fclose($pointeur);
144
if ($result_filter)
145
	{
146
	echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
147
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
148
	echo "<input type=hidden name='choix' value=\"BL_Off\">";
149
	echo "<input type=submit value=\"$l_switch_filtering_off\">";
150
}
151
else
152
	{
153
	echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
154
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
155
	echo "<input type=hidden name='choix' value=\"BL_On\">";
156
	echo "<input type=submit value=\"$l_switch_filtering_on\">";
157
	}
158
echo "</FORM>";
159
echo "</td></tr>";
160
echo "</TABLE>";
161
if ($result_filter) require ('dns_filter2.php');
162
?>
163
</BODY>
164
</HTML>