Subversion Repositories ALCASAR

Rev

Rev 1878 | Rev 1903 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1878 Rev 1899
Line 89... Line 89...
89
}
89
}
90
 
90
 
91
# Choice of language
91
# Choice of language
92
$Language = 'en';
92
$Language = 'en';
93
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
93
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
94
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
94
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
95
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
95
	$Language = strtolower(substr(chop($Langue[0]),0,2)); }
96
if($Language == 'fr'){
96
if($Language == 'fr'){
97
  $l_wl="Liste blanche";
97
	$l_wl="Liste blanche";
98
  $l_load="Chargement...";
98
	$l_load="Chargement...";
99
  $l_list_version="Version de la liste : ";
99
	$l_list_version="Version de la liste : ";
100
  $l_specific_filtering="Filtrage special";
100
	$l_specific_filtering="Filtrage special";
101
  $l_wl_categories="Sélectionnez les catégories à autoriser";
101
	$l_wl_categories="Sélectionnez les catégories à autoriser";
102
  $l_allowed_dns="Noms de domaine autorisés";
102
	$l_allowed_dns="Noms de domaine autorisés";
103
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
103
	$l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
104
  $l_add_to_wl="Noms de domaine ou IP ajoutés à la liste blanche";
104
	$l_add_to_wl="Noms de domaine ou IP ajoutés à la liste blanche";
105
  $l_forbidden_ip_explain="Entrez une IP par ligne (exemple : 123.123.123.123)<br/>ou une adresse de réseau (exemple : 123.123.0.0/16)";
105
	$l_forbidden_ip_explain="Entrez une IP par ligne (exemple : 123.123.123.123)<br/>ou une adresse de réseau (exemple : 123.123.0.0/16)";
106
  $l_allowed_ip="IP autorisées";
106
	$l_allowed_ip="IP autorisées";
107
  $l_record="Enregistrer les modifications";
107
	$l_record="Enregistrer les modifications";
108
  $l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
108
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
109
  $l_error_open_file="Erreur d'ouverture du fichier";
109
	$l_error_open_file="Erreur d'ouverture du fichier";
110
  $l_additional_file_title="Fichiers de 'listes blanche' additionnels";
110
	$l_additional_file_title="Fichiers de 'listes blanche' additionnels";
111
  $l_file_list="Liste des fichiers";
111
	$l_file_list="Liste des fichiers";
112
  $l_add_file="Ajouter un fichier";
112
	$l_add_file="Ajouter un fichier";
113
  $l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine"; 
113
	$l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine"; 
114
  $l_file_name="Nom du fichier";
114
	$l_file_name="Nom du fichier";
115
  $l_file_remove="Supprimer";
115
	$l_file_remove="Supprimer";
116
  $l_error_upload="Erreur d'envoi du fichier";
116
	$l_error_upload="Erreur d'envoi du fichier";
117
  $l_remove="Supprimer";
117
	$l_remove="Supprimer";
118
  $l_submit="Envoyer";
118
	$l_submit="Envoyer";
119
  $l_nb_ip="Nombre d'IP";
119
	$l_nb_ip="Nombre d'IP";
120
  $l_nb_domain_names="Nombre de noms de domaine";
120
	$l_nb_domain_names="Nombre de noms de domaine";
121
  $l_nbDomainNames="Noms de domaine :";
121
	$l_nbDomainNames="Noms de domaine :";
122
  $l_nbUrl="Url :";
122
	$l_nbUrl="Url :";
123
  $l_nbIp="Ip :";
123
	$l_nbIp="Ip :";
124
  $l_ip_filtering="Filtrer les URLs contenant une adresse IP au lieu d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
124
	$l_ip_filtering="Filtrer les URLs contenant une adresse IP au lieu d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
125
  $l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche : google, yahoo, bing, metacrawler et Youtube.";
125
	$l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche : google, yahoo, bing, metacrawler et Youtube.";
126
  $l_safe_youtube="Pour Youtube restreint, suivez les étapes ici pour chaque poste : "; 
126
	$l_safe_youtube="Pour Youtube restreint, suivez les étapes ici pour chaque poste : "; 
127
  $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>)";
127
	$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>)";
-
 
128
	$l_disable="Désactiver";
128
  
129
	$l_enable="Activer";
-
 
130
	$l_file_state="Etat";
