Subversion Repositories ALCASAR

Rev

Rev 1827 | Rev 1852 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 1827 Rev 1843
Line 67... Line 67...
67
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
67
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
68
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
68
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
69
if($Language == 'fr'){
69
if($Language == 'fr'){
70
  $l_wl="Liste blanche";
70
  $l_wl="Liste blanche";
71
  $l_list_version="Version de la liste : ";
71
  $l_list_version="Version de la liste : ";
-
 
72
  $l_specific_filtering="Filtrage special";
72
  $l_wl_categories="Sélectionnez les catégories à autoriser";
73
  $l_wl_categories="Sélectionnez les catégories à autoriser";
73
  $l_allowed_dns="Noms de domaine autorisés";
74
  $l_allowed_dns="Noms de domaine autorisés";
74
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
75
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
75
  $l_add_to_wl="Noms de domaine ou IP ajoutés à la liste blanche";
76
  $l_add_to_wl="Noms de domaine ou IP ajoutés à la liste blanche";
76
  $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)";
77
  $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)";
Line 82... Line 83...
82
  $l_nb_ip="Nombre d'IP";
83
  $l_nb_ip="Nombre d'IP";
83
  $l_nb_domain_names="Nombre de noms de domaine";
84
  $l_nb_domain_names="Nombre de noms de domaine";
84
  $l_nbDomainNames="Noms de domaine :";
85
  $l_nbDomainNames="Noms de domaine :";
85
  $l_nbUrl="Url :";
86
  $l_nbUrl="Url :";
86
  $l_nbIp="Ip :";
87
  $l_nbIp="Ip :";
-
 
88
  $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)";
-
 
89
  $l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche : google, yahoo, bing, metacrawler et Youtube.";
-
 
90
  $l_safe_youtube="Pour Youtube sain, suivez les étapes ici pour chaque poste : "; 
-
 
91
  $l_youtube_id="(<a href='http://www.youtube.com/education_signup' target='cat_help' onclick=window.open('http://www.youtube.com/education_signup','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>)";
-
 
92
  
87
}
93
}
88
else {
94
else {
89
  $l_wl="WhiteList";
95
  $l_wl="WhiteList";
90
  $l_list_version="List version : ";
96
  $l_list_version="List version : ";
91
  $l_wl_categories="Select the categories to allow";
97
  $l_wl_categories="Select the categories to allow";
Line 101... Line 107...
101
  $l_nb_ip="Number of IP";
107
  $l_nb_ip="Number of IP";
102
  $l_nb_domain_names="Number of domain names";
108
  $l_nb_domain_names="Number of domain names";
103
  $l_nbDomainNames="Domain names :";
109
  $l_nbDomainNames="Domain names :";
104
  $l_nbUrl="Url :";
110
  $l_nbUrl="Url :";
105
  $l_nbIp="Ip :";
111
  $l_nbIp="Ip :";
-
 
112
  $l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
-
 
113
  $l_specific_filtering="Specific filtering";
-
 
114
  $l_safe_youtube="For Safe Youtube, follow steps here for each computer "; 
-
 
115
  $l_youtube_id="(<a href='http://www.youtube.com/education_signup' target='cat_help' onclick=window.open('http://www.youtube.com/education_signup','cat_help','width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes') title='Youtube for school'>link to create a Youtube Id</a>)";
-
 
116
  $l_safe_searching="Enabling school/parental control for the search engines google, yahoo, bing, metacrawler and Youtube."; 
-
 
117
  
106
}
118
}
107
$dir_etc="/usr/local/etc/";
119
$dir_etc="/usr/local/etc/";
108
$dir_dg="/etc/dansguardian/lists/";
120
$dir_dg="/etc/dansguardian/lists/";
109
$file_wl_ip="/usr/local/share/ossi-ip-wl";
121
$file_wl_ip="/usr/local/share/ossi-ip-wl";
110
$wl_categories=$dir_etc."alcasar-wl-categories";
122
$wl_categories=$dir_etc."alcasar-wl-categories";
111
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
123
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
112
$conf_file=$dir_etc."alcasar.conf";
124
$conf_file=$dir_etc."alcasar.conf";
-
 
125
$tinyproxy_conf="/etc/tinyproxy/tinyproxy.conf";
-
 
126
$dnsmasq_conf="/etc/dnsmasq-whitelist.conf";
-
 
127
# default values
-
 
128
if (is_file ($conf_file))
-
 
