Subversion Repositories ALCASAR

Rev

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