Subversion Repositories ALCASAR

Rev

Rev 2647 | Rev 2662 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2647 Rev 2648
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>ALCASAR DNS WL filtering</TITLE>
5
<TITLE>ALCASAR DNS WL filtering</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<?
9
<?
10
function form_filter ($form_content)
10
function form_filter ($form_content)
11
{
11
{
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
14
	if (strlen($list) != 0){
14
	if (strlen($list) != 0){
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
16
	return $list;
16
	return $list;
17
}
17
}
18
function form_filter_ip($form_content, $color)
18
function form_filter_ip($form_content, $color)
19
{
19
{
20
	//# reconstruction des ip
20
	//# reconstruction des ip
21
	$list = explode("\n", form_filter($form_content));
21
	$list = explode("\n", form_filter($form_content));
22
	$new_list = "";
22
	$new_list = "";
23
	foreach($list as &$value)
23
	foreach($list as &$value)
24
	{
24
	{
25
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
25
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
26
		{
26
		{
27
			$new_list = $new_list.$value."\n";
27
			$new_list = $new_list.$value."\n";
28
		}
28
		}
29
	}
29
	}
30
	if($color == "white")
30
	if($color == "white")
31
	{
31
	{
32
		return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
32
		return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
33
	}
33
	}
34
	else
34
	else
35
	{
35
	{
36
		return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
36
		return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
37
	}
37
	}
38
}
38
}
39
function echo_file ($filename)
39
function echo_file ($filename)
40
	{
40
	{
41
	if (file_exists($filename))
41
	if (file_exists($filename))
42
		{
42
		{
43
		if (filesize($filename) != 0)
43
		if (filesize($filename) != 0)
44
			{
44
			{
45
			$pointeur=fopen($filename,"r");
45
			$pointeur=fopen($filename,"r");
46
			$tampon = fread($pointeur, filesize($filename));
46
			$tampon = fread($pointeur, filesize($filename));
47
			fclose($pointeur);
47
			fclose($pointeur);
48
			echo $tampon;
48
			echo $tampon;
49
			}
49
			}
50
		}
50
		}
51
	else
51
	else
52
		{
52
		{
53
		echo "$filename doesn't exist";
53
		echo "$filename doesn't exist";
54
		}
54
		}
55
	}
55
	}
56
function echo_ip_file ($filename)
56
function echo_ip_file ($filename)
57
{
57
{
58
	$filename = escapeshellarg($filename);
58
	$filename = escapeshellarg($filename);
59
	exec("cat $filename | cut -d ' ' -f3", $resultat);
59
	exec("cat $filename | cut -d ' ' -f3", $resultat);
60
	for($i=0; $i<exec("wc -l $filename"); $i++)
60
	for($i=0; $i<exec("wc -l $filename"); $i++)
61
	{
61
	{
62
		echo $resultat[$i]."\n";
62
		echo $resultat[$i]."\n";
63
	}
63
	}
64
}
64
}
65
 
65
 
66
# Choice of language
66
# Choice of language
67
$Language = 'en';
67
$Language = 'en';
68
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
68
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
69
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
69
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
70
	$Language = strtolower(substr(chop($Langue[0]),0,2));
70
	$Language = strtolower(substr(chop($Langue[0]),0,2));
71
	}
71
	}