129
	{
-
 
130
	$tab=file($conf_file);
-
 
131
	if ($tab)
-
 
132
		{
-
 
133
		foreach ($tab as $line)
-
 
134
			{
-
 
135
			$field=explode("=", $line);
-
 
136
			if ($field[0] == "PRIVATE_IP")
-
 
137
				{
-
 
138
				$PRIVATE_IP_MASK=trim($field[1]);
-
 
139
				$tmp = explode("/",$PRIVATE_IP_MASK);
-
 
140
				$PRIVATE_IP=$tmp[0];
-
 
141
				}
-
 
142
			}
-
 
143
		}
-
 
144
	}
-
 
145
else { echo "$l_error_open_file $conf_file";}
-
 
146
 
113
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
147
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
114
switch ($choix)
148
switch ($choix)
115
{
149
{
-
 
150
case 'Specific_filtering' :
-
 
151
	$safesearch="-safesearch_off"; ;
-
 
152
	foreach ($_POST as $key => $value)
-
 
153
	{
-
 
154
		if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
-
 
155
	}
-
 
156
	exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh $safesearch");
-
 
157
	break;
116
case 'MAJ_cat_wl' :
158
case 'MAJ_cat_wl' :
117
	if (file_exists($wl_categories_enabled))
159
	if (file_exists($wl_categories_enabled))
118
		{
160
		{
119
		$pointeur=fopen($wl_categories_enabled, "w+");
161
		$pointeur=fopen($wl_categories_enabled, "w+");
120
		foreach ($_POST as $key => $value)
162
		foreach ($_POST as $key => $value)
Line 142... Line 184...
142
?>
184
?>
143
<table width="100%" border="0" cellspacing="0" cellpadding="0">
185
<table width="100%" border="0" cellspacing="0" cellpadding="0">
144
	<tr><th><?php echo $l_wl; ?></th></tr>
186
	<tr><th><?php echo $l_wl; ?></th></tr>
145
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
187
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
146
</table>
188
</table>
-
 
189
 
147
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
190
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
148
<tr><td valign="middle" align="left" colspan=10>
191
<tr><td valign="middle" align="left" colspan=10>
149
<FORM action='wl_filter.php' method=POST>
192
<FORM action='wl_filter.php' method=POST>
150
<input type='hidden' name='choix' value='MAJ_cat_wl'>
193
<input type='hidden' name='choix' value='MAJ_cat_wl'>
151
<?php
194
<?php
Line 193... Line 236...
193
echo "</textarea></td>";
236
echo "</textarea></td>";
194
echo "<td width=50% colspan=5 align=center>";
237
echo "<td width=50% colspan=5 align=center>";
195
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";
238
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";
196
echo "<textarea name='OSSI_wl_ip' rows=3 cols=40>";
239
echo "<textarea name='OSSI_wl_ip' rows=3 cols=40>";
197
echo_ip_file ($file_wl_ip);
240
echo_ip_file ($file_wl_ip);
198
echo "</textarea></td></tr><tr><td colspan=10>";
241
echo "</textarea></td></tr>";
-
 
242
echo "<tr><td colspan=10>";
-
 
243
echo "</table><br/>";
-
 
244
echo "<input type='submit' value='$l_record'></form></td></tr>";
-
 
245
?>
-
 
246
 
-
 
247
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
 
248
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
-
 
249
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
250
</table>
-
 
251
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
-
 
252
<FORM action='wl_filter.php' method='POST'>
-
 
253
<input type='hidden' name='choix' value='Specific_filtering'>
-
 
254
<tr><td>
-
 
255
 
-
 
256
<input type='checkbox' name='chk-safesearch'
-
 
257
<?php
-
 
258
//verification du safesearch
-
 
259
if(file_exists($dnsmasq_conf))
-
 
260
{
-
 
261
	$f=fopen($dnsmasq_conf, 'r');
-
 
262
	while(!feof($f))
-
 
263
	{
-
 
264
		$line=fgets($f,4096);
-
 
265
		if($line && preg_match('/^address=\/\.google/',$line,$r))
-
 
266
		{
-
 
267
			echo "checked";
-
 
268
			break;
-
 
269
		}
-
 
270
	}
-
 
271
	fclose($f);
-
 
272
}
-
 
273
else
-
 
274
	echo "$l_error_open_file $dnsmasq_conf";
-
 
275
echo "> $l_safe_searching";
-
 
276
 
-
 
277
echo "<br></br>$l_safe_youtube";
-
 
278
echo " $l_youtube_id<tr><td>";
-
 
279
 
199
echo "<input type='submit' value='$l_record'></form></td></tr>";
280
echo "<input type='submit' value='$l_record'></form></td></tr>";
200
?>
281
?>
-
 
282
 
201
</TABLE><br/>
283
</TABLE><br/>
202
</BODY>
284
</BODY>
203
</HTML>
285
</HTML>