Subversion Repositories ALCASAR

Rev

Rev 1332 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
318 richard 1
<?php
2
function echo_file ($filename)
3
	{
4
	if (file_exists($filename))
5
		{
6
		if (filesize($filename) != 0)
7
			{
8
			$pointeur=fopen($filename,"r");
9
			$tampon = fread($pointeur, filesize($filename));
10
			fclose($pointeur);
11
			echo $tampon;
12
			}
13
		}
14
	else
15
		{
1041 richard 16
		echo "$filename doesn't exist";
318 richard 17
		}
18
	}
1339 richard 19
function echo_ip_file ($filename)
20
{
21
	exec("cat $filename | cut -d ' ' -f3", $resultat);
22
	for($i=0; $i<exec("wc -l $filename"); $i++)
23
	{
24
		echo $resultat[$i]."\n";
25
	}
26
}
318 richard 27
?>
28
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1041 richard 29
	<tr><th>
30
	<?php echo $l_list_version; echo date ("F d Y", filemtime ('/etc/dansguardian/lists/blacklists/README'));?>
31
	</th></tr>
318 richard 32
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
33
</table>
34
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
35
<tr><td valign="middle" align="left" colspan=10>
1015 richard 36
<FORM action='bl_filter.php' method=POST>
318 richard 37
<?php
882 richard 38
if ((file_exists("$dir_tmp/blacklists.tar.gz")) && (file_exists("$dir_tmp/md5sum")))
878 richard 39
	{
40
	echo "$l_fingerprint"; echo_file ("$dir_tmp/md5sum");
41
	echo "<br>$l_fingerprint2<a href='http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST' target='cat_help' onclick=window.open('http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST','cat_help','width=600,height=150,toolbar=no,scrollbars=yes,resizable=yes') title='verify fingerprint'>dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST</a><br>";
1041 richard 42
	echo "<input type='hidden' name='choix' value='Active_list'>";
885 richard 43
	echo "<input type='submit' value='$l_activate_bl'> ($l_warning)</FORM>";
1015 richard 44
	echo "<FORM action='bl_filter.php' method=POST>";
1041 richard 45
	echo "<input type='hidden' name='choix' value='Reject_list'>";
885 richard 46
	echo "<input type='submit' value='$l_reject_bl'></form>";
878 richard 47
	}
48
else
49
	{
1041 richard 50
	echo "<input type='hidden' name='choix' value='Download_list'>";
878 richard 51
	echo "<input type='submit' value='$l_download_bl'>";
52
	echo " ($l_warning)";
53
	}
318 richard 54
?>
55
</FORM>
56
</td></tr>
1339 richard 57
</table><br/>
1041 richard 58
<table width="100%" border="0" cellspacing="0" cellpadding="0">
59
	<tr><th><?php echo $l_bl; ?></th></tr>
60
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
61
</table>
62
<table width="100%" border=1 cellspacing=0 cellpadding=1>
318 richard 63
<tr><td valign="middle" align="left" colspan=10>
1015 richard 64
<FORM action='bl_filter.php' method=POST>
1041 richard 65
<input type='hidden' name='choix' value='MAJ_cat_bl'>
318 richard 66
<?php
67
echo "<center>$l_bl_categories</center></td></tr>";
68
//on lit et on interprete le fichier de catégories
69
$cols=1; 
70
if (file_exists($bl_categories))
71
	{
72
	$pointeur=fopen($bl_categories,"r");
73
	while (!feof ($pointeur))
74
		{
75
		$ligne=fgets($pointeur, 4096);
76
		if ($ligne)
77
			{
78
			if ($cols == 1) { echo "<tr>";}
1339 richard 79
				$categorie=trim(basename($ligne));
80
			if($categorie != "ossi")
81
			{
82
				echo "<td><a href='bl_categories_help.php?liste=bl&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>";
83
				echo "<input type='checkbox' name='chk-$categorie'";
84
				// si la ligne est commentée -> categorie non selectionnée
85
				if (preg_match('/^#/',$ligne, $r)) { echo ">";}
86
				else { echo "checked>"; }
87
				echo "</td>";
88
				$cols++;
89
			}
318 richard 90
			if ($cols > 10) {
91
				echo "</tr>";
92
				$cols=1; }
93
			}
94
		}
95
	fclose($pointeur);
96
	}