129
}
131
}
130
else {
132
else {
131
  $l_wl="WhiteList";
133
	$l_wl="WhiteList";
132
  $l_load="Loading...";
134
	$l_load="Loading...";
133
  $l_list_version="List version : ";
135
	$l_list_version="List version : ";
134
  $l_wl_categories="Select the categories to allow";
136
	$l_wl_categories="Select the categories to allow";
135
  $l_allowed_dns="Allowed domain names";
137
	$l_allowed_dns="Allowed domain names";
136
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
138
	$l_one_dns="Enter one domain name per row (example : .domain.org)";
137
  $l_add_to_wl="Domain names or IP to add to whitelist";
139
	$l_add_to_wl="Domain names or IP to add to whitelist";
138
  $l_forbidden_ip_explain="Enter one IP per row (example : 123.123.123.123)<br/>or a network address (example : 123.123.0.0/16)";
140
	$l_forbidden_ip_explain="Enter one IP per row (example : 123.123.123.123)<br/>or a network address (example : 123.123.0.0/16)";
139
  $l_allowed_ip="Allowed IP";
141
	$l_allowed_ip="Allowed IP";
140
  $l_record="Save changes";
142
	$l_record="Save changes";
141
  $l_wait="Once validated, 10 seconds are necessary to compute your modifications";
143
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
142
  $l_error_open_file="Error opening file";
144
	$l_error_open_file="Error opening file";
143
  $l_additional_file_title="Additional whitelist files";
145
	$l_additional_file_title="Additional whitelist files";
144
  $l_file_list="Files list";
146
	$l_file_list="Files list";
145
  $l_add_file="Add a file";
147
	$l_add_file="Add a file";
146
  $l_add_file_explain="Each line of the file must be an IP address or a domain name"; 
148
	$l_add_file_explain="Each line of the file must be an IP address or a domain name"; 
147
  $l_file_name="Filename";
149
	$l_file_name="Filename";
148
  $l_file_remove="Remove";
150
	$l_file_remove="Remove";
149
  $l_error_upload="Error during the upload process";
151
	$l_error_upload="Error during the upload process";
150
  $l_remove="Delete";
152
	$l_remove="Delete";
151
  $l_submit="Submit";
153
	$l_submit="Submit";
152
  $l_nb_ip="Number of IP";
154
	$l_nb_ip="Number of IP";
153
  $l_nb_domain_names="Number of domain names";
155
	$l_nb_domain_names="Number of domain names";
154
  $l_nbDomainNames="Domain names :";
156
	$l_nbDomainNames="Domain names :";
155
  $l_nbUrl="Url :";
157
	$l_nbUrl="Url :";
156
  $l_nbIp="Ip :";
158
	$l_nbIp="Ip :";
157
  $l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
159
	$l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
158
  $l_specific_filtering="Specific filtering";
160
	$l_specific_filtering="Specific filtering";
159
  $l_safe_youtube="For safe Youtube, follow steps here for each computer "; 
161
	$l_safe_youtube="For safe Youtube, follow steps here for each computer "; 
160
  $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>)";
162
	$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>)";
161
  $l_safe_searching="Enabling school/parental control for the search engines google."; 
163
	$l_safe_searching="Enabling school/parental control for the search engines google."; 
-
 
164
	$l_disable="Disable";
162
  
165
	$l_enable="Enable";
-
 
166
	$l_file_state="State";
163
}
167
}
164
$dir_etc="/usr/local/etc/";
168
$dir_etc="/usr/local/etc/";
165
$dir_dg="/etc/dansguardian/lists/";
169
$dir_dg="/etc/dansguardian/lists/";
166
$file_wl_domains="/usr/local/share/dnsmasq-wl/ossi.conf";
170
$file_wl_domains="/usr/local/share/dnsmasq-wl/ossi.conf";
167
$file_wl_ip="/usr/local/share/iptables-wl-enabled/ossi";
171
$file_wl_ip="/usr/local/share/iptables-wl-enabled/ossi";
Line 171... Line 175...
171
$tinyproxy_conf="/etc/tinyproxy/tinyproxy.conf";
175
$tinyproxy_conf="/etc/tinyproxy/tinyproxy.conf";
172
$dnsmasq_conf="/etc/dnsmasq-whitelist.conf";
176
$dnsmasq_conf="/etc/dnsmasq-whitelist.conf";
173
$dir_tmp="/tmp/";
177
$dir_tmp="/tmp/";
174
$upload_dir_ip = "/usr/local/share/iptables-wl-enabled/";
178
$upload_dir_ip = "/usr/local/share/iptables-wl-enabled/";
175
$upload_dir_domain_names = "/usr/local/share/dnsmasq-wl-enabled/";
179
$upload_dir_domain_names = "/usr/local/share/dnsmasq-wl-enabled/";
-
 
180
$dir_ip = "/usr/local/share/iptables-wl/";
-
 
