Subversion Repositories ALCASAR

Rev

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

Rev 2662 Rev 2688
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
			}
-
 
50
		}
49
		}
-
 
50
	}
51
	else
51
	else
52
		{
52
	{
53
		echo "$filename doesn't exist";
53
		echo "$filename doesn't exist";
54
		}
-
 
55
	}
54
	}
-
 
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 pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
82
	$l_safe_searching="Activer le contrôle scolaire/parental pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
83
	$l_error_open_file="Erreur d'ouverture du fichier";
83
	$l_error_open_file="Erreur d'ouverture du fichier";
84
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
84
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
85
	$l_file_list="Liste des fichiers";
85
	$l_file_list="Liste des fichiers";
86
	$l_add_file="Ajouter un fichier";
86
	$l_add_file="Ajouter un fichier";
87
	$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";
88
	$l_file_name="Nom du fichier";
88
	$l_file_name="Nom du fichier";
89
	$l_file_action="Action";
89
	$l_file_action="Action";
90
	$l_error_upload="Erreur d'envoi du fichier";
90
	$l_error_upload="Erreur d'envoi du fichier";
91
	$l_remove="Supprimer";
91
	$l_remove="Supprimer";
92
	$l_submit="Envoyer";
92
	$l_submit="Envoyer";
93
	$l_nb_ip="Nombre d'IP";
93
	$l_nb_ip="Nombre d'IP";
94
	$l_nb_domain_names="Nombre de noms de domaine";
94
	$l_nb_domain_names="Nombre de noms de domaine";
95
	$l_nbDomainNames="Noms de domaine :";
95
	$l_nbDomainNames="Noms de domaine :";
96
	$l_nbUrl="Url :";
96
	$l_nbUrl="Url :";
97
	$l_nbIp="Ip :";
97
	$l_nbIp="Ip :";
98
	$l_disable="Désactiver";
98
	$l_disable="Désactiver";
99
	$l_enable="Activer";
99
	$l_enable="Activer";
100
	$l_file_state="Etat";
100
	$l_file_state="Etat";
101
}
101
}
102
else {
102
else {
103
	$l_wl="General WhiteList";
103
	$l_wl="General WhiteList";
104
	$l_load="Loading...";
104
	$l_load="Loading...";
105
	$l_list_version="List version : ";
105
	$l_list_version="List version : ";
106
	$l_wl_categories="Select the allowed categories";
106
	$l_wl_categories="Select the allowed categories";
107
	$l_specific_filtering="Specific filtering";
107
	$l_specific_filtering="Specific filtering";
108
	$l_allowed_dns="Allowed domain names";
108
	$l_allowed_dns="Allowed domain names";
109
	$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";
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";
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";
111
	$l_record="Save changes";
111
	$l_record="Save changes";
112
	$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";
113
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
113
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
114
	$l_error_open_file="Error opening file";
114
	$l_error_open_file="Error opening file";
115
	$l_additional_file_title="Additional WhiteList files";
115
	$l_additional_file_title="Additional WhiteList files";
116
	$l_file_list="Files list";
116
	$l_file_list="Files list";
117
	$l_add_file="Add a file";
117
	$l_add_file="Add a file";
118
	$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";
119
	$l_file_name="Filename";
119
	$l_file_name="Filename";
120
	$l_file_action="Action";
120
	$l_file_action="Action";
121
	$l_error_upload="Error during the upload process";
121
	$l_error_upload="Error during the upload process";
122
	$l_remove="Delete";
122
	$l_remove="Delete";
123
	$l_submit="Submit";
123
	$l_submit="Submit";
124
	$l_nb_ip="Number of IP";
124
	$l_nb_ip="Number of IP";
125
	$l_nb_domain_names="Number of domain names";
125
	$l_nb_domain_names="Number of domain names";
126
	$l_nbDomainNames="Domain names :";
126
	$l_nbDomainNames="Domain names :";
127
	$l_nbUrl="Url :";
127
	$l_nbUrl="Url :";
128
	$l_nbIp="Ip :";
128
	$l_nbIp="Ip :";
129
	$l_disable="Disable";
129
	$l_disable="Disable";
130
	$l_enable="Enable";
130
	$l_enable="Enable";
131
	$l_file_state="State";
131
	$l_file_state="State";
132
}
132
}
133
$dir_etc="/usr/local/etc/";
133
$dir_etc="/usr/local/etc/";
134
$dir_dg="/etc/e2guardian/lists/";
134
$dir_dg="/etc/e2guardian/lists/";
135
$dir_blacklist=$dir_dg."blacklists/";
135
$dir_blacklist=$dir_dg."blacklists/";
136
$dir_wl_ip="/usr/local/share/iptables-wl/";
136
$dir_wl_ip="/usr/local/share/iptables-wl/";
137
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
137
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
138
$dir_wl_domain_names= "/usr/local/share/dnsmasq-wl/";
138
$dir_wl_domain_names= "/usr/local/share/unbound-wl/";
139
$dir_wl_domain_names_enabled= "/usr/local/share/dnsmasq-wl-enabled/";
139
$dir_wl_domain_names_enabled= "/usr/local/share/unbound-wl-enabled/";
140
$wl_categories=$dir_etc."alcasar-wl-categories";
140
$wl_categories=$dir_etc."alcasar-wl-categories";
141
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
141
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
142
$conf_file=$dir_etc."alcasar.conf";
142
$conf_file=$dir_etc."alcasar.conf";
143
$iptables_safesearch_file=$dir_wl_ip_enabled."ossi-ip-safesearch";
143
$domainfilter_file="/etc/unbound/conf.d/whitelist/domainfilter.conf";
144
$bannedsite_file=$dir_dg."bannedsitelist";
144
$bannedsite_file=$dir_dg."bannedsitelist";
145
$dir_tmp="/tmp/blacklists";
145
$dir_tmp="/tmp/blacklists";
146
 