97
else	{
98
	echo "$l_error_open_file $bl_categories";
99
	}
878 richard 100
echo "</td></tr>";
101
echo "<tr><td valign='middle' align='left' colspan=10>";
876 richard 102
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
1339 richard 103
echo "<tr><td width=50% colspan=5 align=center>";
876 richard 104
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
1041 richard 105
echo "<textarea name='BL_rehabilited_domains' rows=3 cols=40>";
106
echo_file ($dir_dg."exceptionsitelist");
876 richard 107
echo "</textarea></td>";
1339 richard 108
echo "<td width=50% colspan=5 align=center>";
109
echo "<H3>$l_rehabilitated_ip</H3>$l_rehabilitated_ip_explain<BR>$l_one_ip<BR>";
110
echo "<textarea name='BL_rehabilited_ip' rows=3 cols=40>";
111
echo_file ($dir_dg."exceptioniplist");
112
echo "</textarea></td></tr><tr><td width=50% colspan=10>";
878 richard 113
echo "<tr><td valign='middle' align='left' colspan=10>";
114
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
1339 richard 115
echo "<tr><td width=50% colspan=5 align=center>";
878 richard 116
echo "<H3>$l_forbidden_dns</H3>$l_forbidden_dns_explain<BR>";
1041 richard 117
echo "<textarea name='OSSI_bl_domains' rows=3 cols=40>";
118
echo_file ($dir_dg."blacklists/ossi/domains");
878 richard 119
echo "</textarea></td>";
1339 richard 120
echo "<td width=50% colspan=5 align=center>";
121
echo "<H3>$l_forbidden_ip</H3>$l_forbidden_ip_explain<BR>";
122
echo "<textarea name='OSSI_bl_ip' rows=3 cols=40>";
123
echo_ip_file ($dir_bl_ip."ossi");
878 richard 124
echo "</textarea></td></tr><tr><td colspan=10>";
876 richard 125
echo "<input type='submit' value='$l_record'>";
126
echo "</form> ($l_wait)";
1339 richard 127
echo "</table></td><br/>";
876 richard 128
?>
318 richard 129
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1339 richard 130
	<tr><th><?php echo $l_ip_file_title; ?></th></tr>