181
$dir_domain_names = "/usr/local/share/dnsmasq-wl/";
176
# default values
182
# default values
177
if (is_file ($conf_file))
183
if (is_file ($conf_file))
178
	{
184
	{
179
	$tab=file($conf_file);
185
	$tab=file($conf_file);
180
	if ($tab)
186
	if ($tab)
Line 230... Line 236...
230
	case 'MAJ_ip_file_delete' :
236
	case 'MAJ_ip_file_delete' :
231
	foreach($_POST as $fichier => $value)
237
	foreach($_POST as $fichier => $value)
232
	{
238
	{
233
		if($fichier != "choix")
239
		if($fichier != "choix")
234
		{
240
		{
-
 
241
			$action=$_POST[$fichier];
-
 
242
			if($action == $l_remove) //delete
-
 
243
			{
235
			exec("rm -rf $upload_dir_ip$fichier");
244
				exec("rm -rf $upload_dir_ip$fichier");
236
			exec("rm -rf $upload_dir_domain_names$fichier");
245
				exec("rm -rf $upload_dir_domain_names$fichier");
-
 
246
				exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
247
			}
-
 
248
			if($action == $l_disable) //disable
-
 
249
			{
-
 
250
				exec("mv -f $upload_dir_ip$fichier $dir_ip$fichier");
-
 
251
				exec("mv -f $upload_dir_domain_names$fichier $dir_domain_names$fichier");
-
 
252
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
253
			}
-
 
254
			if($action == $l_enable) //enable
-
 
255
			{
-
 
256
				exec("mv -f $dir_ip$fichier $upload_dir_ip$fichier");
-
 
257
				exec("mv -f $dir_domain_names$fichier $upload_dir_domain_names$fichier");
237
			exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
258
				exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
-
 
259
			}
238
		}
260
		}
239
	}
261
	}
240
	break;
262
	break;
241
case 'MAJ_ip_file_upload' :
263
case 'MAJ_ip_file_upload' :
242
	$nom = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
264
	$nom = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
Line 351... Line 373...
351
<form action='wl_filter.php' method='POST'>
373
<form action='wl_filter.php' method='POST'>
352
<input type='hidden' name='choix' value='MAJ_ip_file_delete'>
374
<input type='hidden' name='choix' value='MAJ_ip_file_delete'>
353
<?php
375
<?php
354
echo "<tr><td width=50% colspan=5 align=center>";
376
echo "<tr><td width=50% colspan=5 align=center>";
355
echo "<H3>$l_file_list</H3>";
377
echo "<H3>$l_file_list</H3>";
356
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th>$l_file_remove</tr>";
378
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th>$l_file_state<th>$l_file_remove</tr>";
357
 
379
 
-
 
380
//liste des fichiers activés
358
$fichiersIp = array_diff(scandir($upload_dir_ip), array('ossi','ossi-ip-safesearch','..','.'));
381
$fichiersIp = array_diff(scandir($upload_dir_ip), array('ossi','ossi-ip-safesearch','..','.'));
359
$fichiersIp = preg_grep("/^ossi-/",$fichiersIp);
382
$fichiersIp = preg_grep("/^ossi-/",$fichiersIp);
360
foreach($fichiersIp as $fichier => $value)
383
foreach($fichiersIp as $fichier => $value)
361
{
384
{
362
	echo "<tr><td><center><a href='bl_categories_help.php?liste=wl&cat=$value&ossi=yes&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'>".exec("sed 's/^.....//g' <<< $value")."</a></center></td><td><center>".exec("wc -l $upload_dir_ip$value | awk '{print $1}'")."</center></td><td><center>".exec("wc -l $upload_dir_domain_names$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
385
	echo "<tr><td><center><a href='bl_categories_help.php?liste=wl&cat=$value&ossi=yes&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'>".exec("sed 's/^.....//g' <<< $value")."</a></center></td><td><center>".exec("wc -l $upload_dir_ip$value | awk '{print $1}'")."</center></td><td><center>".exec("wc -l $upload_dir_domain_names$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_disable'></center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
363
}
386
}
-
 
387
//liste des fichiers desactivés
-
 
388
$fichiersIp = array_diff(scandir($dir_ip), array('ossi','ossi-ip-safesearch','..','.'));
-
 
389
$fichiersIp = preg_grep("/^ossi-/",$fichiersIp);
-
 
390
foreach($fichiersIp as $fichier => $value)
-
 
391
{
-
 
392
	echo "<tr><td bgcolor='BEBEBE'><center><a href='bl_categories_help.php?liste=wl&cat=$value&ossi=yes&filtre=domain&state=disable' 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'>".exec("sed 's/^.....//g' <<< $value")."</a></center></td><td bgcolor='BEBEBE'><center>".exec("wc -l $upload_dir_ip$value | awk '{print $1}'")."</center></td><td bgcolor='BEBEBE'><center>".exec("wc -l $upload_dir_domain_names$value | awk '{print $1}'")."</center></td><td bgcolor='BEBEBE'><center><input type='submit' name='$value' value='$l_enable'></center></td><td bgcolor='BEBEBE'><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
-
 
393
}
-
 
394
 
-
 
395
 
364
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
396
echo "</table><br/></td></form><form action='wl_filter.php' method='POST' enctype='multipart/form-data'>";
365
echo "<input type='hidden' name='choix' value='MAJ_ip_file_upload'><td width=50% colspan=5 align=center>";
397
echo "<input type='hidden' name='choix' value='MAJ_ip_file_upload'><td width=50% colspan=5 align=center>";
366
echo "<H3>$l_add_file</H3>";
398
echo "<H3>$l_add_file</H3>";
367
echo "$l_add_file_explain";
399
echo "$l_add_file_explain";
368
echo "<input type='file' name='fichier_ip'>";
400
echo "<input type='file' name='fichier_ip'>";