Line 8... |
Line 8... |
8 |
<body>
|
8 |
<body>
|
9 |
<div id="ldoverlay" class="overlay">
|
9 |
<div id="ldoverlay" class="overlay">
|
10 |
<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
|
10 |
<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
|
11 |
</div>
|
11 |
</div>
|
12 |
<?
|
12 |
<?
|
13 |
function form_filter ($form_content)
|
13 |
function form_filter ($form_content){
|
14 |
{
|
- |
|
15 |
// réencodage iso + format unix + rc fin de ligne (ouf...)
|
14 |
// Re-encoding : ISO + unix format + end-of-line
|
16 |
$list = str_replace("\r\n", "\n", utf8_decode($form_content));
|
15 |
$list = str_replace("\r\n", "\n", utf8_decode($form_content));
|
17 |
if (strlen($list) != 0){
|
16 |
if (strlen($list) != 0){
|
18 |
if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
|
17 |
if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
|
19 |
return $list;
|
18 |
return $list;
|
20 |
}
|
19 |
}
|
- |
|
20 |
|
21 |
function form_filter_ip($form_content, $color)
|
21 |
function form_filter_ip($form_content, $color){
|
22 |
{
|
- |
|
23 |
//# reconstruction des ip
|
22 |
// IP reconstruction
|
24 |
$list = explode("\n", form_filter($form_content));
|
23 |
$list = explode("\n", form_filter($form_content));
|
25 |
$new_list = "";
|
24 |
$new_list = "";
|
26 |
foreach ($list as &$value)
|
25 |
foreach ($list as &$value){
|
27 |
{
|
- |
|
28 |
if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
|
26 |
if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value)){
|
29 |
{
|
- |
|
30 |
$new_list = $new_list.$value."\n";
|
27 |
$new_list = $new_list.$value."\n";
|
31 |
}
|
28 |
}
|
32 |
}
|
29 |
}
|
33 |
if($color == "white")
|
30 |
if($color == "white"){
|
34 |
{
|
- |
|
35 |
return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
|
31 |
return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
|
36 |
}
|
32 |
}
|
37 |
else
|
33 |
else {
|
38 |
{
|
- |
|
39 |
return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
|
34 |
return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
|
40 |
}
|
35 |
}
|
41 |
}
|
36 |
}
|
- |
|
37 |
|
42 |
function echo_file ($filename)
|
38 |
function echo_file ($filename){
|
43 |
{
|
- |
|
44 |
if (file_exists($filename))
|
39 |
if (file_exists($filename)){
|
45 |
{
|
- |
|
46 |
if (filesize($filename) != 0)
|
40 |
if (filesize($filename) != 0){
|
47 |
{
|
- |
|
48 |
$pointeur=fopen($filename,"r");
|
41 |
$pointeur=fopen($filename,"r");
|
49 |
$tampon = fread($pointeur, filesize($filename));
|
42 |
$tampon = fread($pointeur, filesize($filename));
|
50 |
fclose($pointeur);
|
43 |
fclose($pointeur);
|
51 |
echo $tampon;
|
44 |
echo $tampon;
|
52 |
}
|
45 |
}
|
53 |
}
|
46 |
}
|
54 |
else
|
47 |
else {
|
55 |
{
|
- |
|
56 |
echo "$filename doesn't exist";
|
48 |
echo "$filename doesn't exist";
|
57 |
}
|
49 |
}
|
58 |
}
|
50 |
}
|
- |
|
51 |
|
59 |
function echo_ip_file ($filename)
|
52 |
function echo_ip_file ($filename){
|
60 |
{
|
- |
|
61 |
$filename = escapeshellarg($filename);
|
53 |
$filename = escapeshellarg($filename);
|
62 |
exec("cat $filename | cut -d ' ' -f3", $resultat);
|
54 |
exec("cat $filename | cut -d ' ' -f3", $resultat);
|
63 |
for($i=0; $i<exec("wc -l $filename"); $i++)
|
55 |
for($i=0; $i<exec("wc -l $filename"); $i++){
|
64 |
{
|
- |
|
65 |
echo $resultat[$i]."\n";
|
56 |
echo $resultat[$i]."\n";
|
66 |
}
|
57 |
}
|
67 |
}
|
58 |
}
|
68 |
|
59 |
|
69 |
# Choice of language
|
60 |
# Choice of language
|
Line 72... |
Line 63... |
72 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
63 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
73 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
64 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
74 |
}
|
65 |
}
|
75 |
if($Language == 'fr'){
|
66 |
if($Language == 'fr'){
|
76 |
$l_wl="Liste blanche principale";
|
67 |
$l_wl="Liste blanche principale";
|
- |
|
68 |
$l_state="Sont actuellement autorisés : ";
|
77 |
$l_load="Chargement...";
|
69 |
$l_load="Chargement...";
|
78 |
$l_list_version="Version de la liste : ";
|
70 |
$l_list_version="Version de la liste : ";
|
79 |
$l_wl_categories="Sélectionnez les catégories à autoriser";
|
71 |
$l_wl_categories="Sélectionnez les catégories à autoriser";
|
80 |
$l_specific_filtering="Filtrage special";
|
72 |
$l_specific_filtering="Filtrage special";
|
81 |
$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
|
73 |
$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
|
Line 93... |
Line 85... |
93 |
$l_error_upload="Erreur d'envoi du fichier";
|
85 |
$l_error_upload="Erreur d'envoi du fichier";
|
94 |
$l_remove="Supprimer";
|
86 |
$l_remove="Supprimer";
|
95 |
$l_submit="Envoyer";
|
87 |
$l_submit="Envoyer";
|
96 |
$l_nb_ip="Nombre d'IP";
|
88 |
$l_nb_ip="Nombre d'IP";
|
97 |
$l_nb_domain_names="Nombre de noms de domaine";
|
89 |
$l_nb_domain_names="Nombre de noms de domaine";
|
98 |
$l_nbDomainNames="Noms de domaine :";
|
90 |
$l_nbDomainNames="noms de domaine";
|
99 |
$l_nbUrl="Url :";
|
91 |
$l_nbUrl="URL";
|
100 |
$l_nbIp="Ip :";
|
92 |
$l_nbIp="@IP";
|
101 |
$l_disable="Désactiver";
|
93 |
$l_disable="Désactiver";
|
102 |
$l_enable="Activer";
|
94 |
$l_enable="Activer";
|
103 |
$l_file_state="Etat";
|
95 |
$l_file_state="Etat";
|
104 |
} else if($Language == 'es') {
|
96 |
} else if($Language == 'es'){
|
105 |
$l_wl="Lista blanca principal";
|
97 |
$l_wl="Lista blanca principal";
|
- |
|
98 |
$l_state="The following are currently authorized : ";
|
106 |
$l_load="Cargando...";
|
99 |
$l_load="Cargando...";
|
107 |
$l_list_version="Versión de la lista: ";
|
100 |
$l_list_version="Versión de la lista: ";
|
108 |
$l_wl_categories="Seleccione las categorías permitidas";
|
101 |
$l_wl_categories="Seleccione las categorías permitidas";
|
109 |
$l_specific_filtering="Filtrado específico";
|
102 |
$l_specific_filtering="Filtrado específico";
|
110 |
$l_add_to_wl="Nombres de dominio o direcciones IP para agregar a la lista blanca";
|
103 |
$l_add_to_wl="Nombres de dominio o direcciones IP para agregar a la lista blanca";
|
Line 122... |
Line 115... |
122 |
$l_error_upload="Error durante el proceso de carga";
|
115 |
$l_error_upload="Error durante el proceso de carga";
|
123 |
$l_remove="Borrar";
|
116 |
$l_remove="Borrar";
|
124 |
$l_submit="Enviar";
|
117 |
$l_submit="Enviar";
|
125 |
$l_nb_ip="Número de IPs";
|
118 |
$l_nb_ip="Número de IPs";
|
126 |
$l_nb_domain_names="Número de sitios";
|
119 |
$l_nb_domain_names="Número de sitios";
|
127 |
$l_nbDomainNames="Sitios:";
|
120 |
$l_nbDomainNames="sitios";
|
128 |
$l_nbUrl="Url :";
|
121 |
$l_nbUrl="URL";
|
129 |
$l_nbIp="Ip :";
|
122 |
$l_nbIp="IP@";
|
130 |
$l_disable="Desactivar";
|
123 |
$l_disable="Desactivar";
|
131 |
$l_enable="Activar";
|
124 |
$l_enable="Activar";
|
132 |
$l_file_state="Estado";
|
125 |
$l_file_state="Estado";
|
133 |
} else {
|
126 |
} else {
|
134 |
$l_wl="Main WhiteList";
|
127 |
$l_wl="Main WhiteList";
|
- |
|
128 |
$l_state="Actualmente están autorizados los siguientes : ";
|
135 |
$l_load="Loading...";
|
129 |
$l_load="Loading...";
|
136 |
$l_list_version="List version : ";
|
130 |
$l_list_version="List version : ";
|
137 |
$l_wl_categories="Select the allowed categories";
|
131 |
$l_wl_categories="Select the allowed categories";
|
138 |
$l_specific_filtering="Specific filtering";
|
132 |
$l_specific_filtering="Specific filtering";
|
139 |
$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
|
133 |
$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
|
Line 151... |
Line 145... |
151 |
$l_error_upload="Error during the upload process";
|
145 |
$l_error_upload="Error during the upload process";
|
152 |
$l_remove="Delete";
|
146 |
$l_remove="Delete";
|
153 |
$l_submit="Submit";
|
147 |
$l_submit="Submit";
|
154 |
$l_nb_ip="Number of IP";
|
148 |
$l_nb_ip="Number of IP";
|
155 |
$l_nb_domain_names="Number of domain names";
|
149 |
$l_nb_domain_names="Number of domain names";
|
156 |
$l_nbDomainNames="Domain names :";
|
150 |
$l_nbDomainNames="domain names";
|
157 |
$l_nbUrl="Url :";
|
151 |
$l_nbUrl="URL";
|
158 |
$l_nbIp="Ip :";
|
152 |
$l_nbIp="IP@";
|
159 |
$l_disable="Disable";
|
153 |
$l_disable="Disable";
|
160 |
$l_enable="Enable";
|
154 |
$l_enable="Enable";
|
161 |
$l_file_state="State";
|
155 |
$l_file_state="State";
|
162 |
}
|
156 |
}
|
163 |
$dir_etc="/usr/local/etc/";
|
157 |
$dir_etc="/usr/local/etc/";
|
164 |
$dir_dg="/etc/e2guardian/lists/";
|
158 |
$dir_dg="/etc/e2guardian/lists/";
|
165 |
$dir_blacklist=$dir_dg."blacklists/";
|
159 |
$dir_blacklist=$dir_dg."blacklists/";
|
166 |
$dir_wl_ip="/usr/local/share/iptables-wl/";
|
160 |
$dir_wl_ip="/usr/local/share/iptables-wl/";
|
167 |
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
|
161 |
$dir_wl_ip_enabled="/usr/local/share/iptables-wl-enabled/";
|
168 |
$dir_wl_domain_names= "/usr/local/share/unbound-wl/";
|
162 |
$dir_wl_domain_names="/usr/local/share/unbound-wl/";
|
169 |
$dir_wl_domain_names_enabled= "/usr/local/share/unbound-wl-enabled/";
|
163 |
$dir_wl_domain_names_enabled="/usr/local/share/unbound-wl-enabled/";
|
170 |
$wl_categories=$dir_etc."alcasar-wl-categories";
|
164 |
$wl_categories=$dir_etc."alcasar-wl-categories";
|
171 |
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
|
165 |
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
|
172 |
$conf_file=$dir_etc."alcasar.conf";
|
166 |
$conf_file=$dir_etc."alcasar.conf";
|
173 |
$domainfilter_file="/etc/unbound/conf.d/whitelist/domainfilter.conf";
|
167 |
$domainfilter_file="/etc/unbound/conf.d/whitelist/domainfilter.conf";
|
174 |
$bannedsite_file=$dir_dg."bannedsitelist";
|
168 |
$bannedsite_file=$dir_dg."bannedsitelist";
|
175 |
$dir_tmp="/tmp/blacklists";
|
169 |
$dir_tmp="/tmp/blacklists";
|
176 |
|
- |
|
177 |
$wl_safesearch="off";
|
170 |
$wl_safesearch="off";
|
178 |
|
171 |
|
179 |
# default values
|
172 |
# default values
|
180 |
if (is_file ($conf_file))
|
173 |
if (is_file ($conf_file)){
|
181 |
{
|
- |
|
182 |
$tab=file($conf_file);
|
174 |
$tab=file($conf_file);
|
183 |
if ($tab)
|
175 |
if ($tab){
|
184 |
{
|
- |
|
185 |
foreach ($tab as $line)
|
176 |
foreach ($tab as $line){
|
186 |
{
|
- |
|
187 |
$field=explode("=", $line);
|
177 |
$field=explode("=", $line);
|
188 |
switch ($field[0]) {
|
178 |
switch ($field[0]){
|
189 |
case 'PRIVATE_IP':
|
179 |
case 'PRIVATE_IP':
|
190 |
$PRIVATE_IP_MASK=trim($field[1]);
|
180 |
$PRIVATE_IP_MASK=trim($field[1]);
|
191 |
$tmp = explode("/",$PRIVATE_IP_MASK);
|
181 |
$tmp = explode("/",$PRIVATE_IP_MASK);
|
192 |
$PRIVATE_IP=$tmp[0];
|
182 |
$PRIVATE_IP=$tmp[0];
|
193 |
break;
|
183 |
break;
|
194 |
|
- |
|
195 |
case 'WL_SAFESEARCH':
|
184 |
case 'WL_SAFESEARCH':
|
196 |
if (strtolower(trim($field[1])) == 'on') {
|
185 |
if (strtolower(trim($field[1])) == 'on'){
|
197 |
$wl_safesearch='on';
|
186 |
$wl_safesearch='on';
|
198 |
}
|
187 |
}
|
199 |
break;
|
188 |
break;
|
200 |
}
|
189 |
}
|
201 |
}
|
190 |
}
|
202 |
}
|
191 |
}
|
203 |
}
|
192 |
}
|
204 |
else { echo "$l_error_open_file $conf_file";}
|
193 |
else { echo "$l_error_open_file $conf_file";}
|
205 |
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
|
194 |
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
|
206 |
switch ($choix)
|
195 |
switch ($choix){
|
207 |
{
|
- |
|
208 |
case 'Download_list' :
|
- |
|
209 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
|
- |
|
210 |
break;
|
- |
|
211 |
case 'Active_list' :
|
- |
|
212 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
|
- |
|
213 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
- |
|
214 |
break;
|
- |
|
215 |
case 'Reject_list' :
|
- |
|
216 |
unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
|
- |
|
217 |
break;
|
- |
|
218 |
case 'MAJ_cat_wl' :
|
196 |
case 'MAJ_cat_wl' :
|
219 |
if (file_exists($wl_categories_enabled))
|
197 |
if (file_exists($wl_categories_enabled)){
|
220 |
{
|
- |
|
221 |
exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
|
198 |
exec("/bin/sed -i \"/^ossi-/!d\" $wl_categories_enabled"); // keep ossi custom categories
|
222 |
$pointeur=fopen($wl_categories_enabled, "a+");
|
199 |
$pointeur=fopen($wl_categories_enabled, "a+");
|
223 |
foreach ($_POST as $key => $value)
|
200 |
foreach ($_POST as $key => $value){
|
224 |
{
|
- |
|
225 |
if (strstr($key,'chk-'))
|
201 |
if (strstr($key,'chk-')){
|
226 |
{
|
- |
|
227 |
$line=str_replace('chk-','',$key)."\n";
|
202 |
$line=str_replace('chk-','',$key)."\n";
|
228 |
fwrite($pointeur,$line);
|
203 |
fwrite($pointeur,$line);
|
229 |
}
|
204 |
}
|
230 |
}
|
205 |
}
|
231 |
|
- |
|
232 |
fclose($pointeur);
|
206 |
fclose($pointeur);
|
233 |
}
|
207 |
}
|
234 |
else {echo "$l_error_open_file $wl_categories_enabled";}
|
208 |
else {echo "$l_error_open_file $wl_categories_enabled";}
|
235 |
$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
|
209 |
$fichier=fopen($dir_blacklist."ossi-wl/domains","w+");
|
236 |
fputs($fichier, form_filter($_POST['OSSI_wl']));
|
210 |
fputs($fichier, form_filter($_POST['OSSI_wl']));
|
Line 238... |
Line 212... |
238 |
unset($_POST['OSSI_wl']);
|
212 |
unset($_POST['OSSI_wl']);
|
239 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
213 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
240 |
break;
|
214 |
break;
|
241 |
case 'Specific_filtering' :
|
215 |
case 'Specific_filtering' :
|
242 |
$wl_safesearch='off';
|
216 |
$wl_safesearch='off';
|
243 |
foreach ($_POST as $key => $value)
|
217 |
foreach ($_POST as $key => $value){
|
244 |
{
|
- |
|
245 |
if (strstr($key,'chk-safesearch')) {
|
218 |
if (strstr($key,'chk-safesearch')){
|
246 |
$wl_safesearch='on';
|
219 |
$wl_safesearch='on';
|
247 |
}
|
220 |
}
|
248 |
}
|
221 |
}
|
249 |
exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh -safesearch_$wl_safesearch");
|
222 |
exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh -safesearch_$wl_safesearch");
|
250 |
break;
|
223 |
break;
|
251 |
case 'MAJ_ossi_file' :
|
224 |
case 'MAJ_ossi_file' :
|
252 |
foreach ($_POST as $fichier => $value)
|
225 |
foreach ($_POST as $fichier => $value){
|
253 |
{
|
- |
|
254 |
if($fichier != "choix")
|
226 |
if($fichier != "choix"){
|
255 |
{
|
- |
|
256 |
$action=$_POST[$fichier];
|
227 |
$action=$_POST[$fichier];
|
257 |
if($action == $l_remove) //delete
|
228 |
if($action == $l_remove){ //delete
|
258 |
{
|
- |
|
259 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
|
229 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
|
260 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
|
230 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories");
|
261 |
exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
|
231 |
exec("rm -rf ".escapeshellarg("$dir_blacklist$fichier"));
|
262 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
232 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
263 |
}
|
233 |
}
|
264 |
if($action == $l_disable) //disable
|
234 |
if($action == $l_disable){ //disable
|
265 |
{
|
- |
|
266 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
|
235 |
exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $wl_categories_enabled");
|
267 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
236 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
268 |
}
|
237 |
}
|
269 |
if($action == $l_enable) //enable
|
238 |
if($action == $l_enable){ //enable
|
270 |
{
|
- |
|
271 |
file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
|
239 |
file_put_contents($wl_categories_enabled, $fichier."\n", FILE_APPEND);
|
272 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
240 |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
273 |
}
|
241 |
}
|
274 |
}
|
242 |
}
|
275 |
}
|
243 |
}
|
276 |
break;
|
244 |
break;
|
277 |
case 'MAJ_ossi_file_upload' :
|
245 |
case 'MAJ_ossi_file_upload' :
|
278 |
$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
|
246 |
$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
|
279 |
if(!empty($file_name))
|
247 |
if(!empty($file_name)){
|
280 |
{
|
- |
|
281 |
$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
|
248 |
$dest_dir = $dir_blacklist."ossi-wl-".$file_name;
|
282 |
exec("mkdir ".escapeshellarg($dest_dir));
|
249 |
exec("mkdir ".escapeshellarg($dest_dir));
|
283 |
$file=$_FILES['fichier_ip']['tmp_name'];
|
250 |
$file=$_FILES['fichier_ip']['tmp_name'];
|
284 |
exec('/usr/bin/dos2unix '.escapeshellarg($file));
|
251 |
exec('/usr/bin/dos2unix '.escapeshellarg($file));
|
285 |
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains"))
|
252 |
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains")){
|
286 |
{
|
- |
|
287 |
touch ($dest_dir."/urls"); // create the URL file even if it isn't used
|
253 |
touch ($dest_dir."/urls"); // create the URL file even if it isn't used
|
288 |
file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
|
254 |
file_put_contents ($wl_categories, $dest_dir."\n", FILE_APPEND);
|
289 |
file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
|
255 |
file_put_contents ($wl_categories_enabled, "ossi-wl-".$file_name."\n", FILE_APPEND); //Enabled by default
|
290 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
256 |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
|
291 |
}
|
257 |
}
|
292 |
else
|
258 |
else {
|
293 |
{
|
- |
|
294 |
exec("rm -rf ".escapeshellarg($dest_dir));
|
259 |
exec("rm -rf ".escapeshellarg($dest_dir));
|
295 |
echo $l_error_upload;
|
260 |
echo $l_error_upload;
|
296 |
}
|
261 |
}
|
297 |
}
|
262 |
}
|
298 |
break;
|
263 |
break;
|
Line 307... |
Line 272... |
307 |
<FORM action='wl_filter.php' method=POST>
|
272 |
<FORM action='wl_filter.php' method=POST>
|
308 |
<input type='hidden' name='choix' value='MAJ_cat_wl'>
|
273 |
<input type='hidden' name='choix' value='MAJ_cat_wl'>
|
309 |
<?php
|
274 |
<?php
|
310 |
echo "<center>";
|
275 |
echo "<center>";
|
311 |
// total number of IP, DNS & URLs
|
276 |
// total number of IP, DNS & URLs
|
312 |
$nbDomainNames = exec("wc -l $dir_wl_domain_names* | tail -n 1 | awk '{print $1}'");
|
277 |
$nbDomainNames = exec("wc -l $dir_wl_domain_names_enabled* | tail -n 1 | awk '{print $1}'");
|
313 |
$nbUrl = "0";
|
278 |
$nbUrl = "0";
|
314 |
$nbIp = exec("wc -l $dir_wl_ip* | tail -n 1 | awk '{print $1}'");
|
279 |
$nbIp = exec("wc -l $dir_wl_ip_enabled* | tail -n 1 | awk '{print $1}'");
|
315 |
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
|
280 |
echo "$l_state $nbDomainNames <b>$l_nbDomainNames</b>, $nbUrl <b>$l_nbUrl</b>, $nbIp <b>$l_nbIp</b><br/>";
|
316 |
echo "$l_wl_categories</center></td></tr>";
|
281 |
echo "$l_wl_categories</center></td></tr>";
|
317 |
//read & display all WL categories (checked or not)
|
282 |
//read & display all categories (checked or not)
|
318 |
$cols=1;
|
283 |
$cols=1;
|
319 |
if (file_exists($wl_categories))
|
284 |
if (file_exists($wl_categories)){
|
320 |
{
|
- |
|
321 |
$wl_files = file($wl_categories);
|
285 |
$wl_files = file($wl_categories);
|
322 |
$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
|
286 |
$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
|
323 |
foreach ($wl_files as $fichier => $value)
|
287 |
foreach ($wl_files as $fichier => $value){
|
324 |
{
|
- |
|
325 |
if ($cols == 1) { echo "<tr>";}
|
288 |
if ($cols == 1) { echo "<tr>";}
|
326 |
$categorie=trim(basename($value));
|
289 |
$categorie=trim(basename($value));
|
327 |
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>";
|
290 |
echo "<td><a href='bl_categories_help.php?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>";
|
328 |
echo "<input type='checkbox' name='chk-$categorie'";
|
291 |
echo "<input type='checkbox' name='chk-$categorie'";
|
329 |
// if the line is commented, the category is disable
|
292 |
// if the line is commented, the category is disable
|
330 |
if (preg_match('/^#/',$value, $r)) { echo ">";}
|
293 |
if (preg_match('/^#/',$value, $r)) { echo ">";}
|
331 |
else { echo "checked>"; }
|
294 |
else { echo "checked>"; }
|
332 |
echo "</td>";
|
295 |
echo "</td>";
|
333 |
$cols++;
|
296 |
$cols++;
|
334 |
if ($cols > 10) {
|
297 |
if ($cols > 10){
|
335 |
echo "</tr>";
|
298 |
echo "</tr>";
|
336 |
$cols=1;
|
299 |
$cols=1;
|
337 |
}
|
300 |
}
|
338 |
}
|
301 |
}
|
339 |
}
|
302 |
}
|
Line 365... |
Line 328... |
365 |
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>";
|
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>";
|
366 |
|
329 |
|
367 |
//list OSSI custom categories
|
330 |
//list OSSI custom categories
|
368 |
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
|
331 |
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
|
369 |
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
|
332 |
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
|
370 |
foreach ($fichierswl as $fichier => $value)
|
333 |
foreach ($fichierswl as $fichier => $value){
|
371 |
{
|
- |
|
372 |
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'";
|
334 |
echo "<tr><td><center><a href='bl_categories_help.php?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'";
|
373 |
if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
|
335 |
if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
|
374 |
echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
|
336 |
echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
|
375 |
}
|
337 |
}
|
376 |
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
|
338 |
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
|
377 |
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
|
339 |
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'><td width=50% colspan=5 align=center>";
|