146
 
-
 
147
$wl_safesearch="off";
147
 
148
 
148
# default values
149
# default values
149
if (is_file ($conf_file))
150
if (is_file ($conf_file))
150
	{
151
{
151
	$tab=file($conf_file);
152
	$tab=file($conf_file);
152
	if ($tab)
153
	if ($tab)
153
		{
154
	{
154
		foreach ($tab as $line)
155
		foreach ($tab as $line)
155
			{
156
		{
156
			$field=explode("=", $line);
157
			$field=explode("=", $line);
157
			if ($field[0] == "PRIVATE_IP")
158
			switch ($field[0]) {
158
				{
159
				case 'PRIVATE_IP':
159
				$PRIVATE_IP_MASK=trim($field[1]);
160
					$PRIVATE_IP_MASK=trim($field[1]);
160
				$tmp = explode("/",$PRIVATE_IP_MASK);
161
					$tmp = explode("/",$PRIVATE_IP_MASK);
161
				$PRIVATE_IP=$tmp[0];
162
					$PRIVATE_IP=$tmp[0];
-
 
163
					break;
-
 
164
 
-
 
165
				case 'WL_SAFESEARCH':
-
 
166
					if (strtolower(trim($field[1])) == 'on') {
-
 
167
						$wl_safesearch='on';
162
				}
168
					}
-
 
169
					break;
163
			}
170
			}
164
		}
171
		}
165
	}
172
	}
-
 
173
}
166
else { echo "$l_error_open_file $conf_file";}
174
else { echo "$l_error_open_file $conf_file";}
167
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
175
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
168
switch ($choix)
176
switch ($choix)
169
{
177
{
170
case 'Download_list' :
178
	case 'Download_list' :
171
	exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
179
		exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
172
	break;
180
		break;
173
case 'Active_list' :
181
	case 'Active_list' :
174
	exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
182
		exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
175
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
183
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
176
	break;
184
		break;
177
case 'Reject_list' :
185
	case 'Reject_list' :
178
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
186
		unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
179
	break;
187
		break;
180
case 'MAJ_cat_wl' :
188
	case 'MAJ_cat_wl' :
181
	if (file_exists($wl_categories_enabled))
189
		if (file_exists($wl_categories_enabled))
182
	{
-
 
183
		exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
-
 
184
		$pointeur=fopen($wl_categories_enabled, "a+");
-
 
185
		foreach ($_POST as $key => $value)
-
 
186
		{
190
		{
-
 
191
			exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
-
 
192
			$pointeur=fopen($wl_categories_enabled, "a+");
187
			if (strstr($key,'chk-'))
193
			foreach ($_POST as $key => $value)
188
			{
194
			{
-
 
195
				if (strstr($key,'chk-'))
-
 
196
				{
189
				$line=str_replace('chk-','',$key)."\n";
197
					$line=str_replace('chk-','',$key)."\n";
190
				fwrite($pointeur,$line);
198
					fwrite($pointeur,$line);
-
 
199
				}
191
			}
200
			}
192
		}
-
 
193
 
201
 
194
		fclose($pointeur);
202
			fclose($pointeur);
195
	}
203
		}
196
	else {echo "$l_error_open_file $wl_categories_enabled";}
204
		else {echo "$l_error_open_file $wl_categories_enabled";}
197
	$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
205
		$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
198
	fputs($fichier, form_filter($_POST['OSSI_wl']));
206
		fputs($fichier, form_filter($_POST['OSSI_wl']));
199
	fclose($fichier);
207
		fclose($fichier);
200
	unset($_POST['OSSI_wl']);
208
		unset($_POST['OSSI_wl']);
201
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
209
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
202
	break;
210
		break;
203
case 'Specific_filtering' :
211
	case 'Specific_filtering' :
204
	$safesearch="-safesearch_off"; ;
212
		$wl_safesearch='off';
205
	foreach ($_POST as $key => $value)
213
		foreach ($_POST as $key => $value)
206
	{
214
		{
207
		if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
215
			if (strstr($key,'chk-safesearch')) {
-
 
216
				$wl_safesearch='on';
-
 
217
			}
208
	}
218
		}
209
	exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh $safesearch");
219
		exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh -safesearch_$wl_safesearch");
210
	break;
220
		break;
211
case 'MAJ_ossi_file' :
221
	case 'MAJ_ossi_file' :
212
	foreach($_POST as $fichier => $value)
222
		foreach($_POST as $fichier => $value)
213
	{
-
 
214
		if($fichier != "choix")
-
 
215
		{
223
		{
216
			$action=$_POST[$fichier];
-
 
217
			if($action == $l_remove) //delete
224
			if($fichier != "choix")
218
			{
225
			{
-
 
226
				$action=$_POST[$fichier];
-
 
227
				if($action == $l_remove) //delete
-
 
228
				{
219
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
229
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
220
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
230
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
221
				exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
231
					exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
-
 
232
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
233
				}
-
 
234
				if($action == $l_disable) //disable
-
 
235
				{
-
 
236
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
-
 
237
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
238
				}
-
 
239
				if($action == $l_enable) //enable
-
 
240
				{
-
 
241
					file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
222
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
242
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
243
				}
223
			}
244
			}
-
 
245
		}
-
 
246
		break;
-
 
247
	case 'MAJ_ossi_file_upload' :
-
 
248
		$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
-
 
249
		if(!empty($file_name))
-
 
250
		{
-
 
251
			$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
224
			if($action == $l_disable) //disable
252
			exec("mkdir ".escapeshellarg($dest_dir));
-
 
253
			$file=$_FILES['fichier_ip']['tmp_name'];
-
 
254
			exec('/usr/bin/dos2unix '.escapeshellarg($file));
-
 
255
			if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains"))
225
			{
256
			{
226
				exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
257
				touch ($dest_dir."/urls"); // create the URL file even if it isn't used
-
 
258
				file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
-
 
259
				file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
227
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
260
				exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
228
			}
261
			}
229
			if($action == $l_enable) //enable
262
			else
230
			{
263
			{
231
				file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
264
				exec("rm -rf ".escapeshellarg($dest_dir));
232
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
265
				echo $l_error_upload;
233
			}
266
			}
234
		}
267
		}
235
	}
-
 
236
	break;
268
		break;
237
case 'MAJ_ossi_file_upload' :
-
 
238
	$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
-
 
239
	if(!empty($file_name))
-
 
240
	{
-
 
241
		$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
-
 
242
		exec("mkdir ".escapeshellarg($dest_dir));
-
 
243
		$file=$_FILES['fichier_ip']['tmp_name'];
-
 
244
		exec('/usr/bin/dos2unix '.escapeshellarg($file));
-
 
245
		if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains"))
-
 
246
		{
-
 
247
			touch ($dest_dir."/urls"); // create the URL file even if it isn't used
-
 
248
			file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
-
 
249
			file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
-
 
250
			exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
251
		}
-
 
252
		else
-
 
253
		{
-
 
254
			exec("rm -rf ".escapeshellarg($dest_dir));
-
 
255
			echo $l_error_upload;
-
 
256
		}
-
 
257
	}
-
 
258
	break;
-
 
259
}
269
}
260
?>
270
?>
261
<table width="100%" border="0" cellspacing="0" cellpadding="0">
271
<table width="100%" border="0" cellspacing="0" cellpadding="0">
262
	<tr><th><?php echo $l_wl; ?></th></tr>