72
if($Language == 'fr'){
72
if($Language == 'fr'){
73
	$l_wl="Liste blanche générale";
73
	$l_wl="Liste blanche générale";
74
	$l_load="Chargement...";
74
	$l_load="Chargement...";
75
	$l_list_version="Version de la liste : ";
75
	$l_list_version="Version de la liste : ";
76
	$l_wl_categories="Sélectionnez les catégories à autoriser";
76
	$l_wl_categories="Sélectionnez les catégories à autoriser";
77
	$l_specific_filtering="Filtrage special";
77
	$l_specific_filtering="Filtrage special";
78
	$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
78
	$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
79
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : .domaine.org - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
79
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : .domaine.org - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
80
	$l_record="Enregistrer les modifications";
80
	$l_record="Enregistrer les modifications";
81
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
81
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
82
	$l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche google.";
-
 
83
	$l_safe_youtube="Pour un contrôle parental sur Youtube, suivez les étapes ici : ";
-
 
84
	$l_youtube_id="(<a href='https://support.google.com/youtube/answer/174084?hl=fr' target='cat_help' onclick=window.open('https://support.google.com/youtube/answer/174084?hl=fr','cat_help','width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes') title='Youtube for school'>lien pour créer un identifiant Youtube (Id)</a>)";
82
	$l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche Google, Bing et Youtube.";
85
	$l_error_open_file="Erreur d'ouverture du fichier";
83
	$l_error_open_file="Erreur d'ouverture du fichier";
86
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
84
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
87
	$l_file_list="Liste des fichiers";
85
	$l_file_list="Liste des fichiers";
88
	$l_add_file="Ajouter un fichier";
86
	$l_add_file="Ajouter un fichier";
89
	$l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine";
87
	$l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine";
90
	$l_file_name="Nom du fichier";
88
	$l_file_name="Nom du fichier";
91
	$l_file_action="Action";
89
	$l_file_action="Action";
92
	$l_error_upload="Erreur d'envoi du fichier";
90
	$l_error_upload="Erreur d'envoi du fichier";
93
	$l_remove="Supprimer";
91
	$l_remove="Supprimer";
94
	$l_submit="Envoyer";
92
	$l_submit="Envoyer";
95
	$l_nb_ip="Nombre d'IP";
93
	$l_nb_ip="Nombre d'IP";
96
	$l_nb_domain_names="Nombre de noms de domaine";
94
	$l_nb_domain_names="Nombre de noms de domaine";
97
	$l_nbDomainNames="Noms de domaine :";
95
	$l_nbDomainNames="Noms de domaine :";
98
	$l_nbUrl="Url :";
96
	$l_nbUrl="Url :";
99
	$l_nbIp="Ip :";
97
	$l_nbIp="Ip :";
100
	$l_disable="Désactiver";
98
	$l_disable="Désactiver";
101
	$l_enable="Activer";
99
	$l_enable="Activer";
102
	$l_file_state="Etat";
100
	$l_file_state="Etat";
103
}
101
}
104
else {
102
else {
105
	$l_wl="General WhiteList";
103
	$l_wl="General WhiteList";
106
	$l_load="Loading...";
104
	$l_load="Loading...";
107
	$l_list_version="List version : ";
105
	$l_list_version="List version : ";
108
	$l_wl_categories="Select the allowed categories";
106
	$l_wl_categories="Select the allowed categories";
109
	$l_specific_filtering="Specific filtering";
107
	$l_specific_filtering="Specific filtering";
110
	$l_allowed_dns="Allowed domain names";
108
	$l_allowed_dns="Allowed domain names";
111
	$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
109
	$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
112
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): .domain.org - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
110
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): .domain.org - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
113
	$l_record="Save changes";
111
	$l_record="Save changes";
114
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
112
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
115
	$l_safe_searching="Enabling school/parental control for the search engines google";
-
 
116
	$l_safe_youtube="For a safe Youtube search, follow these steps : ";
-
 
117
	$l_youtube_id="(<a href='https://support.google.com/youtube/answer/174084?hl=en' target='cat_help' onclick=window.open('https://support.google.com/youtube/answer/174084?hl=en','cat_help','width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes') title='Youtube for school'>link to create a Youtube Id</a>)";
113
	$l_safe_searching="Enabling school/parental control for the search engines Google, Bind and Youtube";
118
	$l_error_open_file="Error opening file";
114
	$l_error_open_file="Error opening file";
119
	$l_additional_file_title="Additional WhiteList files";
115
	$l_additional_file_title="Additional WhiteList files";
120
	$l_file_list="Files list";
116
	$l_file_list="Files list";
121
	$l_add_file="Add a file";
117
	$l_add_file="Add a file";
122
	$l_add_file_explain="Each line of the file must be an IP address or a domain name";
118
	$l_add_file_explain="Each line of the file must be an IP address or a domain name";
123
	$l_file_name="Filename";
119
	$l_file_name="Filename";
124
	$l_file_action="Action";
120
	$l_file_action="Action";
125
	$l_error_upload="Error during the upload process";
121
	$l_error_upload="Error during the upload process";
126
	$l_remove="Delete";
122
	$l_remove="Delete";