131
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
132
</table>
133
<table width="100%" border=1 cellspacing=0 cellpadding=1>
134
<form action='bl_filter.php' method='POST'>
135
<input type='hidden' name='choix' value='MAJ_ip_file_delete'>
136
<?php
137
echo "<tr><td width=50% colspan=5 align=center>";
138
echo "<H3>$l_file_list</H3>";
139
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_file_remove</tr>";
140
exec("cd $upload_dir && ls ossi-*", $fichiersIp);
141
foreach($fichiersIp as $fichier => $value)
142
{
143
	echo "<tr><td><center>".exec("sed 's/^.....//g' <<< $value")."</center></td><td><center>".exec("wc -l $upload_dir$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
144
}
145
echo "</table><br/></td></form><form action='bl_filter.php' method='POST' enctype='multipart/form-data'>";
146
echo "<input type='hidden' name='choix' value='MAJ_ip_file_upload'><td width=50% colspan=5 align=center>";
147
echo "<H3>$l_add_ip_file</H3>";
148
echo "<input type='file' name='fichier_ip'>";
149
echo "<input type='submit' value='$l_submit'>";
150
echo "</td></tr>";
151
echo "</form>";
152
echo "</table><br/>";
153
?>
154
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1041 richard 155
	<tr><th><?php echo $l_wl; ?></th></tr>
156
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
157
</table>
158
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
159
<tr><td valign="middle" align="left" colspan=10>
160
<FORM action='bl_filter.php' method=POST>
161
<input type='hidden' name='choix' value='MAJ_cat_wl'>
162
<?php
163
echo "<center>$l_wl_categories</center></td></tr>";
164
//on lit et on interprete le fichier de catégories
165
$cols=1; 
166
if (file_exists($wl_categories))
167
	{
168
	$pointeur=fopen($wl_categories,"r");
169
	while (!feof ($pointeur))
170
		{
171
		$ligne=fgets($pointeur, 4096);
172
		if ($ligne)
173
			{
174
			if ($cols == 1) { echo "<tr>";}
175
			$categorie=trim(basename($ligne));
1332 richard 176
			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>";
1041 richard 177
			echo "<input type='checkbox' name='chk-$categorie'";
178
			// si la ligne est commentée -> categorie non selectionnée
179
			if (preg_match('/^#/',$ligne, $r)) { echo ">";}
180
			else { echo "checked>"; }
181
			echo "</td>";
182
			$cols++;
183
			if ($cols > 10) {
184
				echo "</tr>";
185
				$cols=1; }
186
			}
187
		}
188
	fclose($pointeur);
189
	}
190
else	{
191
	echo "$l_error_open_file $wl_categories";
192
	}
193
echo "<tr><td valign='middle' align='left' colspan=10>";
194
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
1339 richard 195
echo "<tr><td width=50% colspan=5 align=center>";
1041 richard 196
echo "<H3>$l_allowed_dns</H3>$l_forbidden_dns_explain<BR>";
197
echo "<textarea name='OSSI_wl_domains' rows=3 cols=40>";
198
echo_file ($dir_dg."blacklists/ossi/domains_wl");
199
echo "</textarea></td>";
1339 richard 200
echo "<td width=50% colspan=5 align=center>";
201
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";
202
echo "<textarea name='OSSI_wl_ip' rows=3 cols=40>";
1041 richard 203
echo_file ($dir_dg."blacklists/ossi/urls_wl");
204
echo "</textarea></td></tr><tr><td colspan=10>";
1042 richard 205
echo "<input type='submit' value='$l_record' disabled>";
1339 richard 206
echo "</form> (Wait for a next version of ALCASAR !)";
1041 richard 207
?>
208
</td></tr>
1339 richard 209
</TABLE><br/>
1041 richard 210
<table width="100%" border="0" cellspacing="0" cellpadding="0">
878 richard 211
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
318 richard 212
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
213
</table>
214
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
1015 richard 215
<FORM action='bl_filter.php' method='POST'>
878 richard 216
<input type='hidden' name='choix' value='Specific_filtering'>
879 richard 217
<tr><td>
218
<input type='checkbox' name='chk-ip'
876 richard 219
<?php
882 richard 220
// verify "pureip" filtering state
879 richard 221
if (file_exists($bannedsite_file))
222
	{
223
	$pointeur=fopen($bannedsite_file,"r");
224
	while (!feof ($pointeur))
225
		{
226
		$ligne=fgets($pointeur, 4096);
227
		if ($ligne)
228
			{
229
			if (preg_match('/^\*ip$/',$ligne, $r)) 
230
				{
231
				echo " checked";
232
				break;
233
				}
234
			}
235
		}
236
	fclose($pointeur);
237
	}
238
else	{
239
	echo "$l_error_open_file $bannedsite_file";
240
	}
241
echo "> $l_ip_filtering";
318 richard 242
?>
882 richard 243
</td></tr>
878 richard 244
<tr><td>
882 richard 245
<input type='checkbox' name='chk-safesearch'
246
<?php
247
// verify "safesearch" filtering state
248
if (file_exists($urlregex_file))
249
	{
250
	$pointeur=fopen($urlregex_file,"r");
251
	while (!feof ($pointeur))
252
		{
253
		$ligne=fgets($pointeur, 4096);
254
		if ($ligne)
255
			{
256
			if (preg_match('/^\"\(\^http\:\/\/\[0\-9a\-z\]\+\\\.google/',$ligne, $r))
257
				{
258
				echo " checked";
259
				break;
260
				}
261
			}
262
		}
263
	fclose($pointeur);
264
	}
265
else	{
266
	echo "$l_error_open_file $urlregex_file";
267
	}
268
echo "> $l_safe_searching";
269
echo "<br>$l_safe_youtube";
885 richard 270
echo "<input type='text' name='Youtube_ID' size='30' value='";
271
if ($YOUTUBE_ID == "ABCD1234567890abcdef") // generic ID (do nothing)
272
	{
273
	echo "'>";
274
	}
275
else {
276
	echo "$YOUTUBE_ID'>";
277
	} 
278
echo " $l_youtube_id<tr><td>";
1339 richard 279
echo "<input type='submit' value='$l_record'></td></tr>";
882 richard 280
?>
1339 richard 281
</FORM> 
318 richard 282
</TABLE>