272
	<tr><th><?php echo $l_wl; ?></th></tr>
263
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
273
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
264
</table>
274
</table>
265
<table width="100%" border=1 cellspacing=0 cellpadding=1>
275
<table width="100%" border=1 cellspacing=0 cellpadding=1>
266
<tr><td valign="middle" align="left" colspan=10>
276
<tr><td valign="middle" align="left" colspan=10>
267
<FORM action='wl_filter.php' method=POST>
277
<FORM action='wl_filter.php' method=POST>
268
<input type='hidden' name='choix' value='MAJ_cat_wl'>
278
<input type='hidden' name='choix' value='MAJ_cat_wl'>
269
<?php
279
<?php
270
echo "<center>";
280
echo "<center>";
271
// total number of IP, DNS & URLs
281
// total number of IP, DNS & URLs
272
$nbDomainNames = exec("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
282
$nbDomainNames = exec("wc -l $dir_wl_domain_names* | tail -n 1 | awk '{print $1}'");
273
$nbUrl = "0";
283
$nbUrl = "0";
274
$nbIp = exec("wc -l /usr/local/share/iptables-wl/* | tail -n 1 | awk '{print $1}'");
284
$nbIp = exec("wc -l $dir_wl_ip* | tail -n 1 | awk '{print $1}'");
275
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
285
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
276
echo "$l_wl_categories</center></td></tr>";
286
echo "$l_wl_categories</center></td></tr>";
277
//read & display all WL categories (checked or not)
287
//read & display all WL categories (checked or not)
278
$cols=1;
288
$cols=1;
279
if (file_exists($wl_categories))
289
if (file_exists($wl_categories))
280
	{
290
{
281
	$wl_files = file($wl_categories);
291
	$wl_files = file($wl_categories);
282
	$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
292
	$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
283
	foreach($wl_files as $fichier => $value)
293
	foreach($wl_files as $fichier => $value)
284
		{
294
	{
285
		if ($cols == 1) { echo "<tr>";}
295
		if ($cols == 1) { echo "<tr>";}
286
		$categorie=trim(basename($value));
296
		$categorie=trim(basename($value));
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>";
297
		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>";
288
		echo "<input type='checkbox' name='chk-$categorie'";
298
		echo "<input type='checkbox' name='chk-$categorie'";
289
		// if the line is commented, the category is disable
299
		// if the line is commented, the category is disable
290
		if (preg_match('/^#/',$value, $r)) { echo ">";}
300
		if (preg_match('/^#/',$value, $r)) { echo ">";}
291
		else { echo "checked>"; }
301
		else { echo "checked>"; }
292
		echo "</td>";
302
		echo "</td>";
293
		$cols++;
303
		$cols++;
294
		if ($cols > 10) {
304
		if ($cols > 10) {
295
			echo "</tr>";
305
			echo "</tr>";
296
			$cols=1; }
306
			$cols=1;
297
		}
307
		}
298
	}
308
	}
-
 
309
}
299
else	{
310
else {
300
	echo "$l_error_open_file $wl_categories";
311
	echo "$l_error_open_file $wl_categories";
301
}
312
}
302
echo "<tr><td valign='middle' align='left' colspan=10>";
313
echo "<tr><td valign='middle' align='left' colspan=10>";
303
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
314
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
304
echo "<tr><td width=100% colspan=10 align=center>";
315
echo "<tr><td width=100% colspan=10 align=center>";
305
echo "$l_one_dns_ip<BR>";
316
echo "$l_one_dns_ip<BR>";
306
echo "<textarea name='OSSI_wl' rows=3 cols=40>";
317
echo "<textarea name='OSSI_wl' rows=3 cols=40>";
307
echo_file ($dir_blacklist."ossi-wl/domains");
318
echo_file ($dir_blacklist."ossi-wl/domains");
308
echo "</textarea></td>";
319
echo "</textarea></td>";
309
echo "</tr><tr><td colspan=10>";
320
echo "</tr><tr><td colspan=10>";
310
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
321
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
311
echo "</form> ($l_wait)";
322
echo "</form> ($l_wait)";
312
echo "</td></tr></table><br/>";
323
echo "</td></tr></table><br/>";
313
?>
324
?>
314
<table width="100%" border="0" cellspacing="0" cellpadding="0">
325
<table width="100%" border="0" cellspacing="0" cellpadding="0">
315
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
326
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
316
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
327
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
317
</table>
328
</table>
318
<table width="100%" border=1 cellspacing=0 cellpadding=1>
329
<table width="100%" border=1 cellspacing=0 cellpadding=1>
319
<form action='wl_filter.php' method='POST'>
330
<form action='wl_filter.php' method='POST'>
320
<input type='hidden' name='choix' value='MAJ_ossi_file'>
331
<input type='hidden' name='choix' value='MAJ_ossi_file'>
321
<?php
332
<?php
322
echo "<tr><td width=50% colspan=5 align=center>";
333
echo "<tr><td width=50% colspan=5 align=center>";
323
echo "<H3>$l_file_list</H3>";
334
echo "<H3>$l_file_list</H3>";
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>";
335
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>";
325
 
336
 
326
//list OSSI custom categories
337
//list OSSI custom categories
327
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
338
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
328
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
339
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
329
foreach($fichierswl as $fichier => $value)
340
foreach($fichierswl as $fichier => $value)
330
{
341
{
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'";
342
	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'";
332
	if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
343
	if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
333
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
344
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
334
}
345
}
335
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
346
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
336
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
347
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
337
echo "<H3>$l_add_file</H3>";
348
echo "<H3>$l_add_file</H3>";
338
echo "$l_add_file_explain";
349
echo "$l_add_file_explain";
339
echo "<input type='file' name='fichier_ip'>";
350
echo "<input type='file' name='fichier_ip'>";
340
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
351
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
341
echo "</td></tr>";
352
echo "</td></tr>";
342
echo "</form>";
353
echo "</form>";
343
echo "</table><br/>";
354
echo "</table><br/>";
344
?>
355
?>
345
<table width="100%" border="0" cellspacing="0" cellpadding="0">
356
<table width="100%" border="0" cellspacing="0" cellpadding="0">
346
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
357
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
347
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
358
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
348
</table>
359
</table>
349
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
360
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
350
<FORM action='wl_filter.php' method='POST'>
361
<FORM action='wl_filter.php' method='POST'>
351
<input type='hidden' name='choix' value='Specific_filtering'>
362
<input type='hidden' name='choix' value='Specific_filtering'>
352
<tr><td>
363
<tr><td>
353
<input type='checkbox' name='chk-safesearch'
364
<input type='checkbox' name='chk-safesearch' <?= $wl_safesearch == 'on' ? 'checked' : ''; ?>><?= $l_safe_searching; ?>
354
<?php
365
</tr></td>
355
// verify "safesearch" filtering state
-
 
356
if (file_exists($iptables_safesearch_file))
-
 
357
{
-
 
358
	echo " checked";
366
<tr><td>
359
}
-
 
360
echo "> $l_safe_searching<tr><td>";
-
 
361
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'></td></tr>";
367
<?= "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>"; ?>
362
?>
-
 
363
</FORM>
368
</td></tr></FORM>
364
</TABLE>
369
</TABLE>
365
</BODY>
370
</BODY>
366
</HTML>
371
</HTML>
367
 
372