127
	$l_submit="Submit";
123
	$l_submit="Submit";
128
	$l_nb_ip="Number of IP";
124
	$l_nb_ip="Number of IP";
129
	$l_nb_domain_names="Number of domain names";
125
	$l_nb_domain_names="Number of domain names";
130
	$l_nbDomainNames="Domain names :";
126
	$l_nbDomainNames="Domain names :";
131
	$l_nbUrl="Url :";
127
	$l_nbUrl="Url :";
132
	$l_nbIp="Ip :";
128
	$l_nbIp="Ip :";
133
	$l_disable="Disable";
129
	$l_disable="Disable";
134
	$l_enable="Enable";
130
	$l_enable="Enable";
135
	$l_file_state="State";
131
	$l_file_state="State";
136
}
132
}
137
$dir_etc="/usr/local/etc/";
133
$dir_etc="/usr/local/etc/";
138
$dir_dg="/etc/e2guardian/lists/";
134
$dir_dg="/etc/e2guardian/lists/";
139
$dir_blacklist=$dir_dg."blacklists/";
135
$dir_blacklist=$dir_dg."blacklists/";
140
$dir_wl_ip="/usr/local/share/iptables-wl/";
136
$dir_wl_ip="/usr/local/share/iptables-wl/";
141
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
137
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
142
$dir_wl_domain_names= "/usr/local/share/dnsmasq-wl/";
138
$dir_wl_domain_names= "/usr/local/share/dnsmasq-wl/";
143
$dir_wl_domain_names_enabled= "/usr/local/share/dnsmasq-wl-enabled/";
139
$dir_wl_domain_names_enabled= "/usr/local/share/dnsmasq-wl-enabled/";
144
$wl_categories=$dir_etc."alcasar-wl-categories";
140
$wl_categories=$dir_etc."alcasar-wl-categories";
145
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
141
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
146
$conf_file=$dir_etc."alcasar.conf";
142
$conf_file=$dir_etc."alcasar.conf";
147
$iptables_safesearch_file=$dir_wl_ip_enabled."ossi-ip-safesearch";
143
$iptables_safesearch_file=$dir_wl_ip_enabled."ossi-ip-safesearch";
148
$bannedsite_file=$dir_dg."bannedsitelist";
144
$bannedsite_file=$dir_dg."bannedsitelist";
149
$dir_tmp="/tmp/blacklists";
145
$dir_tmp="/tmp/blacklists";
150
 
146
 
151
 
147
 
152
# default values
148
# default values
153
if (is_file ($conf_file))
149
if (is_file ($conf_file))
154
	{
150
	{
155
	$tab=file($conf_file);
151
	$tab=file($conf_file);
156
	if ($tab)
152
	if ($tab)
157
		{
153
		{
158
		foreach ($tab as $line)
154
		foreach ($tab as $line)
159
			{
155
			{
160
			$field=explode("=", $line);
156
			$field=explode("=", $line);
161
			if ($field[0] == "PRIVATE_IP")
157
			if ($field[0] == "PRIVATE_IP")
162
				{
158
				{
163
				$PRIVATE_IP_MASK=trim($field[1]);
159
				$PRIVATE_IP_MASK=trim($field[1]);
164
				$tmp = explode("/",$PRIVATE_IP_MASK);
160
				$tmp = explode("/",$PRIVATE_IP_MASK);
165
				$PRIVATE_IP=$tmp[0];
161
				$PRIVATE_IP=$tmp[0];
166
				}
162
				}
167
			}
163
			}
168
		}
164
		}
169
	}
165
	}
