]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/urlfilter.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) written from scratch
9 # $Id: urlfilter.cgi,v 1.7 2006/05/08 00:00:00 marco Exp $
14 # enable only the following on debugging purpose
16 #use CGI::Carp 'fatalsToBrowser';
21 require '/var/ipfire/general-functions.pl' ;
22 require "${General::swroot}/lang.pl" ;
23 require "${General::swroot}/header.pl" ;
28 my %filtersettings =();
32 my %updatesettings =();
47 my $tcfile = "${General::swroot}/urlfilter/timeconst" ;
48 my $uqfile = "${General::swroot}/urlfilter/userquota" ;
49 my $dbdir = "${General::swroot}/urlfilter/blacklists" ;
50 my $editdir = "${General::swroot}/urlfilter/editor" ;
51 my $repository = "/home/httpd/html/repository" ;
52 my $hintcolour = '#FFFFCC' ;
54 my $sourceurlfile = "${General::swroot}/urlfilter/autoupdate/autoupdate.urls" ;
55 my $updconffile = "${General::swroot}/urlfilter/autoupdate/autoupdate.conf" ;
56 my $updflagfile = "${General::swroot}/urlfilter/blacklists/.autoupdate.last" ;
57 my $upd_cron_dly = "${General::swroot}/urlfilter/autoupdate/cron.daily" ;
58 my $upd_cron_wly = "${General::swroot}/urlfilter/autoupdate/cron.weekly" ;
59 my $upd_cron_mly = "${General::swroot}/urlfilter/autoupdate/cron.monthly" ;
63 my $restoremessage = '' ;
69 my @repositorylist =();
70 my @repositoryfiles =();
72 my @selectedcategories =();
76 my @source_urllist =();
87 if (! - d
$dbdir ) { mkdir ( " $dbdir " ); }
88 if (! - e
$tcfile ) { system ( "touch $tcfile " ); }
89 if (! - e
$uqfile ) { system ( "touch $uqfile " ); }
90 if (! - e
$sourceurlfile ) { system ( "touch $sourceurlfile " ); }
92 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
93 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
94 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
104 open ( FILE
, $sourceurlfile );
105 @source_urllist = < FILE
>;
108 $filtersettings { 'ENABLE_CUSTOM_BLACKLIST' } = 'off' ;
109 $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } = 'off' ;
110 $filtersettings { 'ENABLE_CUSTOM_EXPRESSIONS' } = 'off' ;
111 $filtersettings { 'BLOCK_EXECUTABLES' } = 'off' ;
112 $filtersettings { 'BLOCK_AUDIO-VIDEO' } = 'off' ;
113 $filtersettings { 'BLOCK_ARCHIVES' } = 'off' ;
114 $filtersettings { 'ENABLE_REWRITE' } = 'off' ;
115 $filtersettings { 'UNFILTERED_CLIENTS' } = '' ;
116 $filtersettings { 'BANNED_CLIENTS' } = '' ;
117 $filtersettings { 'SHOW_CATEGORY' } = 'off' ;
118 $filtersettings { 'SHOW_URL' } = 'off' ;
119 $filtersettings { 'SHOW_IP' } = 'off' ;
120 $filtersettings { 'ENABLE_DNSERROR' } = 'off' ;
121 $filtersettings { 'ENABLE_JPEG' } = 'off' ;
122 $filtersettings { 'REDIRECT_PAGE' } = '' ;
123 $filtersettings { 'MSG_TEXT_1' } = '' ;
124 $filtersettings { 'MSG_TEXT_2' } = '' ;
125 $filtersettings { 'MSG_TEXT_3' } = '' ;
126 $filtersettings { 'ENABLE_EXPR_LISTS' } = 'off' ;
127 $filtersettings { 'BLOCK_IP_ADDR' } = 'off' ;
128 $filtersettings { 'BLOCK_ALL' } = 'off' ;
129 $filtersettings { 'ENABLE_EMPTY_ADS' } = 'off' ;
130 $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } = 'off' ;
131 $filtersettings { 'ENABLE_SAFESEARCH' } = 'off' ;
132 $filtersettings { 'ENABLE_LOG' } = 'off' ;
133 $filtersettings { 'ENABLE_USERNAME_LOG' } = 'off' ;
134 $filtersettings { 'ENABLE_CATEGORY_LOG' } = 'off' ;
135 $filtersettings { 'CHILDREN' } = '5' ;
136 $filtersettings { 'ENABLE_AUTOUPDATE' } = 'off' ;
138 $filtersettings { 'ACTION' } = '' ;
139 $filtersettings { 'VALID' } = '' ;
141 & Header
:: getcgihash
( \
%filtersettings );
142 & Header
:: getcgihash
( \
%tcsettings );
143 & Header
:: getcgihash
( \
%uqsettings );
144 & Header
:: getcgihash
( \
%besettings );
146 if (( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) ||
147 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter save and restart' }) ||
148 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload file' }) ||
149 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter remove file' }) ||
150 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload background' }) ||
151 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload blacklist' }) ||
152 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter backup' }) ||
153 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restore' }))
155 if (!( $filtersettings { 'CHILDREN' } =~ /^\d+$/ ) || ( $filtersettings { 'CHILDREN' } < 1 ))
157 $errormessage = $Lang :: tr
{ 'urlfilter invalid num of children' };
161 if ((!( $filtersettings { 'REDIRECT_PAGE' } eq '' )) && (!( $filtersettings { 'REDIRECT_PAGE' } =~ /^https?:\/ \
// )))
163 $filtersettings { 'REDIRECT_PAGE' } = "http://" . $filtersettings { 'REDIRECT_PAGE' };
166 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter remove file' })
168 if (- e
" $repository / $filtersettings {'ID'}" ) { unlink ( " $repository / $filtersettings {'ID'}" ); }
169 $filtersettings { 'ACTION' } = $Lang :: tr
{ 'urlfilter manage repository' };
172 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload file' })
174 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPLOADFILE' });
176 $filtersettings { 'ACTION' } = $Lang :: tr
{ 'urlfilter manage repository' };
177 $_ = $filtersettings { 'UPLOADFILE' };
179 $_ = substr ( $_ , rindex ( $_ , "/" )+ 1 );
181 if ( copy
( $filtersettings { 'UPLOADFILE' }, " $repository / $_ " ) != 1 )
190 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload background' })
192 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'BACKGROUND' });
194 if ( copy
( $filtersettings { 'BACKGROUND' }, "/home/httpd/html/images/urlfilter/background.jpg" ) != 1 )
201 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload blacklist' })
203 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPDATEFILE' });
205 if (!( $filtersettings { 'UPDATEFILE' } =~ /.tar.gz$/ ))
207 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
211 if ( copy
( $filtersettings { 'UPDATEFILE' }, "${General::swroot}/urlfilter/blacklists.tar.gz" ) != 1 )
217 if (!(- d
"${General::swroot}/urlfilter/update" )) { mkdir ( "${General::swroot}/urlfilter/update" ); }
219 my $exitcode = system ( "/bin/tar --no-same-owner -xzf ${General::swroot}/urlfilter/blacklists.tar.gz -C ${General::swroot}/urlfilter/update" );
223 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
226 if (- d
"${General::swroot}/urlfilter/update/category" )
228 system ( "mv ${General::swroot}/urlfilter/update/category ${General::swroot}/urlfilter/update/blacklists" );
231 if (!(- d
"${General::swroot}/urlfilter/update/blacklists" ))
233 $errormessage = $Lang :: tr
{ 'urlfilter invalid content' };
235 system ( "cp -r ${General::swroot}/urlfilter/update/blacklists/* $dbdir " );
237 & readblockcategories
;
242 $updatemessage = $Lang :: tr
{ 'urlfilter upload success' };
243 system ( "${General::swroot}/urlfilter/bin/prebuild.pl &" );
244 system ( "logger -t installpackage[urlfilter] \" URL filter blacklist - Blacklist update from local source completed \" " );
247 if (- d
"${General::swroot}/urlfilter/update" ) { system ( "rm -rf ${General::swroot}/urlfilter/update" ); }
248 if (- e
"${General::swroot}/urlfilter/blacklists.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/blacklists.tar.gz" ); }
249 if ( $errormessage ) { goto ERROR
; }
252 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter backup' })
254 $blistbackup = ( $filtersettings { 'ENABLE_FULLBACKUP' } eq 'on' ) ?
"blacklists" : "blacklists/custom" ;
255 if ( system ( "/bin/tar -C ${General::swroot}/urlfilter -czf ${General::swroot}/urlfilter/backup.tar.gz settings timeconst userquota autoupdate $blistbackup " ))
257 $errormessage = $Lang :: tr
{ 'urlfilter backup error' };
262 print "Content-type: application/gzip \n " ;
263 print "Content-length: " ;
264 print (- s
"${General::swroot}/urlfilter/backup.tar.gz" );
266 print "Content-disposition: attachment; filename=urlfilter-backup.tar.gz \n\n " ;
268 open ( FILE
, "${General::swroot}/urlfilter/backup.tar.gz" );
269 while (< FILE
>) { print ; }
272 if (- e
"${General::swroot}/urlfilter/backup.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/backup.tar.gz" ); }
277 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restore' })
279 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPDATEFILE' });
281 if (!( $filtersettings { 'UPDATEFILE' } =~ /.tar.gz$/ ))
283 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
287 if (!(- d
"${General::swroot}/urlfilter/restore" )) { mkdir ( "${General::swroot}/urlfilter/restore" ); }
289 if ( copy
( $filtersettings { 'UPDATEFILE' }, "${General::swroot}/urlfilter/backup.tar.gz" ) != 1 )
294 my $exitcode = system ( "/bin/tar --no-same-owner --preserve-permissions -xzf ${General::swroot}/urlfilter/backup.tar.gz -C ${General::swroot}/urlfilter/restore" );
297 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
299 if (!(- e
"${General::swroot}/urlfilter/restore/settings" ))
301 $errormessage = $Lang :: tr
{ 'urlfilter invalid restore file' };
303 system ( "cp -rp ${General::swroot}/urlfilter/restore/* ${General::swroot}/urlfilter/" );
304 & readblockcategories
;
308 $restoremessage = $Lang :: tr
{ 'urlfilter restore success' };
312 if (- e
"${General::swroot}/urlfilter/backup.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/backup.tar.gz" ); }
313 if (- d
"${General::swroot}/urlfilter/restore" ) { system ( "rm -rf ${General::swroot}/urlfilter/restore" ); }
314 if ( $errormessage ) { goto ERROR
; }
317 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
319 $filtersettings { 'VALID' } = 'yes' ;
323 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter save and restart' })
325 if (!(- e
"${General::swroot}/proxy/enable" ))
327 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
330 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
332 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
336 $filtersettings { 'VALID' } = 'yes' ;
339 system ( "chown -R nobody.nobody $dbdir " );
341 if (- e
" $dbdir /custom/allowed/domains.db" ) { unlink ( " $dbdir /custom/allowed/domains.db" ); }
342 if (- e
" $dbdir /custom/allowed/urls.db" ) { unlink ( " $dbdir /custom/allowed/urls.db" ); }
343 if (- e
" $dbdir /custom/blocked/domains.db" ) { unlink ( " $dbdir /custom/blocked/domains.db" ); }
344 if (- e
" $dbdir /custom/blocked/urls.db" ) { unlink ( " $dbdir /custom/blocked/urls.db" ); }
348 if (- d
$_ ){ system ( "chmod 644 $_ /*" ); }
349 if (- d
$_ ){ system ( "chmod 666 $_ /*.db" ); }
351 if (- d
" $dbdir /custom/allowed" )
353 system ( "chmod 755 $dbdir /custom/allowed" );
354 system ( "chmod 644 $dbdir /custom/allowed/*" );
356 if (- d
" $dbdir /custom/blocked" )
358 system ( "chmod 755 $dbdir /custom/blocked" );
359 system ( "chmod 644 $dbdir /custom/blocked/*" );
362 system ( '/usr/local/bin/restartsquid' );
367 if ( $errormessage ) { $filtersettings { 'VALID' } = 'no' ; }
371 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter set time constraints' }) { $tcsettings { 'TCMODE' } = 'on' }
373 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'add' }))
375 $tcsettings { 'TCMODE' }= 'on' ;
377 if (! $tcsettings { 'DST' })
379 $errormessage = $Lang :: tr
{ 'urlfilter dst error' };
382 if (! $tcsettings { 'SRC' })
384 $errormessage = $Lang :: tr
{ 'urlfilter src error' };
387 if (!( $tcsettings { 'TO_HOUR' }. $tcsettings { 'TO_MINUTE' } gt $tcsettings { 'FROM_HOUR' }. $tcsettings { 'FROM_MINUTE' }))
389 $errormessage = $Lang :: tr
{ 'urlfilter timespace error' };
392 if (!(( $tcsettings { 'MON' } eq 'on' ) || ( $tcsettings { 'TUE' } eq 'on' ) || ( $tcsettings { 'WED' } eq 'on' ) || ( $tcsettings { 'THU' } eq 'on' ) || ( $tcsettings { 'FRI' } eq 'on' ) || ( $tcsettings { 'SAT' } eq 'on' ) || ( $tcsettings { 'SUN' } eq 'on' )))
394 $errormessage = $Lang :: tr
{ 'urlfilter weekday error' };
399 if ( $tcsettings { 'DST' } =~ /^any/ ) { $tcsettings { 'DST' } = 'any' ; }
400 if ( $tcsettings { 'ENABLERULE' } eq 'on' ) { $tcsettings { 'ACTIVE' } = $tcsettings { 'ENABLERULE' }; } else { $tcsettings { 'ACTIVE' } = 'off' }
402 $tcsettings { 'ENABLERULE' } = 'on' ;
403 if ( $tcsettings { 'EDITING' } eq 'no' ) {
404 open ( FILE
, ">> $tcfile " );
406 print FILE
" $tcsettings {'DEFINITION'}, $tcsettings {'MON'}, $tcsettings {'TUE'}, $tcsettings {'WED'}, $tcsettings {'THU'}, $tcsettings {'FRI'}, $tcsettings {'SAT'}, $tcsettings {'SUN'}, $tcsettings {'FROM_HOUR'}, $tcsettings {'FROM_MINUTE'}, $tcsettings {'TO_HOUR'}, $tcsettings {'TO_MINUTE'}, $tcsettings {'SRC'}, $tcsettings {'DST'}, $tcsettings {'ACCESS'}, $tcsettings {'ACTIVE'}, $tcsettings {'COMMENT'} \n " ;
408 open ( FILE
, "> $tcfile " );
411 foreach $line ( @tclist )
414 if ( $tcsettings { 'EDITING' } eq $id ) {
415 print FILE
" $tcsettings {'DEFINITION'}, $tcsettings {'MON'}, $tcsettings {'TUE'}, $tcsettings {'WED'}, $tcsettings {'THU'}, $tcsettings {'FRI'}, $tcsettings {'SAT'}, $tcsettings {'SUN'}, $tcsettings {'FROM_HOUR'}, $tcsettings {'FROM_MINUTE'}, $tcsettings {'TO_HOUR'}, $tcsettings {'TO_MINUTE'}, $tcsettings {'SRC'}, $tcsettings {'DST'}, $tcsettings {'ACCESS'}, $tcsettings {'ACTIVE'}, $tcsettings {'COMMENT'} \n " ;
416 } else { print FILE
" $line " ; }
421 $tcsettings { 'CHANGED' }= 'yes' ;
422 $tcsettings { 'TCMODE' }= 'on' ;
425 if ( $tcsettings { 'EDITING' } ne 'no' )
427 $tcsettings { 'ACTION' } = $Lang :: tr
{ 'edit' };
428 $tcsettings { 'ID' } = $tcsettings { 'EDITING' };
433 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'remove' }))
436 open ( FILE
, "> $tcfile " );
438 foreach $line ( @tclist )
441 unless ( $tcsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
444 $tcsettings { 'CHANGED' }= 'yes' ;
445 $tcsettings { 'TCMODE' }= 'on' ;
448 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restart' }))
450 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
452 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
454 if (!(- e
"${General::swroot}/proxy/enable" ))
456 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
459 if (! $errormessage ) { system ( '/usr/local/bin/restartsquid' ); }
460 $tcsettings { 'TCMODE' }= 'on' ;
463 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'toggle enable disable' }))
465 open ( FILE
, "> $tcfile " );
468 foreach $line ( @tclist )
471 unless ( $tcsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
475 @temp = split ( /\,/ , $line );
476 if ( $temp [ 15 ] eq 'on' ) { $temp [ 15 ] = 'off' ; } else { $temp [ 15 ] = 'on' }
477 print FILE
" $temp [0], $temp [1], $temp [2], $temp [3], $temp [4], $temp [5], $temp [6], $temp [7], $temp [8], $temp [9], $temp [10], $temp [11], $temp [12], $temp [13], $temp [14], $temp [15], $temp [16] \n " ;
481 $tcsettings { 'CHANGED' }= 'yes' ;
482 $tcsettings { 'TCMODE' }= 'on' ;
485 if (! $errormessage ) {
486 $tcsettings { 'ENABLERULE' }= 'on' ;
487 $tcsettings { 'TO_HOUR' }= '24' ;
490 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) && (! $errormessage ))
493 foreach $line ( @tclist )
496 if ( $tcsettings { 'ID' } eq $id )
499 @temp = split ( /\,/ , $line );
500 $tcsettings { 'DEFINITION' } = $temp [ 0 ];
501 $tcsettings { 'MON' } = $temp [ 1 ];
502 $tcsettings { 'TUE' } = $temp [ 2 ];
503 $tcsettings { 'WED' } = $temp [ 3 ];
504 $tcsettings { 'THU' } = $temp [ 4 ];
505 $tcsettings { 'FRI' } = $temp [ 5 ];
506 $tcsettings { 'SAT' } = $temp [ 6 ];
507 $tcsettings { 'SUN' } = $temp [ 7 ];
508 $tcsettings { 'FROM_HOUR' } = $temp [ 8 ];
509 $tcsettings { 'FROM_MINUTE' } = $temp [ 9 ];
510 $tcsettings { 'TO_HOUR' } = $temp [ 10 ];
511 $tcsettings { 'TO_MINUTE' } = $temp [ 11 ];
512 $tcsettings { 'SRC' } = $temp [ 12 ];
513 $tcsettings { 'DST' } = $temp [ 13 ];
514 $tcsettings { 'ACCESS' } = $temp [ 14 ];
515 $tcsettings { 'ENABLERULE' } = $temp [ 15 ];
516 $tcsettings { 'COMMENT' } = $temp [ 16 ];
519 $tcsettings { 'TCMODE' }= 'on' ;
522 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter set user quota' }) { $uqsettings { 'UQMODE' } = 'on' }
524 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'add' }))
526 $uqsettings { 'UQMODE' }= 'on' ;
528 if ((!( $uqsettings { 'TIME_QUOTA' } =~ /^\d+/ )) || ( $uqsettings { 'TIME_QUOTA' } < '1' ))
530 $errormessage = $Lang :: tr
{ 'urlfilter quota time error' };
533 @temp = split ( /\n/ , $uqsettings { 'QUOTA_USERS' });
534 undef $uqsettings { 'QUOTA_USERS' };
537 s/^\s+//g ; s/\s+$//g ;
538 if ( $_ ) { $uqsettings { 'QUOTA_USERS' } .= $_ . " \n " ; }
541 if ( $uqsettings { 'QUOTA_USERS' } eq '' )
543 $errormessage = $Lang :: tr
{ 'urlfilter quota user error' };
546 $_ = $uqsettings { 'QUOTA_USERS' };
548 my $quota_users = $_ ;
550 if ( $uqsettings { 'QUOTA_USERS' } =~ /\\/ )
552 $errormessage = $Lang :: tr
{ 'urlfilter invalid user error' };
555 if (! $errormessage ) {
556 if ( $uqsettings { 'ENABLEQUOTA' } eq 'on' ) { $uqsettings { 'ACTIVE' } = $uqsettings { 'ENABLEQUOTA' }; } else { $uqsettings { 'ACTIVE' } = 'off' }
558 $uqsettings { 'ENABLERULE' } = 'on' ;
559 if ( $uqsettings { 'EDITING' } eq 'no' ) {
560 open ( FILE
, ">> $uqfile " );
562 print FILE
" $uqsettings {'TIME_QUOTA'}, $uqsettings {'SPORADIC'}, $uqsettings {'RENEWAL'}, $quota_users , $uqsettings {'ACTIVE'} \n " ;
564 open ( FILE
, "> $uqfile " );
567 foreach $line ( @uqlist )
570 if ( $uqsettings { 'EDITING' } eq $id ) {
571 print FILE
" $uqsettings {'TIME_QUOTA'}, $uqsettings {'SPORADIC'}, $uqsettings {'RENEWAL'}, $quota_users , $uqsettings {'ACTIVE'} \n " ;
572 } else { print FILE
" $line " ; }
577 $uqsettings { 'CHANGED' }= 'yes' ;
578 $uqsettings { 'MODE' }= 'USERQUOTA' ;
579 $uqsettings { 'UQMODE' }= 'on' ;
582 if ( $uqsettings { 'EDITING' } ne 'no' )
584 $uqsettings { 'ACTION' } = $Lang :: tr
{ 'edit' };
585 $uqsettings { 'ID' } = $uqsettings { 'EDITING' };
590 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'remove' }))
593 open ( FILE
, "> $uqfile " );
595 foreach $line ( @uqlist )
598 unless ( $uqsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
601 $uqsettings { 'CHANGED' }= 'yes' ;
602 $uqsettings { 'UQMODE' }= 'on' ;
605 if (! $errormessage ) {
606 $uqsettings { 'ENABLEQUOTA' }= 'on' ;
609 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) && (! $errormessage ))
612 foreach $line ( @uqlist )
615 if ( $uqsettings { 'ID' } eq $id )
618 @temp = split ( /\,/ , $line );
619 $uqsettings { 'TIME_QUOTA' } = $temp [ 0 ];
620 $uqsettings { 'SPORADIC' } = $temp [ 1 ];
621 $uqsettings { 'RENEWAL' } = $temp [ 2 ];
622 $uqsettings { 'QUOTA_USERS' } = $temp [ 3 ];
623 $uqsettings { 'ENABLEQUOTA' } = $temp [ 4 ];
626 $uqsettings { 'UQMODE' }= 'on' ;
629 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'toggle enable disable' }))
631 open ( FILE
, "> $uqfile " );
634 foreach $line ( @uqlist )
637 unless ( $uqsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
641 @temp = split ( /\,/ , $line );
642 if ( $temp [ 4 ] eq 'on' ) { $temp [ 4 ] = 'off' ; } else { $temp [ 4 ] = 'on' }
643 print FILE
" $temp [0], $temp [1], $temp [2], $temp [3], $temp [4] \n " ;
647 $uqsettings { 'CHANGED' }= 'yes' ;
648 $uqsettings { 'UQMODE' }= 'on' ;
651 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restart' }))
653 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
655 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
657 if (!(- e
"${General::swroot}/proxy/enable" ))
659 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
662 if (! $errormessage ) { system ( '/usr/local/bin/restartsquid' ); }
663 $uqsettings { 'UQMODE' }= 'on' ;
666 if ( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter blacklist editor' }) { $besettings { 'BEMODE' } = 'on' ; }
668 if ( $besettings { 'MODE' } eq 'BLACKLIST_EDITOR' )
670 @temp = split ( /\n/ , $besettings { 'BE_DOMAINS' });
671 undef $besettings { 'BE_DOMAINS' };
674 s/^\s+//g ; s/\s+$//g ;
675 if ( $_ ) { $besettings { 'BE_DOMAINS' } .= $_ . " \n " ; }
677 chomp ( $besettings { 'BE_DOMAINS' });
678 @temp = split ( /\n/ , $besettings { 'BE_URLS' });
679 undef $besettings { 'BE_URLS' };
682 s/^\s+//g ; s/\s+$//g ;
683 if ( $_ ) { $besettings { 'BE_URLS' } .= $_ . " \n " ; }
685 chomp ( $besettings { 'BE_URLS' });
686 @temp = split ( /\n/ , $besettings { 'BE_EXPRESSIONS' });
687 undef $besettings { 'BE_EXPRESSIONS' };
690 s/^\s+//g ; s/\s+$//g ;
691 if ( $_ ) { $besettings { 'BE_EXPRESSIONS' } .= $_ . " \n " ; }
693 chomp ( $besettings { 'BE_EXPRESSIONS' });
696 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter load blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
698 $besettings { 'BEMODE' } = 'on' ;
700 $besettings { 'BE_NAME' } = $besettings { 'BE_BLACKLIST' };
702 delete $besettings { 'BE_DOMAINS' };
703 delete $besettings { 'BE_URLS' };
704 delete $besettings { 'BE_EXPRESSIONS' };
706 if (- e
" $dbdir / $besettings {'BE_NAME'}/domains" )
708 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/domains" );
709 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_DOMAINS' } .= $_ } };
711 chomp ( $besettings { 'BE_DOMAINS' });
713 if (- e
" $dbdir / $besettings {'BE_NAME'}/urls" )
715 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/urls" );
716 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_URLS' } .= $_ } };
718 chomp ( $besettings { 'BE_URLS' });
720 if (- e
" $dbdir / $besettings {'BE_NAME'}/expressions" )
722 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/expressions" );
723 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_EXPRESSIONS' } .= $_ } };
725 chomp ( $besettings { 'BE_EXPRESSIONS' });
729 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter import blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
731 $besettings { 'BEMODE' } = 'on' ;
733 & Header
:: getcgihash
( \
%besettings , { 'wantfile' => 1 , 'filevar' => 'IMPORTFILE' });
735 if (!( $besettings { 'IMPORTFILE' } =~ /.tar.gz$/ ))
737 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
739 if (!- d
" $editdir " ) { mkdir ( " $editdir " ); }
741 if ( copy
( $besettings { 'IMPORTFILE' }, " $editdir /blacklist.tar.gz" ) != 1 )
746 my $exitcode = system ( "/bin/tar --no-same-owner --preserve-permissions -xzf $editdir /blacklist.tar.gz -C $editdir " );
749 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
752 foreach (< $editdir /blacklists/ *>)
757 $besettings { 'BE_NAME' } = substr ( $_ , rindex ( $_ , "/" )+ 1 );
763 $errormessage = $Lang :: tr
{ 'urlfilter invalid import file' };
765 delete $besettings { 'BE_DOMAINS' };
766 delete $besettings { 'BE_URLS' };
767 delete $besettings { 'BE_EXPRESSIONS' };
769 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/domains" )
771 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/domains" );
772 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_DOMAINS' } .= $_ } };
774 chomp ( $besettings { 'BE_DOMAINS' });
776 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/urls" )
778 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/urls" );
779 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_URLS' } .= $_ } };
781 chomp ( $besettings { 'BE_URLS' });
783 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" )
785 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" );
786 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_EXPRESSIONS' } .= $_ } };
788 chomp ( $besettings { 'BE_EXPRESSIONS' });
793 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
799 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter export blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
801 $besettings { 'BEMODE' } = 'on' ;
803 if ( $besettings { 'BE_NAME' } eq '' )
805 $errormessage = $Lang :: tr
{ 'urlfilter category name error' };
806 } elsif ( $besettings { 'BE_DOMAINS' } || $besettings { 'BE_URLS' } || $besettings { 'BE_EXPRESSIONS' }) {
808 $_ = $besettings { 'BE_NAME' }; tr/A-Z/a-z/ ; $besettings { 'BE_NAME' } = $_ ;
810 if (!(- d
" $editdir " )) { mkdir ( " $editdir " ); }
811 if (!(- d
" $editdir /blacklists" )) { mkdir ( " $editdir /blacklists" ); }
812 if (!(- d
" $editdir /blacklists/ $besettings {'BE_NAME'}" )) { mkdir ( " $editdir /blacklists/ $besettings {'BE_NAME'}" ); }
814 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/domains" );
816 print FILE
" $besettings {'BE_DOMAINS'} \n " ;
818 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/urls" );
820 print FILE
" $besettings {'BE_URLS'} \n " ;
822 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" );
824 print FILE
" $besettings {'BE_EXPRESSIONS'} \n " ;
827 if ( system ( "/bin/tar -C $editdir -czf $editdir / $besettings {'BE_NAME'}.tar.gz blacklists" ))
829 $errormessage = $Lang :: tr
{ 'urlfilter export error' };
833 print "Content-type: application/gzip \n " ;
834 print "Content-length: " ;
835 print (- s
" $editdir / $besettings {'BE_NAME'}.tar.gz" );
837 print "Content-disposition: attachment; filename= $besettings {'BE_NAME'}.tar.gz \n\n " ;
839 open ( FILE
, " $editdir / $besettings {'BE_NAME'}.tar.gz" );
840 while (< FILE
>) { print ; }
843 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
847 $errormessage = $Lang :: tr
{ 'urlfilter category data error' };
851 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter install blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
853 $besettings { 'BEMODE' } = 'on' ;
855 if ( $besettings { 'BE_NAME' } eq '' )
857 $errormessage = $Lang :: tr
{ 'urlfilter category name error' };
858 } elsif ( $besettings { 'BE_DOMAINS' } || $besettings { 'BE_URLS' } || $besettings { 'BE_EXPRESSIONS' }) {
860 $_ = $besettings { 'BE_NAME' }; tr/A-Z/a-z/ ; $besettings { 'BE_NAME' } = $_ ;
862 if (!- d
" $editdir " ) { mkdir ( " $editdir " ); }
864 if (!- d
" $dbdir / $besettings {'BE_NAME'}" ) { mkdir ( " $dbdir / $besettings {'BE_NAME'}" ); }
866 if (- e
" $dbdir / $besettings {'BE_NAME'}/domains" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/domains" ); }
867 if ( $besettings { 'BE_DOMAINS' })
869 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/domains" );
871 print FILE
" $besettings {'BE_DOMAINS'} \n " ;
874 if (- e
" $dbdir / $besettings {'BE_NAME'}/urls" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/urls" ); }
875 if ( $besettings { 'BE_URLS' })
877 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/urls" );
879 print FILE
" $besettings {'BE_URLS'} \n " ;
882 if (- e
" $dbdir / $besettings {'BE_NAME'}/expressions" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/expressions" ); }
883 if ( $besettings { 'BE_EXPRESSIONS' })
885 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/expressions" );
887 print FILE
" $besettings {'BE_EXPRESSIONS'} \n " ;
891 open ( FILE
, "> $editdir /install.conf" );
893 print FILE
"logdir /var/log/squidGuard \n " ;
894 print FILE
"dbhome $dbdir / $besettings {'BE_NAME'} \n\n " ;
895 print FILE
"dest $besettings {'BE_NAME'} { \n " ;
896 if ( $besettings { 'BE_DOMAINS' }) { print FILE
" domainlist domains \n " ; }
897 if ( $besettings { 'BE_URLS' }) { print FILE
" urllist urls \n " ; }
898 if ( $besettings { 'BE_EXPRESSIONS' }) { print FILE
" expressions expressions \n " ; }
900 print FILE
"acl { \n " ;
901 print FILE
" default { \n " ;
902 print FILE
" pass none \n " ;
907 system ( "rm -f $dbdir / $besettings {'BE_NAME'}/*.db" );
908 system ( "/usr/sbin/squidGuard -c $editdir /install.conf -C all" );
909 system ( "chmod a+w $dbdir / $besettings {'BE_NAME'}/*.db" );
911 & readblockcategories
;
916 system ( '/usr/local/bin/restartsquid' ) unless ( $besettings { 'NORESTART' } eq 'on' );
918 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
920 $errormessage = $Lang :: tr
{ 'urlfilter category data error' };
924 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter save schedule' })
926 if (( $filtersettings { 'UPDATE_SOURCE' } eq 'custom' ) && ( $filtersettings { 'CUSTOM_UPDATE_URL' } eq '' ))
928 $errormessage = $Lang :: tr
{ 'urlfilter custom url required' };
930 open ( FILE
, "> $updconffile " );
931 print FILE
"ENABLE_AUTOUPDATE= $filtersettings {'ENABLE_AUTOUPDATE'} \n " ;
932 print FILE
"UPDATE_SCHEDULE= $filtersettings {'UPDATE_SCHEDULE'} \n " ;
933 print FILE
"UPDATE_SOURCE= $filtersettings {'UPDATE_SOURCE'} \n " ;
934 print FILE
"CUSTOM_UPDATE_URL= $filtersettings {'CUSTOM_UPDATE_URL'} \n " ;
937 if (- e
$upd_cron_dly ) { unlink ( $upd_cron_dly ); }
938 if (- e
$upd_cron_wly ) { unlink ( $upd_cron_wly ); }
939 if (- e
$upd_cron_mly ) { unlink ( $upd_cron_mly ); }
941 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'daily' ))
943 symlink ( "../bin/autoupdate.pl" , $upd_cron_dly )
945 symlink ( "/bin/false" , $upd_cron_dly )
948 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'weekly' ))
950 symlink ( "../bin/autoupdate.pl" , $upd_cron_wly )
952 symlink ( "/bin/false" , $upd_cron_wly )
955 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'monthly' ))
957 symlink ( "../bin/autoupdate.pl" , $upd_cron_mly )
959 symlink ( "/bin/false" , $upd_cron_mly )
964 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter update now' })
966 if ( $filtersettings { 'UPDATE_SOURCE' } eq 'custom' )
968 if ( $filtersettings { 'CUSTOM_UPDATE_URL' } eq '' )
970 $errormessage = $Lang :: tr
{ 'urlfilter custom url required' };
972 system ( "${General::swroot}/urlfilter/bin/autoupdate.pl $filtersettings {'CUSTOM_UPDATE_URL'} &" );
975 system ( "${General::swroot}/urlfilter/bin/autoupdate.pl $filtersettings {'UPDATE_SOURCE'} &" );
980 if (- e
"${General::swroot}/urlfilter/settings" ) { & General
:: readhash
( "${General::swroot}/urlfilter/settings" , \
%filtersettings ); }
984 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ 'off' } = '' ;
985 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ 'on' } = '' ;
986 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ $filtersettings { 'ENABLE_CUSTOM_BLACKLIST' }} = "checked='checked'" ;
987 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ 'off' } = '' ;
988 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ 'on' } = '' ;
989 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ $filtersettings { 'ENABLE_CUSTOM_WHITELIST' }} = "checked='checked'" ;
990 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ 'off' } = '' ;
991 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ 'on' } = '' ;
992 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ $filtersettings { 'ENABLE_CUSTOM_EXPRESSIONS' }} = "checked='checked'" ;
993 $checked { 'BLOCK_EXECUTABLES' }{ 'off' } = '' ;
994 $checked { 'BLOCK_EXECUTABLES' }{ 'on' } = '' ;
995 $checked { 'BLOCK_EXECUTABLES' }{ $filtersettings { 'BLOCK_EXECUTABLES' }} = "checked='checked'" ;
996 $checked { 'BLOCK_AUDIO-VIDEO' }{ 'off' } = '' ;
997 $checked { 'BLOCK_AUDIO-VIDEO' }{ 'on' } = '' ;
998 $checked { 'BLOCK_AUDIO-VIDEO' }{ $filtersettings { 'BLOCK_AUDIO-VIDEO' }} = "checked='checked'" ;
999 $checked { 'BLOCK_ARCHIVES' }{ 'off' } = '' ;
1000 $checked { 'BLOCK_ARCHIVES' }{ 'on' } = '' ;
1001 $checked { 'BLOCK_ARCHIVES' }{ $filtersettings { 'BLOCK_ARCHIVES' }} = "checked='checked'" ;
1002 $checked { 'ENABLE_REWRITE' }{ 'off' } = '' ;
1003 $checked { 'ENABLE_REWRITE' }{ 'on' } = '' ;
1004 $checked { 'ENABLE_REWRITE' }{ $filtersettings { 'ENABLE_REWRITE' }} = "checked='checked'" ;
1005 $checked { 'SHOW_CATEGORY' }{ 'off' } = '' ;
1006 $checked { 'SHOW_CATEGORY' }{ 'on' } = '' ;
1007 $checked { 'SHOW_CATEGORY' }{ $filtersettings { 'SHOW_CATEGORY' }} = "checked='checked'" ;
1008 $checked { 'SHOW_URL' }{ 'off' } = '' ;
1009 $checked { 'SHOW_URL' }{ 'on' } = '' ;
1010 $checked { 'SHOW_URL' }{ $filtersettings { 'SHOW_URL' }} = "checked='checked'" ;
1011 $checked { 'SHOW_IP' }{ 'off' } = '' ;
1012 $checked { 'SHOW_IP' }{ 'on' } = '' ;
1013 $checked { 'SHOW_IP' }{ $filtersettings { 'SHOW_IP' }} = "checked='checked'" ;
1014 $checked { 'ENABLE_DNSERROR' }{ 'off' } = '' ;
1015 $checked { 'ENABLE_DNSERROR' }{ 'on' } = '' ;
1016 $checked { 'ENABLE_DNSERROR' }{ $filtersettings { 'ENABLE_DNSERROR' }} = "checked='checked'" ;
1017 $checked { 'ENABLE_JPEG' }{ 'off' } = '' ;
1018 $checked { 'ENABLE_JPEG' }{ 'on' } = '' ;
1019 $checked { 'ENABLE_JPEG' }{ $filtersettings { 'ENABLE_JPEG' }} = "checked='checked'" ;
1020 $checked { 'ENABLE_EXPR_LISTS' }{ 'off' } = '' ;
1021 $checked { 'ENABLE_EXPR_LISTS' }{ 'on' } = '' ;
1022 $checked { 'ENABLE_EXPR_LISTS' }{ $filtersettings { 'ENABLE_EXPR_LISTS' }} = "checked='checked'" ;
1023 $checked { 'BLOCK_IP_ADDR' }{ 'off' } = '' ;
1024 $checked { 'BLOCK_IP_ADDR' }{ 'on' } = '' ;
1025 $checked { 'BLOCK_IP_ADDR' }{ $filtersettings { 'BLOCK_IP_ADDR' }} = "checked='checked'" ;
1026 $checked { 'BLOCK_ALL' }{ 'off' } = '' ;
1027 $checked { 'BLOCK_ALL' }{ 'on' } = '' ;
1028 $checked { 'BLOCK_ALL' }{ $filtersettings { 'BLOCK_ALL' }} = "checked='checked'" ;
1029 $checked { 'ENABLE_EMPTY_ADS' }{ 'off' } = '' ;
1030 $checked { 'ENABLE_EMPTY_ADS' }{ 'on' } = '' ;
1031 $checked { 'ENABLE_EMPTY_ADS' }{ $filtersettings { 'ENABLE_EMPTY_ADS' }} = "checked='checked'" ;
1032 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ 'off' } = '' ;
1033 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ 'on' } = '' ;
1034 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ $filtersettings { 'ENABLE_GLOBAL_WHITELIST' }} = "checked='checked'" ;
1035 $checked { 'ENABLE_SAFESEARCH' }{ 'off' } = '' ;
1036 $checked { 'ENABLE_SAFESEARCH' }{ 'on' } = '' ;
1037 $checked { 'ENABLE_SAFESEARCH' }{ $filtersettings { 'ENABLE_SAFESEARCH' }} = "checked='checked'" ;
1038 $checked { 'ENABLE_LOG' }{ 'off' } = '' ;
1039 $checked { 'ENABLE_LOG' }{ 'on' } = '' ;
1040 $checked { 'ENABLE_LOG' }{ $filtersettings { 'ENABLE_LOG' }} = "checked='checked'" ;
1041 $checked { 'ENABLE_USERNAME_LOG' }{ 'off' } = '' ;
1042 $checked { 'ENABLE_USERNAME_LOG' }{ 'on' } = '' ;
1043 $checked { 'ENABLE_USERNAME_LOG' }{ $filtersettings { 'ENABLE_USERNAME_LOG' }} = "checked='checked'" ;
1044 $checked { 'ENABLE_CATEGORY_LOG' }{ 'off' } = '' ;
1045 $checked { 'ENABLE_CATEGORY_LOG' }{ 'on' } = '' ;
1046 $checked { 'ENABLE_CATEGORY_LOG' }{ $filtersettings { 'ENABLE_CATEGORY_LOG' }} = "checked='checked'" ;
1048 foreach $category ( @filtergroups ) {
1049 $checked { $category }{ 'off' } = '' ;
1050 $checked { $category }{ 'on' } = '' ;
1051 $checked { $category }{ $filtersettings { $category }} = "checked='checked'" ;
1054 $selected { 'DEFINITION' }{ $tcsettings { 'DEFINITION' }} = "selected='selected'" ;
1055 $selected { 'FROM_HOUR' }{ $tcsettings { 'FROM_HOUR' }} = "selected='selected'" ;
1056 $selected { 'FROM_MINUTE' }{ $tcsettings { 'FROM_MINUTE' }} = "selected='selected'" ;
1057 $selected { 'TO_HOUR' }{ $tcsettings { 'TO_HOUR' }} = "selected='selected'" ;
1058 $selected { 'TO_MINUTE' }{ $tcsettings { 'TO_MINUTE' }} = "selected='selected'" ;
1060 @selectedcategories = split ( /\|/ , $tcsettings { 'DST' });
1061 foreach ( @selectedcategories )
1063 $selected { 'DST' }{ $_ } = "selected='selected'" ;
1066 $selected { 'ACCESS' }{ $tcsettings { 'ACCESS' }} = "selected='selected'" ;
1068 $checked { 'ENABLERULE' }{ 'off' } = '' ;
1069 $checked { 'ENABLERULE' }{ 'on' } = '' ;
1070 $checked { 'ENABLERULE' }{ $tcsettings { 'ENABLERULE' }} = "checked='checked'" ;
1071 $checked { 'MON' }{ 'off' } = '' ;
1072 $checked { 'MON' }{ 'on' } = '' ;
1073 $checked { 'MON' }{ $tcsettings { 'MON' }} = "checked='checked'" ;
1074 $checked { 'TUE' }{ 'off' } = '' ;
1075 $checked { 'TUE' }{ 'on' } = '' ;
1076 $checked { 'TUE' }{ $tcsettings { 'TUE' }} = "checked='checked'" ;
1077 $checked { 'WED' }{ 'off' } = '' ;
1078 $checked { 'WED' }{ 'on' } = '' ;
1079 $checked { 'WED' }{ $tcsettings { 'WED' }} = "checked='checked'" ;
1080 $checked { 'THU' }{ 'off' } = '' ;
1081 $checked { 'THU' }{ 'on' } = '' ;
1082 $checked { 'THU' }{ $tcsettings { 'THU' }} = "checked='checked'" ;
1083 $checked { 'FRI' }{ 'off' } = '' ;
1084 $checked { 'FRI' }{ 'on' } = '' ;
1085 $checked { 'FRI' }{ $tcsettings { 'FRI' }} = "checked='checked'" ;
1086 $checked { 'SAT' }{ 'off' } = '' ;
1087 $checked { 'SAT' }{ 'on' } = '' ;
1088 $checked { 'SAT' }{ $tcsettings { 'SAT' }} = "checked='checked'" ;
1089 $checked { 'SUN' }{ 'off' } = '' ;
1090 $checked { 'SUN' }{ 'on' } = '' ;
1091 $checked { 'SUN' }{ $tcsettings { 'SUN' }} = "checked='checked'" ;
1093 $selected { 'SPORADIC' }{ $uqsettings { 'SPORADIC' }} = "selected='selected'" ;
1094 $selected { 'RENEWAL' } { $uqsettings { 'RENEWAL' }} = "selected='selected'" ;
1096 $checked { 'ENABLEQUOTA' }{ 'off' } = '' ;
1097 $checked { 'ENABLEQUOTA' }{ 'on' } = '' ;
1098 $checked { 'ENABLEQUOTA' }{ $uqsettings { 'ENABLEQUOTA' }} = "checked='checked'" ;
1100 $selected { 'BE_BLACKLIST' }{ $besettings { 'BE_BLACKLIST' }} = "selected='selected'" ;
1103 & Header
:: showhttpheaders
();
1105 & Header
:: openpage
( $Lang :: tr
{ 'urlfilter configuration' }, 1 , '' );
1107 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
1109 if ( $errormessage ) {
1110 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
1111 print "<font class='base'> $errormessage </font> \n " ;
1112 & Header
:: closebox
();
1113 } elsif (( $tcsettings { 'CHANGED' } eq 'yes' ) || ( $uqsettings { 'CHANGED' } eq 'yes' ) ) {
1115 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
1116 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter restart notification'}:" );
1117 print "<class name='base'> $Lang ::tr{'urlfilter restart message'} \n " ;
1118 if ( $uqsettings { 'MODE' } eq 'USERQUOTA' ) { print "<p><class name='base'> $Lang ::tr{'urlfilter quota restart message'} \n " ; }
1120 print "<p><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter restart'}' />" ;
1121 if ( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) { print "<input type='hidden' name='MODE' value='TIMECONSTRAINT' />" ; }
1122 if ( $uqsettings { 'MODE' } eq 'USERQUOTA' ) { print "<input type='hidden' name='MODE' value='USERQUOTA' />" ; }
1123 & Header
:: closebox
();
1127 if ( $restoremessage ) {
1128 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter restore results'}:" );
1129 print "<class name='base'> $restoremessage \n " ;
1130 print " </class> \n " ;
1131 & Header
:: closebox
();
1134 if ((! $tcsettings { 'TCMODE' }) && (! $uqsettings { 'UQMODE' }) && (! $besettings { 'BEMODE' })) {
1136 if (!( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter manage repository' })) {
1138 #==========================================================
1140 # Section: Main Configuration
1142 #==========================================================
1144 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1146 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter filter settings'}:" );
1148 <table width='100%'>
1150 <td colspan='4'><b> $Lang ::tr{'urlfilter block categories'}</b></td>
1155 if ( @categories == 0 ) {
1158 <td><i> $Lang ::tr{'urlfilter no categories'}</i></td>
1168 for ( $n = 0 ; $n <= @categories ; $n = $n + $i ) {
1169 for ( $i = 0 ; $i <= 3 ; $i ++) {
1170 if ( $i eq 0 ) { print "<tr> \n " ; }
1171 if (( $n + $i ) < @categories ) {
1172 print "<td width='15%'> @categories [ $n + $i ]:<\/td> \n " ;
1173 print "<td width='10%'><input type='checkbox' name= @filtergroups [ $n + $i ] $checked { @filtergroups [ $n + $i ]}{'on'} /></td> \n " ;
1175 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1182 <table width='100%'>
1184 <td><b> $Lang ::tr{'urlfilter custom blacklist'}</b></td>
1190 <td colspan='2'> $Lang ::tr{'urlfilter blocked domains'} <img src='/blob.gif' alt='*' /></td>
1191 <td colspan='2'> $Lang ::tr{'urlfilter blocked urls'} <img src='/blob.gif' alt='*' /></td>
1194 <td colspan='2' width='50%'><textarea name='CUSTOM_BLACK_DOMAINS' cols='32' rows='6' wrap='off'>
1198 print $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
1202 <td colspan='2' width='50%'><textarea name='CUSTOM_BLACK_URLS' cols='32' rows='6' wrap='off'>
1206 print $filtersettings { 'CUSTOM_BLACK_URLS' };
1212 <table width='100%'>
1214 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom blacklist'}:</td>
1215 <td><input type='checkbox' name='ENABLE_CUSTOM_BLACKLIST' $checked {'ENABLE_CUSTOM_BLACKLIST'}{'on'} /></td>
1221 <table width='100%'>
1223 <td><b> $Lang ::tr{'urlfilter custom whitelist'}</b></td>
1229 <td colspan='2'> $Lang ::tr{'urlfilter allowed domains'} <img src='/blob.gif' alt='*' /></td>
1230 <td colspan='2'> $Lang ::tr{'urlfilter allowed urls'} <img src='/blob.gif' alt='*' /></td>
1233 <td colspan='2' width='50%'><textarea name='CUSTOM_WHITE_DOMAINS' cols='32' rows='6' wrap='off'>
1237 print $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
1241 <td colspan='2' width='50%'><textarea name='CUSTOM_WHITE_URLS' cols='32' rows='6' wrap='off'>
1245 print $filtersettings { 'CUSTOM_WHITE_URLS' };
1251 <table width='100%'>
1253 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom whitelist'}:</td>
1254 <td><input type='checkbox' name='ENABLE_CUSTOM_WHITELIST' $checked {'ENABLE_CUSTOM_WHITELIST'}{'on'} /></td>
1260 <table width='100%'>
1262 <td colspan='4'><b> $Lang ::tr{'urlfilter custom expression list'}</b></td>
1265 <td colspan='4'> $Lang ::tr{'urlfilter blocked expressions'} <img src='/blob.gif' alt='*' /></td>
1268 <td colspan='4'><textarea name='CUSTOM_EXPRESSIONS' cols='70' rows='3' wrap='off'>
1272 print $filtersettings { 'CUSTOM_EXPRESSIONS' };
1278 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom expression list'}:</td>
1279 <td><input type='checkbox' name='ENABLE_CUSTOM_EXPRESSIONS' $checked {'ENABLE_CUSTOM_EXPRESSIONS'}{'on'} /></td>
1285 <table width='100%'>
1287 <td colspan='4'><b> $Lang ::tr{'urlfilter file ext block'}</b></td>
1290 <td width='25%' class='base'> $Lang ::tr{'urlfilter block executables'}:</td>
1291 <td width='12%'><input type='checkbox' name='BLOCK_EXECUTABLES' $checked {'BLOCK_EXECUTABLES'}{'on'} /></td>
1292 <td width='25%' class='base'> $Lang ::tr{'urlfilter block audio-video'}:</td>
1293 <td><input type='checkbox' name='BLOCK_AUDIO-VIDEO' $checked {'BLOCK_AUDIO-VIDEO'}{'on'} /></td>
1296 <td class='base'> $Lang ::tr{'urlfilter block archives'}:</td>
1297 <td><input type='checkbox' name='BLOCK_ARCHIVES' $checked {'BLOCK_ARCHIVES'}{'on'} /></td>
1303 <table width='100%'>
1305 <td colspan='4'><b> $Lang ::tr{'urlfilter local file redirection'}</b></td>
1308 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable rewrite rules'}:</td>
1309 <td width='12%'><input type='checkbox' name='ENABLE_REWRITE' $checked {'ENABLE_REWRITE'}{'on'} /></td>
1314 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter manage repository'}'></td>
1321 <table width='100%'>
1323 <td colspan='2'><b> $Lang ::tr{'urlfilter network access control'}</b></td>
1328 <td class='base'> $Lang ::tr{'urlfilter unfiltered clients'}: <img src='/blob.gif' alt='*' /></td>
1329 <td><input type='text' name='UNFILTERED_CLIENTS' value=' $filtersettings {'UNFILTERED_CLIENTS'}' size='30' /></td>
1330 <td class='base'> $Lang ::tr{'urlfilter banned clients'}: <img src='/blob.gif' alt='*' /></td>
1331 <td><input type='text' name='BANNED_CLIENTS' value=' $filtersettings {'BANNED_CLIENTS'}' size='30' /></td>
1335 <table width='100%'>
1337 <td colspan='4'><b> $Lang ::tr{'urlfilter timebased access control'}</b></td>
1340 <td width='25%'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter set time constraints'}'></td>
1341 <td width='25%'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter set user quota'}'></td>
1347 <table width='100%'>
1349 <td colspan='4'><b> $Lang ::tr{'urlfilter block settings'}</b></td>
1352 <td width='25%' class='base'> $Lang ::tr{'urlfilter show category'}:</td>
1353 <td width='12%'><input type='checkbox' name='SHOW_CATEGORY' $checked {'SHOW_CATEGORY'}{'on'} /></td>
1354 <td width='25%' class='base'> $Lang ::tr{'urlfilter redirectpage'}: <img src='/blob.gif' alt='*' /></td>
1355 <td><input type='text' name='REDIRECT_PAGE' value=' $filtersettings {'REDIRECT_PAGE'}' size='40' /></td>
1358 <td class='base'> $Lang ::tr{'urlfilter show url'}:</td>
1359 <td><input type='checkbox' name='SHOW_URL' $checked {'SHOW_URL'}{'on'} /></td>
1360 <td class='base'> $Lang ::tr{'urlfilter msg text 1'}: <img src='/blob.gif' alt='*' /></td>
1361 <td><input type='text' name='MSG_TEXT_1' value=' $filtersettings {'MSG_TEXT_1'}' size='40' /></td>
1364 <td class='base'> $Lang ::tr{'urlfilter show ip'}:</td>
1365 <td><input type='checkbox' name='SHOW_IP' $checked {'SHOW_IP'}{'on'} /></td>
1366 <td class='base'> $Lang ::tr{'urlfilter msg text 2'}: <img src='/blob.gif' alt='*' /></td>
1367 <td><input type='text' name='MSG_TEXT_2' value=' $filtersettings {'MSG_TEXT_2'}' size='40' /></td>
1370 <td class='base'> $Lang ::tr{'urlfilter show dnserror'}:</td>
1371 <td><input type='checkbox' name='ENABLE_DNSERROR' $checked {'ENABLE_DNSERROR'}{'on'} /></td>
1372 <td class='base'> $Lang ::tr{'urlfilter msg text 3'}: <img src='/blob.gif' alt='*' /></td>
1373 <td><input type='text' name='MSG_TEXT_3' value=' $filtersettings {'MSG_TEXT_3'}' size='40' /></td>
1376 <td class='base'> $Lang ::tr{'urlfilter enable jpeg'}:</td>
1377 <td><input type='checkbox' name='ENABLE_JPEG' $checked {'ENABLE_JPEG'}{'on'} /></td>
1382 <table width='100%'>
1384 <td class='base'><b> $Lang ::tr{'urlfilter background image'}</b></td>
1387 <td><br> $Lang ::tr{'urlfilter background text'}:</td>
1390 <td><input type='file' name='BACKGROUND' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter upload background'}' /></td>
1394 <table width='100%'>
1396 <td colspan='4'><b> $Lang ::tr{'urlfilter advanced settings'}</b></td>
1399 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable expression lists'}:</td>
1400 <td width='12%'><input type='checkbox' name='ENABLE_EXPR_LISTS' $checked {'ENABLE_EXPR_LISTS'}{'on'} /></td>
1401 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable log'}:</td>
1402 <td><input type='checkbox' name='ENABLE_LOG' $checked {'ENABLE_LOG'}{'on'} /></td>
1405 <td class='base'> $Lang ::tr{'urlfilter safesearch'}:</td>
1406 <td><input type='checkbox' name='ENABLE_SAFESEARCH' $checked {'ENABLE_SAFESEARCH'}{'on'} /></td>
1407 <td class='base'> $Lang ::tr{'urlfilter username log'}:</td>
1408 <td><input type='checkbox' name='ENABLE_USERNAME_LOG' $checked {'ENABLE_USERNAME_LOG'}{'on'} /></td>
1411 <td class='base'> $Lang ::tr{'urlfilter empty ads'}:</td>
1412 <td><input type='checkbox' name='ENABLE_EMPTY_ADS' $checked {'ENABLE_EMPTY_ADS'}{'on'} /></td>
1413 <td class='base'> $Lang ::tr{'urlfilter category log'}:</td>
1414 <td><input type='checkbox' name='ENABLE_CATEGORY_LOG' $checked {'ENABLE_CATEGORY_LOG'}{'on'} /></td>
1417 <td class='base'> $Lang ::tr{'urlfilter block ip'}:</td>
1418 <td><input type='checkbox' name='BLOCK_IP_ADDR' $checked {'BLOCK_IP_ADDR'}{'on'} /></td>
1419 <td class='base'> $Lang ::tr{'urlfilter children'}:</td>
1420 <td><input type='text' name='CHILDREN' value=' $filtersettings {'CHILDREN'}' size='5' /></td>
1423 <td class='base'> $Lang ::tr{'urlfilter block all'}:</td>
1424 <td><input type='checkbox' name='BLOCK_ALL' $checked {'BLOCK_ALL'}{'on'} /></td>
1425 <td class='base'> $Lang ::tr{'urlfilter whitelist always allowed'}:</td>
1426 <td><input type='checkbox' name='ENABLE_GLOBAL_WHITELIST' $checked {'ENABLE_GLOBAL_WHITELIST'}{'on'} /></td>
1430 <table width='100%'>
1433 <img src='/blob.gif' align='top' alt='*' />
1434 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
1436 <td align='right'>
1440 <table width='100%'>
1443 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
1444 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter save and restart'}' /></td>
1451 & Header
:: closebox
();
1455 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1457 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter maintenance'}:" );
1460 <table width='100%'>
1462 <td class='base'><b> $Lang ::tr{'urlfilter blacklist update'}</b></td>
1465 <td> $Lang ::tr{'urlfilter upload information'}<p> $Lang ::tr{'urlfilter upload text'}:</td>
1468 <td><input type='file' name='UPDATEFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter upload blacklist'}' /></td>
1474 <table width='100%'>
1476 <td colspan='2' class='base'><b> $Lang ::tr{'urlfilter automatic blacklist update'}</b>
1479 if (- e
" $updflagfile " )
1481 $blacklistage = int (- M
" $updflagfile " );
1482 print " <b>[</b> <small><i> $Lang ::tr{'urlfilter blacklist age 1'} <b> $blacklistage </b> $Lang ::tr{'urlfilter blacklist age 2'}</i></small> <b>]</b>" ;
1485 $updatesettings { 'UPDATE_SCHEDULE' } = 'monthly' ;
1486 $updatesettings { 'CUSTOM_UPDATE_URL' } = '' ;
1488 if (- e
" $updconffile " ) { & General
:: readhash
( " $updconffile " , \
%updatesettings ); }
1490 $checked { 'ENABLE_AUTOUPDATE' }{ 'off' } = '' ;
1491 $checked { 'ENABLE_AUTOUPDATE' }{ 'on' } = '' ;
1492 $checked { 'ENABLE_AUTOUPDATE' }{ $updatesettings { 'ENABLE_AUTOUPDATE' }} = "checked='checked'" ;
1494 $selected { 'UPDATE_SCHEDULE' }{ $updatesettings { 'UPDATE_SCHEDULE' }} = "selected='selected'" ;
1496 $selected { 'UPDATE_SOURCE' }{ $updatesettings { 'UPDATE_SOURCE' }} = "selected='selected'" ;
1502 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable automatic blacklist update'}:</td>
1503 <td width='75%' class='base'><input type='checkbox' name='ENABLE_AUTOUPDATE' $checked {'ENABLE_AUTOUPDATE'}{'on'} /></td>
1506 <td class='base'> $Lang ::tr{'urlfilter automatic update schedule'}:</td>
1508 <select name='UPDATE_SCHEDULE'>
1509 <option value='daily' $selected {'UPDATE_SCHEDULE'}{'daily'}> $Lang ::tr{'urlfilter daily'}</option>
1510 <option value='weekly' $selected {'UPDATE_SCHEDULE'}{'weekly'}> $Lang ::tr{'urlfilter weekly'}</option>
1511 <option value='monthly' $selected {'UPDATE_SCHEDULE'}{'monthly'}> $Lang ::tr{'urlfilter monthly'}</option>
1516 <td class='base'> $Lang ::tr{'urlfilter select source'}:</td>
1517 <td class='base' colspan='2'>
1518 <select name='UPDATE_SOURCE'>
1522 foreach ( @source_urllist ) {
1524 $source_name = substr ( $_ , 0 , rindex ( $_ , "," ));
1525 $source_url = substr ( $_ , index ( $_ , "," )+ 1 );
1526 print " \t <option value=' $source_url ' $selected {'UPDATE_SOURCE'}{ $source_url }> $source_name </option> \n " ;
1530 <option value='custom' $selected {'UPDATE_SOURCE'}{'custom'}> $Lang ::tr{'urlfilter custom url'}</option>
1535 <td> $Lang ::tr{'urlfilter custom url'}:</td>
1536 <td><input type='text' name='CUSTOM_UPDATE_URL' value=' $updatesettings {'CUSTOM_UPDATE_URL'}' size='72' /></td>
1539 <table width='100%'>
1541 <td width='25%'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter save schedule'}'> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter update now'}'></td>
1547 <table width='100%'>
1549 <td class='base'><b> $Lang ::tr{'urlfilter blacklist editor'}</b></td>
1552 <td> $Lang ::tr{'urlfilter blacklist editor info'}</td>
1555 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter blacklist editor'}' /></td>
1561 <table width='100%'>
1563 <td colspan='4' class='base'><b> $Lang ::tr{'urlfilter backup settings'}</b></td>
1566 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable full backup'}:</td>
1567 <td width='12%' class='base'><input type='checkbox' name='ENABLE_FULLBACKUP' $checked {'ENABLE_FULLBACKUP'}{'on'} /></td>
1572 <td colspan='4' class='base'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter backup'}' /></td>
1578 <table width='100%'>
1580 <td class='base'><b> $Lang ::tr{'urlfilter restore settings'}</b></td>
1583 <td> $Lang ::tr{'urlfilter restore text'}:</td>
1586 <td><input type='file' name='UPDATEFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter restore'}' /></td>
1593 & Header
:: closebox
();
1597 #==========================================================
1599 # Section: Manage Repository
1601 #==========================================================
1603 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1605 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter manage local file repository'}:" );
1607 <table width='100%'>
1609 <td> $Lang ::tr{'urlfilter repository information'}<br><br></td>
1612 <td> $Lang ::tr{'urlfilter upload file text'}:</td>
1615 <td><input type='file' name='UPLOADFILE' size='50' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter upload file'}' /></td>
1618 <td><br><b> $Lang ::tr{'urlfilter upload file information 1'}:</b> $Lang ::tr{'urlfilter upload file information 2'}</td>
1622 <table width='100%'>
1624 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
1631 & Header
:: closebox
();
1633 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter current files'}: </b>[ $repository ]" );
1635 @repositorylist = < $repository /*>;
1637 undef @repositoryfiles ;
1638 foreach ( @repositorylist )
1640 if (!- d
) { push ( @repositoryfiles , substr ( $_ , rindex ( $_ , "/" )+ 1 )); }
1643 if ( @repositoryfiles )
1646 <table width='100%'>
1648 <td align='center'><b> $Lang ::tr{'urlfilter filename'}</b></td>
1649 <td width='15%' align='center'><b> $Lang ::tr{'urlfilter filesize'}</b></td>
1650 <td width='10%'></td>
1655 foreach $line ( @repositoryfiles )
1659 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
1661 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
1662 $filesize = (- s
" $repository / $line " );
1663 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/ ;
1666 <td> $line </td>
1667 <td align='right'> $filesize </td>
1670 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
1671 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
1672 <input type='hidden' name='ID' value=' $line ' />
1673 <input type='hidden' name='ACTION' value=' $Lang ::tr{'urlfilter remove file'}' />
1690 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
1691 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
1692 <td class='base'> $Lang ::tr{'remove'}</td>
1699 print "<i> $Lang ::tr{'urlfilter empty repository'}</i> \n " ;
1702 & Header
:: closebox
();
1706 } elsif ( $tcsettings { 'TCMODE' }) {
1708 #==========================================================
1710 # Section: Set Time Constraints
1712 #==========================================================
1714 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
1716 $buttontext = $Lang :: tr
{ 'urlfilter add rule' };
1717 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
1718 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter edit time constraint rule' }. ':' );
1719 $buttontext = $Lang :: tr
{ 'urlfilter update rule' };
1721 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter add new time constraint rule' }. ':' );
1725 <table width='100%'>
1727 <td width='2%'> $Lang ::tr{'urlfilter constraint definition'}</td>
1728 <td width='1%'> </td>
1729 <td width='2%' align='center'> $Lang ::tr{'urlfilter monday'}</td>
1730 <td width='2%' align='center'> $Lang ::tr{'urlfilter tuesday'}</td>
1731 <td width='2%' align='center'> $Lang ::tr{'urlfilter wednesday'}</td>
1732 <td width='2%' align='center'> $Lang ::tr{'urlfilter thursday'}</td>
1733 <td width='2%' align='center'> $Lang ::tr{'urlfilter friday'}</td>
1734 <td width='2%' align='center'> $Lang ::tr{'urlfilter saturday'}</td>
1735 <td width='2%' align='center'> $Lang ::tr{'urlfilter sunday'}</td>
1736 <td width='1%'> </td>
1737 <td width='7%' colspan=3> $Lang ::tr{'urlfilter from'}</td>
1738 <td width='1%'> </td>
1739 <td width='7%' colspan=3> $Lang ::tr{'urlfilter to'}</td>
1744 <select name='DEFINITION'>
1745 <option value='within' $selected {'DEFINITION'}{'within'}> $Lang ::tr{'urlfilter constraint within'}</option>
1746 <option value='outside' $selected {'DEFINITION'}{'outside'}> $Lang ::tr{'urlfilter constraint outside'}</option>
1750 <td class='base'><input type='checkbox' name='MON' $checked {'MON'}{'on'} /></td>
1751 <td class='base'><input type='checkbox' name='TUE' $checked {'TUE'}{'on'} /></td>
1752 <td class='base'><input type='checkbox' name='WED' $checked {'WED'}{'on'} /></td>
1753 <td class='base'><input type='checkbox' name='THU' $checked {'THU'}{'on'} /></td>
1754 <td class='base'><input type='checkbox' name='FRI' $checked {'FRI'}{'on'} /></td>
1755 <td class='base'><input type='checkbox' name='SAT' $checked {'SAT'}{'on'} /></td>
1756 <td class='base'><input type='checkbox' name='SUN' $checked {'SUN'}{'on'} /></td>
1759 <select name='FROM_HOUR'>
1762 for ( $i = 0 ; $i <= 24 ; $i ++) {
1763 $_ = sprintf ( " %02s " , $i );
1764 print "<option $selected {'FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1771 <select name='FROM_MINUTE'>
1774 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1775 $_ = sprintf ( " %02s " , $i );
1776 print "<option $selected {'FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1783 <select name='TO_HOUR'>
1786 for ( $i = 0 ; $i <= 24 ; $i ++) {
1787 $_ = sprintf ( " %02s " , $i );
1788 print "<option $selected {'TO_HOUR'}{ $_ }> $_ </option> \n " ;
1795 <select name='TO_MINUTE'>
1798 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1799 $_ = sprintf ( " %02s " , $i );
1800 print "<option $selected {'TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1811 <table width='100%'>
1813 <td width='5%'> $Lang ::tr{'urlfilter source'}</td>
1814 <td width='1%'> </td>
1815 <td width='5%'> $Lang ::tr{'urlfilter dst'} <img src='/blob.gif' alt='*'><img src='/blob.gif' alt='*'></td>
1816 <td width='1%'> </td>
1817 <td width='5%'> $Lang ::tr{'urlfilter access'}</td>
1821 <td valign='top'><input type='text' name='SRC' value=' $tcsettings {'SRC'}' size='32' /></td>
1823 <td class='base' rowspan='3' valign='top'>
1824 <select name='DST' size='4' multiple>
1825 <option value='any' $selected {'DST'}{'any'} = "selected='selected'"> $Lang ::tr{'urlfilter category all'}</option>
1826 <option value='in-addr' $selected {'DST'}{'in-addr'} = "selected='selected'">in-addr</option>
1830 & readblockcategories
;
1831 foreach ( @categories )
1833 print "<option value=' $_ ' $selected {'DST'}{ $_ }> $_ </option> \n " ;
1837 <option value='files' $selected {'DST'}{'files'} = "selected='selected'">files</option>
1838 <option value='custom-blocked' $selected {'DST'}{'custom-blocked'} = "selected='selected'">custom-blocked</option>
1839 <option value='custom-expressions' $selected {'DST'}{'custom-expressions'} = "selected='selected'">custom-expressions</option>
1843 <td class='base' valign='top'>
1844 <select name='ACCESS'>
1845 <option value='block' $selected {'ACCESS'}{'block'}> $Lang ::tr{'urlfilter mode block'}</option>
1846 <option value='allow' $selected {'ACCESS'}{'allow'}> $Lang ::tr{'urlfilter mode allow'}</option>
1852 <td> $Lang ::tr{'remark'} <img src='/blob.gif' alt='*'></td>
1859 <td><input type='text' name='COMMENT' value=' $tcsettings {'COMMENT'}' size='32' /></td>
1867 <table width='100%'>
1869 <td class='base'> $Lang ::tr{'urlfilter enabled'}<input type='checkbox' name='ENABLERULE' $checked{'ENABLERULE'}{'on'} /></td>
1877 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
1878 <td><input type='hidden' name='MODE' value='TIMECONSTRAINT' /></td>
1879 <td><input type='submit' name='SUBMIT' value=' $buttontext ' /></td>
1880 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
1882 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
1886 <table width='100%'>
1888 <td width='1%' align='right'> <img src='/blob.gif' align='top' alt='*' /> </td>
1889 <td><font class='base'> $Lang ::tr{'this field may be blank'}</font></td>
1892 <td width='1%' align='right'><img src='/blob.gif' align='top' alt='*' /><img src='/blob.gif' align='top' alt='*' /> </td>
1893 <td><font class='base'> $Lang ::tr{'urlfilter select multi'}</font></td>
1899 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
1900 print "<input type='hidden' name='EDITING' value=' $tcsettings {'ID'}' /> \n " ;
1902 print "<input type='hidden' name='EDITING' value='no' /> \n " ;
1905 & Header
:: closebox
();
1908 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'current rules' });
1910 <table width='100%'>
1912 <td width='5%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter constraint definition'}</b></td>
1913 <td width='10%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter time space'}</b></td>
1914 <td width='15%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter src'}</b></td>
1915 <td width='5%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter dst'}</b></td>
1916 <td width='10%' class='boldbase' colspan='4' align='center'> </td>
1921 if ( $tcsettings { 'ACTION' } ne '' or $changed ne 'no' )
1923 open ( FILE
, $tcfile );
1929 foreach $line ( @tclist )
1933 @temp = split ( /\,/ , $line );
1934 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $tcsettings { 'ID' } eq $id ) {
1935 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
1937 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
1939 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
1940 if ( $temp [ 0 ] eq 'within' ) { $temp [ 0 ]= $Lang :: tr
{ 'urlfilter constraint within' }; } else { $temp [ 0 ]= $Lang :: tr
{ 'urlfilter constraint outside' }; }
1941 if ( $temp [ 13 ] eq 'any' ) { $temp [ 13 ]= $Lang :: tr
{ 'urlfilter category all' }; }
1942 if ( $temp [ 15 ] eq 'on' ) { $gif = 'on.gif' ; $toggle = 'off' ; $gdesc = $Lang :: tr
{ 'click to disable' };}
1943 else { $gif = 'off.gif' ; $toggle = 'on' ; $gdesc = $Lang :: tr
{ 'click to enable' }; }
1944 if ( $temp [ 14 ] eq 'block' ) { $led = 'led-red.gif' ; $ldesc = $Lang :: tr
{ 'urlfilter block access' };}
1945 else { $led = 'led-green.gif' ; $ldesc = $Lang :: tr
{ 'urlfilter allow access' }; }
1948 if ( $temp [ 1 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter mon' }; } else { $time .= '=' ; }
1949 if ( $temp [ 2 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter tue' }; } else { $time .= '=' ; }
1950 if ( $temp [ 3 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter wed' }; } else { $time .= '=' ; }
1951 if ( $temp [ 4 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter thu' }; } else { $time .= '=' ; }
1952 if ( $temp [ 5 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter fri' }; } else { $time .= '=' ; }
1953 if ( $temp [ 6 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter sat' }; } else { $time .= '=' ; }
1954 if ( $temp [ 7 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter sun' }; } else { $time .= '=' ; }
1955 $time = $time . ' ' . $temp [ 8 ]. ':' . $temp [ 9 ]. ' to ' . $temp [ 10 ]. ':' . $temp [ 11 ];
1958 <td align='center'> $temp [0]</td>
1959 <td align='center' nowrap> $time </td>
1960 <td align='center'> $temp [12]</td>
1961 <td align='center'> $temp [13]</td>
1962 <td align='center'><image src='/images/urlfilter/ $led ' alt=' $ldesc '></td>
1965 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
1966 <input type='image' name=' $Lang ::tr{'toggle enable disable'}' src='/images/ $gif ' title=' $gdesc ' alt=' $gdesc ' />
1967 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1968 <input type='hidden' name='ID' value=' $id ' />
1969 <input type='hidden' name='ACTIVE' value=' $toggle ' />
1970 <input type='hidden' name='ACTION' value=' $Lang ::tr{'toggle enable disable'}' />
1975 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
1976 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
1977 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1978 <input type='hidden' name='ID' value=' $id ' />
1979 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
1984 <form method='post' name='frmc $id ' action=' $ENV {'SCRIPT_NAME'}'>
1985 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
1986 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1987 <input type='hidden' name='ID' value=' $id ' />
1988 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
1995 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $tcsettings { 'ID' } eq $id ) {
1996 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
1998 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
2000 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
2002 <td align='center' colspan='4'> $temp [16]
2004 <td align='center' colspan='4'>
2013 # If the time constraint file contains entries, print entries and action icons
2014 if (! - z
" $tcfile " ) {
2019 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2020 <td> <img src='/images/urlfilter/led-green.gif' alt=' $Lang ::tr{'urlfilter allow access'}' /></td>
2021 <td class='base'> $Lang ::tr{'urlfilter allow'}</td>
2022 <td> <img src='/images/urlfilter/led-red.gif' alt=' $Lang ::tr{'urlfilter block access'}' /></td>
2023 <td class='base'> $Lang ::tr{'urlfilter block'}</td>
2024 <td> <img src='/images/on.gif' alt=' $Lang ::tr{'click to disable'}' /></td>
2025 <td class='base'> $Lang ::tr{'click to disable'}</td>
2026 <td> <img src='/images/off.gif' alt=' $Lang ::tr{'click to enable'}' /></td>
2027 <td class='base'> $Lang ::tr{'click to enable'}</td>
2028 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2029 <td class='base'> $Lang ::tr{'edit'}</td>
2030 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2031 <td class='base'> $Lang ::tr{'remove'}</td>
2038 & Header
:: closebox
();
2040 } elsif ( $uqsettings { 'UQMODE' }) {
2042 #==========================================================
2044 # Section: Set User Quota
2046 #==========================================================
2048 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
2050 $buttontext = $Lang :: tr
{ 'urlfilter add rule' };
2051 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2052 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter edit user quota rule' }. ':' );
2053 $buttontext = $Lang :: tr
{ 'urlfilter update rule' };
2055 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter add new user quota rule' }. ':' );
2059 <table width='100%'>
2061 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
2064 <td class='base'> $Lang ::tr{'urlfilter user time quota'}:</td>
2065 <td><input type='text' name='TIME_QUOTA' value=' $uqsettings {'TIME_QUOTA'}' size='5' /></td>
2066 <td colspan='2' rowspan= '5' valign='top' class='base'>
2067 <table cellpadding='0' cellspacing='0'>
2069 <!-- intentionally left empty -->
2072 <td> $Lang ::tr{'urlfilter assigned quota users'}:</td>
2075 <!-- intentionally left empty -->
2078 <!-- intentionally left empty -->
2081 <td><textarea name='QUOTA_USERS' cols='32' rows='6' wrap='off'>
2085 $uqsettings { 'QUOTA_USERS' } =~ s/\|/\n/g ;
2086 print $uqsettings { 'QUOTA_USERS' };
2095 <td class='base'> $Lang ::tr{'urlfilter activity detection'}:</td>
2096 <td class='base'><select name='SPORADIC'>
2097 <option value='0' $selected {'SPORADIC'}{'0'}> $Lang ::tr{'urlfilter disabled'}</option>
2098 <option value='300' $selected {'SPORADIC'}{'300'}>5 $Lang ::tr{'urlfilter minutes'}</option>
2099 <option value='900' $selected {'SPORADIC'}{'900'}>15 $Lang ::tr{'urlfilter minutes'}</option>
2103 <td class='base'> $Lang ::tr{'urlfilter renewal period'}:</td>
2104 <td class='base'><select name='RENEWAL'>
2105 <option value='hourly' $selected {'RENEWAL'}{'hourly'}> $Lang ::tr{'urlfilter hourly'}</option>
2106 <option value='daily' $selected {'RENEWAL'}{'daily'}> $Lang ::tr{'urlfilter daily'}</option>
2107 <option value='weekly' $selected {'RENEWAL'}{'weekly'}> $Lang ::tr{'urlfilter weekly'}</option>
2111 <td colspan='2'> </td>
2114 <td class='base'> $Lang ::tr{'urlfilter enabled'}</td>
2115 <td class='base'><input type='checkbox' name='ENABLEQUOTA' $checked {'ENABLEQUOTA'}{'on'} /></td>
2123 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2124 <td><input type='hidden' name='MODE' value='USERQUOTA' /></td>
2125 <td><input type='submit' name='SUBMIT' value=' $buttontext ' /></td>
2126 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
2128 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2136 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2137 print "<input type='hidden' name='EDITING' value=' $uqsettings {'ID'}' /> \n " ;
2139 print "<input type='hidden' name='EDITING' value='no' /> \n " ;
2142 & Header
:: closebox
();
2145 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'current rules' });
2147 <table width='100%'>
2149 <td width='15%' class='boldbase' align='center'><b><nobr> $Lang ::tr{'urlfilter time quota'}</nobr></b></td>
2150 <td width='15%' class='boldbase' align='center'><b><nobr> $Lang ::tr{'urlfilter activity detection'}</nobr></b></td>
2151 <td width='10%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter renewal'}</b></td>
2152 <td class='boldbase' align='center'><b> $Lang ::tr{'urlfilter assigned users'}</b></td>
2153 <td width='20%' class='boldbase' colspan='4' align='center'> </td>
2158 if ( $uqsettings { 'ACTION' } ne '' or $changed ne 'no' )
2160 open ( FILE
, $uqfile );
2166 foreach $line ( @uqlist )
2170 @temp = split ( /\,/ , $line );
2171 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $uqsettings { 'ID' } eq $id ) {
2172 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2174 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
2176 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
2177 if ( $temp [ 4 ] eq 'on' ) { $gif = 'on.gif' ; $toggle = 'off' ; $gdesc = $Lang :: tr
{ 'click to disable' };}
2178 else { $gif = 'off.gif' ; $toggle = 'on' ; $gdesc = $Lang :: tr
{ 'click to enable' }; }
2180 $temp [ 5 ] = $temp [ 1 ];
2181 if ( $temp [ 1 ] eq '0' ) { $temp [ 5 ] = $Lang :: tr
{ 'urlfilter disabled' } } else { $temp [ 5 ] = ( $temp [ 5 ]/ 60 ). ' ' . $Lang :: tr
{ 'urlfilter minutes' } }
2182 $_ = $temp [ 3 ]; s/\|/, /g ; $temp [ 6 ] = $_ ;
2185 <td align='center'> $temp [0] $Lang ::tr{'urlfilter minutes'}</td>
2186 <td align='center'> $temp [5]</td>
2187 <td align='center'> $Lang ::tr{'urlfilter '. $temp [2]}</td>
2188 <td align='center'> $temp [6]</td>
2191 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2192 <input type='image' name=' $Lang ::tr{'toggle enable disable'}' src='/images/ $gif ' title=' $gdesc ' alt=' $gdesc ' />
2193 <input type='hidden' name='MODE' value='USERQUOTA' />
2194 <input type='hidden' name='ID' value=' $id ' />
2195 <input type='hidden' name='ACTIVE' value=' $toggle ' />
2196 <input type='hidden' name='ACTION' value=' $Lang ::tr{'toggle enable disable'}' />
2201 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2202 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2203 <input type='hidden' name='MODE' value='USERQUOTA' />
2204 <input type='hidden' name='ID' value=' $id ' />
2205 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2210 <form method='post' name='frmc $id ' action=' $ENV {'SCRIPT_NAME'}'>
2211 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2212 <input type='hidden' name='MODE' value='USERQUOTA' />
2213 <input type='hidden' name='ID' value=' $id ' />
2214 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2225 # If the user quota file contains entries, print entries and action icons
2226 if (! - z
" $uqfile " ) {
2231 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2232 <td> <img src='/images/on.gif' alt=' $Lang ::tr{'click to disable'}' /></td>
2233 <td class='base'> $Lang ::tr{'click to disable'}</td>
2234 <td> <img src='/images/off.gif' alt=' $Lang ::tr{'click to enable'}' /></td>
2235 <td class='base'> $Lang ::tr{'click to enable'}</td>
2236 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2237 <td class='base'> $Lang ::tr{'edit'}</td>
2238 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2239 <td class='base'> $Lang ::tr{'remove'}</td>
2246 & Header
:: closebox
();
2250 #==========================================================
2252 # Section: Blacklist editor
2254 #==========================================================
2256 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
2258 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter urlfilter blacklist editor' }. ':' );
2262 <table width='100%'>
2264 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
2267 <td class='base'><b> $Lang ::tr{'urlfilter blacklist name'}</b></td>
2270 <td class='base'> $Lang ::tr{'urlfilter blacklist category name'}:</td>
2271 <td><input type='text' name='BE_NAME' value=' $besettings {'BE_NAME'}' size='12' /></td>
2275 <table width='100%'>
2277 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='20%'></td>
2280 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter edit domains urls expressions'}</b></td>
2283 <td colspan='2'> $Lang ::tr{'urlfilter domains'}</td>
2284 <td colspan='2'> $Lang ::tr{'urlfilter urls'}</td>
2287 <td colspan='2'><textarea name='BE_DOMAINS' cols='38' rows='10' wrap='off'>
2291 print $besettings { 'BE_DOMAINS' };
2295 <td colspan='2'><textarea name='BE_URLS' cols='38' rows='10' wrap='off'>
2299 print $besettings { 'BE_URLS' };
2305 <td colspan='4'> $Lang ::tr{'urlfilter expressions'}</td>
2308 <td colspan='4'><textarea name='BE_EXPRESSIONS' cols='80' rows='3' wrap='off'>
2312 print $besettings { 'BE_EXPRESSIONS' };
2319 <table width='100%'>
2321 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter load blacklist'}</b></td>
2324 <td width='25%' class='base'> $Lang ::tr{'urlfilter select blacklist'}:</td>
2325 <td width='20%' class='base'>
2326 <select name='BE_BLACKLIST'>
2330 & readblockcategories
;
2331 foreach ( @categories )
2333 print "<option value=' $_ ' $selected {'BE_BLACKLIST'}{ $_ }> $_ </option> \n " ;
2342 <td colpsan='4'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter load blacklist'}' /></td>
2347 <table width='100%'>
2349 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter import blacklist'}</b></td>
2352 <td colspan='4'> $Lang ::tr{'urlfilter import text'}:</td>
2355 <td nowrap><input type='file' name='IMPORTFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter import blacklist'}' /></td>
2356 <td><input type='hidden' name='MODE' value='BLACKLIST_EDITOR' /></td>
2360 <table width='100%'>
2362 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter export blacklist'}</b></td>
2365 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter export blacklist'}' /></td>
2369 <table width='100%'>
2371 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter install blacklist'}</b></td>
2374 <td width='25%' class='base'> $Lang ::tr{'urlfilter dont restart urlfilter'}:</td>
2375 <td width='20%' class='base'><input type='checkbox' name='NORESTART' $checked {'NORESTART'}{'on'} /></td>
2380 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter install blacklist'}' /></td>
2383 <td class='base' colspan='4'><br> $Lang ::tr{'urlfilter install information'}</td>
2389 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
2391 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2398 & Header
:: closebox
();
2403 & Header
:: closebigbox
();
2405 & Header
:: closepage
();
2407 # -------------------------------------------------------------------
2413 delete $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2414 delete $filtersettings { 'CUSTOM_BLACK_URLS' };
2415 delete $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2416 delete $filtersettings { 'CUSTOM_WHITE_URLS' };
2417 delete $filtersettings { 'CUSTOM_EXPRESSIONS' };
2418 delete $filtersettings { 'BACKGROUND' };
2419 delete $filtersettings { 'UPDATEFILE' };
2421 & General
:: writehash
( "${General::swroot}/urlfilter/settings" , \
%filtersettings );
2424 # -------------------------------------------------------------------
2426 sub readblockcategories
2429 foreach $blacklist (< $dbdir /*>) {
2430 if (- d
$blacklist ) {
2431 $lastslashpos = rindex ( $blacklist , "/" );
2432 if ( $lastslashpos > - 1 ) {
2433 $section = substr ( $blacklist , $lastslashpos + 1 );
2435 $section = $blacklist ;
2437 if (!( $section eq 'custom' )) { push ( @categories , $section ) };
2441 @filtergroups = @categories ;
2442 foreach ( @filtergroups ) {
2448 # -------------------------------------------------------------------
2452 if (- e
" $dbdir /custom/blocked/domains" ) {
2453 open ( FILE
, " $dbdir /custom/blocked/domains" );
2454 delete $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2455 while (< FILE
>) { $filtersettings { 'CUSTOM_BLACK_DOMAINS' } .= $_ };
2459 if (- e
" $dbdir /custom/blocked/urls" ) {
2460 open ( FILE
, " $dbdir /custom/blocked/urls" );
2461 delete $filtersettings { 'CUSTOM_BLACK_URLS' };
2462 while (< FILE
>) { $filtersettings { 'CUSTOM_BLACK_URLS' } .= $_ };
2466 if (- e
" $dbdir /custom/blocked/expressions" ) {
2467 open ( FILE
, " $dbdir /custom/blocked/expressions" );
2468 delete $filtersettings { 'CUSTOM_EXPRESSIONS' };
2469 while (< FILE
>) { $filtersettings { 'CUSTOM_EXPRESSIONS' } .= $_ };
2473 if (- e
" $dbdir /custom/allowed/domains" ) {
2474 open ( FILE
, " $dbdir /custom/allowed/domains" );
2475 delete $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2476 while (< FILE
>) { $filtersettings { 'CUSTOM_WHITE_DOMAINS' } .= $_ };
2479 if (- e
" $dbdir /custom/allowed/urls" ) {
2480 open ( FILE
, " $dbdir /custom/allowed/urls" );
2481 delete $filtersettings { 'CUSTOM_WHITE_URLS' };
2482 while (< FILE
>) { $filtersettings { 'CUSTOM_WHITE_URLS' } .= $_ };
2487 # -------------------------------------------------------------------
2489 sub aggregatedconstraints
2509 @tmp1 = split ( /\,/ , $x );
2513 @tmp2 = split ( /\,/ );
2514 if ( $tmp2 [ 15 ] eq 'on' )
2516 if (( $tmp1 [ 0 ] eq $tmp2 [ 0 ]) && ( $tmp1 [ 12 ] eq $tmp2 [ 12 ]) && ( $tmp1 [ 13 ] eq $tmp2 [ 13 ]) && ( $tmp1 [ 14 ] eq $tmp2 [ 14 ]))
2519 $tmp2 [ 16 ] .= " weekly " ;
2520 if ( $tmp1 [ 1 ] eq 'on' ) { $tmp2 [ 16 ] .= "m" ; }
2521 if ( $tmp1 [ 2 ] eq 'on' ) { $tmp2 [ 16 ] .= "t" ; }
2522 if ( $tmp1 [ 3 ] eq 'on' ) { $tmp2 [ 16 ] .= "w" ; }
2523 if ( $tmp1 [ 4 ] eq 'on' ) { $tmp2 [ 16 ] .= "h" ; }
2524 if ( $tmp1 [ 5 ] eq 'on' ) { $tmp2 [ 16 ] .= "f" ; }
2525 if ( $tmp1 [ 6 ] eq 'on' ) { $tmp2 [ 16 ] .= "a" ; }
2526 if ( $tmp1 [ 7 ] eq 'on' ) { $tmp2 [ 16 ] .= "s" ; }
2527 $tmp2 [ 16 ] .= " $tmp1 [8]: $tmp1 [9]- $tmp1 [10]: $tmp1 [11] \n " ;
2528 $_ = join ( "," , @tmp2 );
2535 $tmp1 [ 16 ] .= " weekly " ;
2536 if ( $tmp1 [ 1 ] eq 'on' ) { $tmp1 [ 16 ] .= "m" ; }
2537 if ( $tmp1 [ 2 ] eq 'on' ) { $tmp1 [ 16 ] .= "t" ; }
2538 if ( $tmp1 [ 3 ] eq 'on' ) { $tmp1 [ 16 ] .= "w" ; }
2539 if ( $tmp1 [ 4 ] eq 'on' ) { $tmp1 [ 16 ] .= "h" ; }
2540 if ( $tmp1 [ 5 ] eq 'on' ) { $tmp1 [ 16 ] .= "f" ; }
2541 if ( $tmp1 [ 6 ] eq 'on' ) { $tmp1 [ 16 ] .= "a" ; }
2542 if ( $tmp1 [ 7 ] eq 'on' ) { $tmp1 [ 16 ] .= "s" ; }
2543 $tmp1 [ 16 ] .= " $tmp1 [8]: $tmp1 [9]- $tmp1 [10]: $tmp1 [11] \n " ;
2544 $x = join ( "," , @tmp1 );
2554 # -------------------------------------------------------------------
2558 my $executables = " \\ .\(ade|adp|asx|bas|bat|chm|com|cmd|cpl|crt|dll|eml|exe|hiv|hlp|hta|inc|inf|ins|isp|jse|jtd|lnk|msc|msh|msi|msp|mst|nws|ocx|oft|ops|pcd|pif|plx|reg|scr|sct|sha|shb|shm|shs|sys|tlb|tsp|url|vbe|vbs|vxd|wsc|wsf|wsh\)\$" ;
2559 my $audiovideo = " \\ .\(aiff|asf|avi|dif|divx|mov|movie|mp3|mpe?g?|mpv2|ogg|ra?m|snd|qt|wav|wmf|wmv\)\$" ;
2560 my $archives = " \\ .\(bin|bz2|cab|cdr|dmg|gz|hqx|rar|smi|sit|sea|tar|tgz|zip\)\$" ;
2562 my $ident = " anonymous" ;
2575 if (!(- d
" $dbdir /custom" )) { mkdir ( " $dbdir /custom" ) }
2576 if (!(- d
" $dbdir /custom/blocked" )) { mkdir ( " $dbdir /custom/blocked" ) }
2577 if (!(- d
" $dbdir /custom/allowed" )) { mkdir ( " $dbdir /custom/allowed" ) }
2579 open ( FILE
, ">/ $dbdir /custom/blocked/domains" );
2580 print FILE
$filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2582 open ( FILE
, ">/ $dbdir /custom/blocked/urls" );
2583 print FILE
$filtersettings { 'CUSTOM_BLACK_URLS' };
2585 open ( FILE
, ">/ $dbdir /custom/blocked/expressions" );
2586 print FILE
$filtersettings { 'CUSTOM_EXPRESSIONS' };
2588 open ( FILE
, ">/ $dbdir /custom/blocked/files" );
2589 if ( $filtersettings { 'BLOCK_EXECUTABLES' } eq 'on' ) { print FILE
" $executables \n " ; }
2590 if ( $filtersettings { 'BLOCK_AUDIO-VIDEO' } eq 'on' ) { print FILE
" $audiovideo \n " ; }
2591 if ( $filtersettings { 'BLOCK_ARCHIVES' } eq 'on' ) { print FILE
" $archives \n " ; }
2593 open ( FILE
, ">/ $dbdir /custom/allowed/domains" );
2594 print FILE
$filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2596 open ( FILE
, ">/ $dbdir /custom/allowed/urls" );
2597 print FILE
$filtersettings { 'CUSTOM_WHITE_URLS' };
2600 if ( $filtersettings { 'ENABLE_USERNAME_LOG' } eq 'on' ) { $ident = "" ; }
2602 if ( $filtersettings { 'REDIRECT_PAGE' } eq '' )
2604 if (( $filtersettings { 'SHOW_CATEGORY' } eq 'on' ) || ( $filtersettings { 'SHOW_URL' } eq 'on' ) || ( $filtersettings { 'SHOW_IP' } eq 'on' )) {
2605 if ( $filtersettings { 'SHOW_CATEGORY' } eq 'on' ) { $redirect .= "&category= %t " ; }
2606 if ( $filtersettings { 'SHOW_URL' } eq 'on' ) { $redirect .= "&url= %u " ; }
2607 if ( $filtersettings { 'SHOW_IP' } eq 'on' ) { $redirect .= "&ip= %a " ; }
2608 $redirect =~ s/^&/?/ ;
2609 $redirect = "http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/redirect.cgi" . $redirect ;
2611 $redirect = "http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/redirect.cgi" ;
2613 } else { $redirect = $filtersettings { 'REDIRECT_PAGE' }; }
2615 if ( $filtersettings { 'ENABLE_DNSERROR' } eq 'on' ) { $redirect = "302:http://0.0.0.0" ; }
2619 if ( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' )
2621 $defaultrule .= "custom-allowed " ;
2623 if ( $filtersettings { 'BLOCK_ALL' } eq 'on' )
2625 $defaultrule .= "none" ;
2629 if ( $filtersettings { 'BLOCK_IP_ADDR' } eq 'on' )
2631 $defaultrule .= "!in-addr " ;
2633 for ( $i = 0 ; $i <= @filtergroups ; $i ++) {
2634 if ( $filtersettings { @filtergroups [ $i ]} eq 'on' )
2636 $defaultrule .= "! @categories [ $i ] " ;
2639 if ( $filtersettings { 'ENABLE_CUSTOM_BLACKLIST' } eq 'on' )
2641 $defaultrule .= "!custom-blocked " ;
2643 if ( $filtersettings { 'ENABLE_CUSTOM_EXPRESSIONS' } eq 'on' )
2645 $defaultrule .= "!custom-expressions " ;
2647 if (( $filtersettings { 'BLOCK_EXECUTABLES' } eq 'on' ) ||
2648 ( $filtersettings { 'BLOCK_AUDIO-VIDEO' } eq 'on' ) ||
2649 ( $filtersettings { 'BLOCK_ARCHIVES' } eq 'on' ))
2651 $defaultrule .= "!files " ;
2653 $defaultrule .= "any" ;
2656 open ( FILE
, ">${General::swroot}/urlfilter/squidGuard.conf" ) or die "Unable to write squidGuard.conf file" ;
2659 print FILE
"logdir /var/log/squidGuard \n " ;
2660 print FILE
"dbhome $dbdir \n\n " ;
2662 undef @repositoryfiles ;
2663 if ( $filtersettings { 'ENABLE_REWRITE' } eq 'on' )
2665 @repositorylist = < $repository /*>;
2666 foreach ( @repositorylist )
2668 if (!- d
) { push ( @repositoryfiles , substr ( $_ , rindex ( $_ , "/" )+ 1 )); }
2672 if ((( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles )) || ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' ))
2674 print FILE
"rewrite rew-rule-0 { \n " ;
2676 if (( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles ))
2678 print FILE
" # rewrite localfiles \n " ;
2679 foreach ( @repositoryfiles )
2681 print FILE
" s@.*/ $_ \$\ @http :// $netsettings {'GREEN_ADDRESS'}:81/repository/ $_ \ @i \n " ;
2685 if ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )
2687 print FILE
" # rewrite safesearch \n " ;
2688 print FILE
" s@(.* \\ Wgoogle \\ . \\ w+/(webhp|search|imghp|images|grphp|groups|frghp|froogle) \\ ?)(.*)( \\ bsafe= \\ w+)(.*)\@ \\ 1 \\ 3safe=strict \\ 5\ @i \n " ;
2689 print FILE
" s@(.* \\ Wgoogle \\ . \\ w+/(webhp|search|imghp|images|grphp|groups|frghp|froogle) \\ ?)(.*)\@ \\ 1safe=strict \\ \& \\ 3\ @i \n " ;
2690 print FILE
" s@(.* \\ Wsearch \\ .yahoo \\ . \\ w+/search \\ W)(.*)( \\ bvm= \\ w+)(.*)\@ \\ 1 \\ 2vm=r \\ 4\ @i \n " ;
2691 print FILE
" s@(.* \\ Wsearch \\ .yahoo \\ . \\ w+/search \\ W.*)\@ \\ 1 \\ \&vm=r\ @i \n " ;
2692 print FILE
" s@(.* \\ Walltheweb \\ .com/customize \\ ?)(.*)( \\ bcopt_offensive= \\ w+)(.*)\@ \\ 1 \\ 2copt_offensive=on \\ 4\ @i \n " ;
2697 if ((!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) && ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )) {
2698 print FILE
"rewrite rew-rule-1 { \n " ;
2699 if (( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles ))
2701 print FILE
" # rewrite localfiles \n " ;
2702 foreach ( @repositoryfiles )
2704 print FILE
" s@.*/ $_ \$\ @http :// $netsettings {'GREEN_ADDRESS'}:81/repository/ $_ \ @i \n " ;
2707 print FILE
" # rewrite nothing \n " ;
2729 $uq [ 0 ] = $uq [ 0 ] * 60 ;
2730 if ( $uq [ 1 ] eq '0' ) {
2731 if ( $uq [ 2 ] eq 'hourly' ) { $uq [ 1 ] = 3600 }
2732 if ( $uq [ 2 ] eq 'daily' ) { $uq [ 1 ] = 86400 }
2733 if ( $uq [ 2 ] eq 'weekly' ) { $uq [ 1 ] = 604800 }
2736 print FILE
"src quota- $idx { \n " ;
2737 print FILE
" user $uq [3] \n " ;
2738 print FILE
" userquota $uq [0] $uq [1] $uq [2] \n " ;
2746 @tclist = & aggregatedconstraints
;
2755 if ( $tc [ 15 ] eq 'on' )
2758 print FILE
"src network- $idx { \n " ;
2759 print FILE
" ip $tc [12] \n " ;
2769 if ( $tc [ 15 ] eq 'on' )
2772 print FILE
"time constraint- $idx { \n " ;
2773 print FILE
" $tc [16] \n " ;
2779 if (!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) {
2780 print FILE
"src unfiltered { \n " ;
2781 print FILE
" ip $filtersettings {'UNFILTERED_CLIENTS'} \n " ;
2784 if (!( $filtersettings { 'BANNED_CLIENTS' } eq '' )) {
2785 print FILE
"src banned { \n " ;
2786 print FILE
" ip $filtersettings {'BANNED_CLIENTS'} \n " ;
2790 foreach $category ( @categories ) {
2791 print FILE
"dest $category { \n " ;
2792 if (- e
" $dbdir / $category /domains" ) {
2793 print FILE
" domainlist $category \/domains \n " ;
2795 if (- e
" $dbdir / $category /urls" ) {
2796 print FILE
" urllist $category \/urls \n " ;
2798 if ((- e
" $dbdir / $category /expressions" ) && ( $filtersettings { 'ENABLE_EXPR_LISTS' } eq 'on' )) {
2799 print FILE
" expressionlist $category \/expressions \n " ;
2801 if (( $category eq 'ads' ) && ( $filtersettings { 'ENABLE_EMPTY_ADS' } eq 'on' ))
2803 print FILE
" redirect http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/images/urlfilter/1x1.gif \n " ;
2805 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2807 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2809 print FILE
" logfile $ident $category .log \n " ;
2811 print FILE
" logfile $ident urlfilter.log \n " ;
2817 print FILE
"dest files { \n " ;
2818 print FILE
" expressionlist custom\/blocked\/files \n " ;
2819 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2821 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2823 print FILE
" logfile $ident files.log \n " ;
2825 print FILE
" logfile $ident urlfilter.log \n " ;
2830 print FILE
"dest custom-allowed { \n " ;
2831 print FILE
" domainlist custom\/allowed\/domains \n " ;
2832 print FILE
" urllist custom\/allowed\/urls \n " ;
2835 print FILE
"dest custom-blocked { \n " ;
2836 print FILE
" domainlist custom\/blocked\/domains \n " ;
2837 print FILE
" urllist custom\/blocked\/urls \n " ;
2838 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2840 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2842 print FILE
" logfile $ident custom.log \n " ;
2844 print FILE
" logfile $ident urlfilter.log \n " ;
2849 print FILE
"dest custom-expressions { \n " ;
2850 print FILE
" expressionlist custom\/blocked\/expressions \n " ;
2851 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2853 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2855 print FILE
" logfile $ident custom.log \n " ;
2857 print FILE
" logfile $ident urlfilter.log \n " ;
2862 print FILE
"acl { \n " ;
2863 if (!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) {
2864 print FILE
" unfiltered { \n " ;
2865 print FILE
" pass all \n " ;
2866 if ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )
2868 print FILE
" rewrite rew-rule-1 \n " ;
2870 print FILE
" } \n\n " ;
2872 if (!( $filtersettings { 'BANNED_CLIENTS' } eq '' )) {
2873 print FILE
" banned { \n " ;
2874 print FILE
" pass " ;
2875 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2877 print FILE
"custom-allowed " ;
2879 print FILE
"none \n " ;
2880 print FILE
" } \n\n " ;
2897 $qredirect = $redirect ;
2898 $qredirect =~ s/\%t/\%q\%20-\%20\%i/ ;
2899 print FILE
" quota- $idx { \n " ;
2900 print FILE
" pass " ;
2901 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2903 print FILE
"custom-allowed " ;
2905 print FILE
"none \n " ;
2906 unless ( $redirect eq $qredirect ) { print FILE
" redirect $qredirect \n " ; }
2907 print FILE
" } \n\n " ;
2919 @ec = split ( /\|/ , $tc [ 13 ]);
2920 if ( $tc [ 15 ] eq 'on' )
2923 print FILE
" network- $idx $tc [0] constraint- $idx { \n " ;
2924 print FILE
" pass " ;
2926 if ( $filtersettings { 'BLOCK_ALL' } eq 'on' )
2928 if ( $tc [ 14 ] eq 'block' )
2930 if (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' )) {
2931 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2933 print FILE
"custom-allowed " ;
2937 print FILE
$defaultrule ;
2944 print FILE
$defaultrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2947 if ( $tc [ 14 ] eq 'block' )
2949 $tcrule = $defaultrule ;
2950 if ( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) {
2951 $tcrule =~ s/custom-allowed // ;
2952 print FILE
"custom-allowed " unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'off' ));
2954 if (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' )) {
2959 print FILE
"! $_ " unless ( index ( $defaultrule , "!" . $_ . " " ) ge 0 );
2962 print FILE
$tcrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2964 $tcrule = $defaultrule ;
2967 $tcrule =~ s/!$_ // ;
2968 print FILE
" $_ " if ( $_ eq 'any' );
2970 print FILE
$tcrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2976 print FILE
" } \n\n " ;
2981 print FILE
" default { \n " ;
2982 print FILE
" pass $defaultrule \n " ;
2983 if (( $filtersettings { 'ENABLE_LOG' } eq 'on' ) && ( $filtersettings { 'BLOCK_ALL' } eq 'on' ))
2985 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2987 print FILE
" logfile" . $ident . " default.log \n " ;
2989 print FILE
" logfile" . $ident . " urlfilter.log \n " ;
2992 if ((( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles )) || ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' ))
2994 print FILE
" rewrite rew-rule-0 \n " ;
2996 print FILE
" redirect $redirect \n " ;
3003 # -------------------------------------------------------------------