170
else { echo "$l_error_open_file $conf_file";}
166
else { echo "$l_error_open_file $conf_file";}
171
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
167
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
172
switch ($choix)
168
switch ($choix)
173
{
169
{
174
case 'Download_list' :
170
case 'Download_list' :
175
	exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
171
	exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
176
	break;
172
	break;
177
case 'Active_list' :
173
case 'Active_list' :
178
	exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
174
	exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
179
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
175
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
180
	break;
176
	break;
181
case 'Reject_list' :
177
case 'Reject_list' :
182
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
178
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
183
	break;
179
	break;
184
case 'MAJ_cat_wl' :
180
case 'MAJ_cat_wl' :
185
	if (file_exists($wl_categories_enabled))
181
	if (file_exists($wl_categories_enabled))
186
	{
182
	{
187
		exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
183
		exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
188
		$pointeur=fopen($wl_categories_enabled, "a+");
184
		$pointeur=fopen($wl_categories_enabled, "a+");
189
		foreach ($_POST as $key => $value)
185
		foreach ($_POST as $key => $value)
190
		{
186
		{
191
			if (strstr($key,'chk-'))
187
			if (strstr($key,'chk-'))
192
			{
188
			{
193
				$line=str_replace('chk-','',$key)."\n";
189
				$line=str_replace('chk-','',$key)."\n";
194
				fwrite($pointeur,$line);
190
				fwrite($pointeur,$line);
195
			}
191
			}
196
		}
192
		}
197
 
193
 
198
		fclose($pointeur);
194
		fclose($pointeur);
199
	}
195
	}
200
	else {echo "$l_error_open_file $wl_categories_enabled";}
196
	else {echo "$l_error_open_file $wl_categories_enabled";}
201
	$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
197
	$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
202
	fputs($fichier, form_filter($_POST['OSSI_wl']));
198
	fputs($fichier, form_filter($_POST['OSSI_wl']));
203
	fclose($fichier);
199
	fclose($fichier);
204
	unset($_POST['OSSI_wl']);
200
	unset($_POST['OSSI_wl']);
205
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
201
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
206
	break;
202
	break;
207
case 'Specific_filtering' :
203
case 'Specific_filtering' :
208
	$safesearch="-safesearch_off"; ;
204
	$safesearch="-safesearch_off"; ;
209
	foreach ($_POST as $key => $value)
205
	foreach ($_POST as $key => $value)
210
	{
206
	{
211
		if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
207
		if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
212
	}
208
	}
213
	exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh $safesearch");
209
	exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh $safesearch");
214
	break;
210
	break;
215
case 'MAJ_ossi_file' :
211
case 'MAJ_ossi_file' :
216
	foreach($_POST as $fichier => $value)
212
	foreach($_POST as $fichier => $value)
217
	{
213
	{
218
		if($fichier != "choix")
214
		if($fichier != "choix")
219
		{
215
		{
220
			$action=$_POST[$fichier];
216
			$action=$_POST[$fichier];
221
			if($action == $l_remove) //delete
217
			if($action == $l_remove) //delete
222
			{
218
			{
223
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
219
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
224
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
220
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
225
				exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
221
				exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
226
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
222
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
227
			}
223
			}
228
			if($action == $l_disable) //disable
224
			if($action == $l_disable) //disable
229
			{
225
			{
230
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
226
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
231
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
227
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
232
			}
228
			}
233
			if($action == $l_enable) //enable
229
			if($action == $l_enable) //enable
234
			{
230
			{
235
				file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
231
				file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
236
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
232
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
237
			}
233
			}
238
		}
234
		}
239
	}
235
	}
240
	break;
236
	break;
241
case 'MAJ_ossi_file_upload' :
237
case 'MAJ_ossi_file_upload' :
242
	$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
238
	$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
243
	if(!empty($file_name))
239
	if(!empty($file_name))
244
	{
240
	{
245
		$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
241
		$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
246
		exec("mkdir ".escapeshellarg($dest_dir));
242
		exec("mkdir ".escapeshellarg($dest_dir));
247
		$file=$_FILES['fichier_ip']['tmp_name'];
243
		$file=$_FILES['fichier_ip']['tmp_name'];
248
		exec('/usr/bin/dos2unix '.escapeshellarg($file));
244
		exec('/usr/bin/dos2unix '.escapeshellarg($file));
249
		if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains"))
245
		if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains"))
250
		{
246
		{
251
			touch ($dest_dir."/urls"); // create the URL file even if it isn't used
247
			touch ($dest_dir."/urls"); // create the URL file even if it isn't used
252
			file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
248
			file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
253
			file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
249
			file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
254
			exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
250
			exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
255
		}
251
		}
256
		else
252
		else
257
		{
253
		{
258
			exec("rm -rf ".escapeshellarg($dest_dir));
254
			exec("rm -rf ".escapeshellarg($dest_dir));
259
			echo $l_error_upload;
255
			echo $l_error_upload;
260
		}
256
		}
261
	}
257
	}
262
	break;
258
	break;
263
}
259
}
264
?>
260
?>
265
<table width="100%" border="0" cellspacing="0" cellpadding="0">
261
<table width="100%" border="0" cellspacing="0" cellpadding="0">
266
	<tr><th><?php echo $l_wl; ?></th></tr>
262
	<tr><th><?php echo $l_wl; ?></th></tr>
267
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
263
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
268
</table>
264
</table>
269
<table width="100%" border=1 cellspacing=0 cellpadding=1>
265
<table width="100%" border=1 cellspacing=0 cellpadding=1>
270
<tr><td valign="middle" align="left" colspan=10>
266
<tr><td valign="middle" align="left" colspan=10>
271
<FORM action='wl_filter.php' method=POST>
267
<FORM action='wl_filter.php' method=POST>
272
<input type='hidden' name='choix' value='MAJ_cat_wl'>
268
<input type='hidden' name='choix' value='MAJ_cat_wl'>
273
<?php
269
<?php
274
echo "<center>";
270
echo "<center>";
275
// total number of IP, DNS & URLs
271
// total number of IP, DNS & URLs
276
$nbDomainNames = exec("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
272
$nbDomainNames = exec("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
277
$nbUrl = "0";
273
$nbUrl = "0";
278
$nbIp = exec("wc -l /usr/local/share/iptables-wl/* | tail -n 1 | awk '{print $1}'");
274
$nbIp = exec("wc -l /usr/local/share/iptables-wl/* | tail -n 1 | awk '{print $1}'");
279
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
275
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
280
echo "$l_wl_categories</center></td></tr>";
276
echo "$l_wl_categories</center></td></tr>";
281
//read & display all WL categories (checked or not)
277
//read & display all WL categories (checked or not)
282
$cols=1;
278
$cols=1;
283
if (file_exists($wl_categories))
279
if (file_exists($wl_categories))
284
	{
280
	{
285
	$wl_files = file($wl_categories);
281
	$wl_files = file($wl_categories);
286
	$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
282
	$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
287
	foreach($wl_files as $fichier => $value)
283
	foreach($wl_files as $fichier => $value)
288
		{
284
		{
289
		if ($cols == 1) { echo "<tr>";}
285
		if ($cols == 1) { echo "<tr>";}
290
		$categorie=trim(basename($value));
286
		$categorie=trim(basename($value));
291
		echo "<td><a href='bl_categories_help.php?liste=wl&cat=$categorie' target='cat_help' onclick=window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>$categorie</a><br>";
287
		echo "<td><a href='bl_categories_help.php?liste=wl&cat=$categorie' target='cat_help' onclick=window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>$categorie</a><br>";
292
		echo "<input type='checkbox' name='chk-$categorie'";
288
		echo "<input type='checkbox' name='chk-$categorie'";
293
		// if the line is commented, the category is disable
289
		// if the line is commented, the category is disable
294
		if (preg_match('/^#/',$value, $r)) { echo ">";}
290
		if (preg_match('/^#/',$value, $r)) { echo ">";}
295
		else { echo "checked>"; }
291
		else { echo "checked>"; }
296
		echo "</td>";
292
		echo "</td>";
297
		$cols++;
293
		$cols++;
298
		if ($cols > 10) {
294
		if ($cols > 10) {
299
			echo "</tr>";
295
			echo "</tr>";
300
			$cols=1; }
296
			$cols=1; }
301
		}
297
		}
302
	}
298
	}
303
else	{
299
else	{
304
	echo "$l_error_open_file $wl_categories";
300
	echo "$l_error_open_file $wl_categories";
305
}
301
}
306
echo "<tr><td valign='middle' align='left' colspan=10>";
302
echo "<tr><td valign='middle' align='left' colspan=10>";
307
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
303
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
308
echo "<tr><td width=100% colspan=10 align=center>";
304
echo "<tr><td width=100% colspan=10 align=center>";
309
echo "$l_one_dns_ip<BR>";
305
echo "$l_one_dns_ip<BR>";
310
echo "<textarea name='OSSI_wl' rows=3 cols=40>";
306
echo "<textarea name='OSSI_wl' rows=3 cols=40>";
311
echo_file ($dir_blacklist."ossi-wl/domains");
307
echo_file ($dir_blacklist."ossi-wl/domains");
312
echo "</textarea></td>";
308
echo "</textarea></td>";
313
echo "</tr><tr><td colspan=10>";
309
echo "</tr><tr><td colspan=10>";
314
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
310
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
315
echo "</form> ($l_wait)";
311
echo "</form> ($l_wait)";
316
echo "</td></tr></table><br/>";
312
echo "</td></tr></table><br/>";
317
?>
313
?>
318
<table width="100%" border="0" cellspacing="0" cellpadding="0">
314
<table width="100%" border="0" cellspacing="0" cellpadding="0">
319
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
315
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
320
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
316
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
321
</table>
317
</table>
322
<table width="100%" border=1 cellspacing=0 cellpadding=1>
318
<table width="100%" border=1 cellspacing=0 cellpadding=1>
323
<form action='wl_filter.php' method='POST'>
319
<form action='wl_filter.php' method='POST'>
324
<input type='hidden' name='choix' value='MAJ_ossi_file'>
320
<input type='hidden' name='choix' value='MAJ_ossi_file'>
325
<?php
321
<?php
326
echo "<tr><td width=50% colspan=5 align=center>";
322
echo "<tr><td width=50% colspan=5 align=center>";
327
echo "<H3>$l_file_list</H3>";
323
echo "<H3>$l_file_list</H3>";
328
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=2>$l_file_action</tr>";
324
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=2>$l_file_action</tr>";
329
 
325
 
330
//list OSSI custom categories
326
//list OSSI custom categories
331
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
327
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
332
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
328
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
333
foreach($fichierswl as $fichier => $value)
329
foreach($fichierswl as $fichier => $value)
334
{
330
{
335
	echo "<tr><td><center><a href='bl_categories_help.php?liste=wl&cat=$value&filtre=domain' target='cat_help' onclick=window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_wl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_wl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
331
	echo "<tr><td><center><a href='bl_categories_help.php?liste=wl&cat=$value&filtre=domain' target='cat_help' onclick=window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_wl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_wl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
336
	if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
332
	if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
337
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
333
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
338
}
334
}
339
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
335
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
340
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
336
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
341
echo "<H3>$l_add_file</H3>";
337
echo "<H3>$l_add_file</H3>";
342
echo "$l_add_file_explain";
338
echo "$l_add_file_explain";
343
echo "<input type='file' name='fichier_ip'>";
339
echo "<input type='file' name='fichier_ip'>";
344
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
340
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
345
echo "</td></tr>";
341
echo "</td></tr>";
346
echo "</form>";
342
echo "</form>";
347
echo "</table><br/>";
343
echo "</table><br/>";
348
?>
344
?>
349
<table width="100%" border="0" cellspacing="0" cellpadding="0">
345
<table width="100%" border="0" cellspacing="0" cellpadding="0">
350
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
346
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
351
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
347
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
352
</table>
348
</table>
353
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
349
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
354
<FORM action='wl_filter.php' method='POST'>
350
<FORM action='wl_filter.php' method='POST'>
355
<input type='hidden' name='choix' value='Specific_filtering'>
351
<input type='hidden' name='choix' value='Specific_filtering'>
356
<tr><td>
352
<tr><td>
357
<input type='checkbox' name='chk-safesearch'
353
<input type='checkbox' name='chk-safesearch'
358
<?php
354
<?php
359
// verify "safesearch" filtering state
355
// verify "safesearch" filtering state
360
if (file_exists($iptables_safesearch_file))
356
if (file_exists($iptables_safesearch_file))
361
{
357
{
362
	echo " checked";
358
	echo " checked";
363
}
359
}
364
echo "> $l_safe_searching";
360
echo "> $l_safe_searching<tr><td>";
365
echo "<br>$l_safe_youtube";
-
 
366
echo " $l_youtube_id<tr><td>";
-
 
367
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'></td></tr>";
361
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'></td></tr>";
368
?>
362
?>
369
</FORM>
363
</FORM>
370
</TABLE>
364
</TABLE>
371
</BODY>
365
</BODY>
372
</HTML>
366
</HTML>
373
 
367