]>
git.ipfire.org Git - people/pmueller/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 blacklist' }) ||
151 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter backup' }) ||
152 ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restore' }))
154 if (!( $filtersettings { 'CHILDREN' } =~ /^\d+$/ ) || ( $filtersettings { 'CHILDREN' } < 1 ))
156 $errormessage = $Lang :: tr
{ 'urlfilter invalid num of children' };
160 if ((!( $filtersettings { 'REDIRECT_PAGE' } eq '' )) && (!( $filtersettings { 'REDIRECT_PAGE' } =~ /^https?:\/ \
// )))
162 $filtersettings { 'REDIRECT_PAGE' } = "http://" . $filtersettings { 'REDIRECT_PAGE' };
165 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter remove file' })
167 if (- e
" $repository / $filtersettings {'ID'}" ) { unlink ( " $repository / $filtersettings {'ID'}" ); }
168 $filtersettings { 'ACTION' } = $Lang :: tr
{ 'urlfilter manage repository' };
171 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload file' })
173 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPLOADFILE' });
175 $filtersettings { 'ACTION' } = $Lang :: tr
{ 'urlfilter manage repository' };
176 $_ = $filtersettings { 'UPLOADFILE' };
178 $_ = substr ( $_ , rindex ( $_ , "/" )+ 1 );
180 if ( copy
( $filtersettings { 'UPLOADFILE' }, " $repository / $_ " ) != 1 )
189 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter upload blacklist' })
191 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPDATEFILE' });
193 if (!( $filtersettings { 'UPDATEFILE' } =~ /.tar.gz$/ ))
195 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
199 if ( copy
( $filtersettings { 'UPDATEFILE' }, "${General::swroot}/urlfilter/blacklists.tar.gz" ) != 1 )
205 if (!(- d
"${General::swroot}/urlfilter/update" )) { mkdir ( "${General::swroot}/urlfilter/update" ); }
207 my $exitcode = system ( "/bin/tar --no-same-owner -xzf ${General::swroot}/urlfilter/blacklists.tar.gz -C ${General::swroot}/urlfilter/update" );
211 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
214 if (- d
"${General::swroot}/urlfilter/update/category" )
216 system ( "mv ${General::swroot}/urlfilter/update/category ${General::swroot}/urlfilter/update/blacklists" );
219 if (!(- d
"${General::swroot}/urlfilter/update/blacklists" ))
221 $errormessage = $Lang :: tr
{ 'urlfilter invalid content' };
223 system ( "cp -r ${General::swroot}/urlfilter/update/blacklists/* $dbdir " );
225 & readblockcategories
;
230 $updatemessage = $Lang :: tr
{ 'urlfilter upload success' };
231 system ( "${General::swroot}/urlfilter/bin/prebuild.pl &" );
232 system ( "logger -t installpackage[urlfilter] \" URL filter blacklist - Blacklist update from local source completed \" " );
235 if (- d
"${General::swroot}/urlfilter/update" ) { system ( "rm -rf ${General::swroot}/urlfilter/update" ); }
236 if (- e
"${General::swroot}/urlfilter/blacklists.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/blacklists.tar.gz" ); }
237 if ( $errormessage ) { goto ERROR
; }
240 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter backup' })
242 $blistbackup = ( $filtersettings { 'ENABLE_FULLBACKUP' } eq 'on' ) ?
"blacklists" : "blacklists/custom" ;
243 if ( system ( "/bin/tar -C ${General::swroot}/urlfilter -czf ${General::swroot}/urlfilter/backup.tar.gz settings timeconst userquota autoupdate $blistbackup " ))
245 $errormessage = $Lang :: tr
{ 'urlfilter backup error' };
250 print "Content-type: application/gzip \n " ;
251 print "Content-length: " ;
252 print (- s
"${General::swroot}/urlfilter/backup.tar.gz" );
254 print "Content-disposition: attachment; filename=urlfilter-backup.tar.gz \n\n " ;
256 open ( FILE
, "${General::swroot}/urlfilter/backup.tar.gz" );
257 while (< FILE
>) { print ; }
260 if (- e
"${General::swroot}/urlfilter/backup.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/backup.tar.gz" ); }
265 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restore' })
267 & Header
:: getcgihash
( \
%filtersettings , { 'wantfile' => 1 , 'filevar' => 'UPDATEFILE' });
269 if (!( $filtersettings { 'UPDATEFILE' } =~ /.tar.gz$/ ))
271 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
275 if (!(- d
"${General::swroot}/urlfilter/restore" )) { mkdir ( "${General::swroot}/urlfilter/restore" ); }
277 if ( copy
( $filtersettings { 'UPDATEFILE' }, "${General::swroot}/urlfilter/backup.tar.gz" ) != 1 )
282 my $exitcode = system ( "/bin/tar --no-same-owner --preserve-permissions -xzf ${General::swroot}/urlfilter/backup.tar.gz -C ${General::swroot}/urlfilter/restore" );
285 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
287 if (!(- e
"${General::swroot}/urlfilter/restore/settings" ))
289 $errormessage = $Lang :: tr
{ 'urlfilter invalid restore file' };
291 system ( "cp -rp ${General::swroot}/urlfilter/restore/* ${General::swroot}/urlfilter/" );
292 & readblockcategories
;
296 $restoremessage = $Lang :: tr
{ 'urlfilter restore success' };
300 if (- e
"${General::swroot}/urlfilter/backup.tar.gz" ) { unlink ( "${General::swroot}/urlfilter/backup.tar.gz" ); }
301 if (- d
"${General::swroot}/urlfilter/restore" ) { system ( "rm -rf ${General::swroot}/urlfilter/restore" ); }
302 if ( $errormessage ) { goto ERROR
; }
305 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
307 $filtersettings { 'VALID' } = 'yes' ;
311 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter save and restart' })
313 if (!(- e
"${General::swroot}/proxy/enable" ))
315 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
318 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
320 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
324 $filtersettings { 'VALID' } = 'yes' ;
327 system ( "chown -R nobody.nobody $dbdir " );
329 if (- e
" $dbdir /custom/allowed/domains.db" ) { unlink ( " $dbdir /custom/allowed/domains.db" ); }
330 if (- e
" $dbdir /custom/allowed/urls.db" ) { unlink ( " $dbdir /custom/allowed/urls.db" ); }
331 if (- e
" $dbdir /custom/blocked/domains.db" ) { unlink ( " $dbdir /custom/blocked/domains.db" ); }
332 if (- e
" $dbdir /custom/blocked/urls.db" ) { unlink ( " $dbdir /custom/blocked/urls.db" ); }
336 if (- d
$_ ){ system ( "chmod 644 $_ /*" ); }
337 if (- d
$_ ){ system ( "chmod 666 $_ /*.db" ); }
339 if (- d
" $dbdir /custom/allowed" )
341 system ( "chmod 755 $dbdir /custom/allowed" );
342 system ( "chmod 644 $dbdir /custom/allowed/*" );
344 if (- d
" $dbdir /custom/blocked" )
346 system ( "chmod 755 $dbdir /custom/blocked" );
347 system ( "chmod 644 $dbdir /custom/blocked/*" );
350 system ( '/usr/local/bin/restartsquid' );
355 if ( $errormessage ) { $filtersettings { 'VALID' } = 'no' ; }
359 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter set time constraints' }) { $tcsettings { 'TCMODE' } = 'on' }
361 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'add' }))
363 $tcsettings { 'TCMODE' }= 'on' ;
365 if (! $tcsettings { 'DST' })
367 $errormessage = $Lang :: tr
{ 'urlfilter dst error' };
370 if (! $tcsettings { 'SRC' })
372 $errormessage = $Lang :: tr
{ 'urlfilter src error' };
375 if (!( $tcsettings { 'TO_HOUR' }. $tcsettings { 'TO_MINUTE' } gt $tcsettings { 'FROM_HOUR' }. $tcsettings { 'FROM_MINUTE' }))
377 $errormessage = $Lang :: tr
{ 'urlfilter timespace error' };
380 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' )))
382 $errormessage = $Lang :: tr
{ 'urlfilter weekday error' };
387 if ( $tcsettings { 'DST' } =~ /^any/ ) { $tcsettings { 'DST' } = 'any' ; }
388 if ( $tcsettings { 'ENABLERULE' } eq 'on' ) { $tcsettings { 'ACTIVE' } = $tcsettings { 'ENABLERULE' }; } else { $tcsettings { 'ACTIVE' } = 'off' }
390 $tcsettings { 'ENABLERULE' } = 'on' ;
391 if ( $tcsettings { 'EDITING' } eq 'no' ) {
392 open ( FILE
, ">> $tcfile " );
394 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 " ;
396 open ( FILE
, "> $tcfile " );
399 foreach $line ( @tclist )
402 if ( $tcsettings { 'EDITING' } eq $id ) {
403 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 " ;
404 } else { print FILE
" $line " ; }
409 $tcsettings { 'CHANGED' }= 'yes' ;
410 $tcsettings { 'TCMODE' }= 'on' ;
413 if ( $tcsettings { 'EDITING' } ne 'no' )
415 $tcsettings { 'ACTION' } = $Lang :: tr
{ 'edit' };
416 $tcsettings { 'ID' } = $tcsettings { 'EDITING' };
421 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'remove' }))
424 open ( FILE
, "> $tcfile " );
426 foreach $line ( @tclist )
429 unless ( $tcsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
432 $tcsettings { 'CHANGED' }= 'yes' ;
433 $tcsettings { 'TCMODE' }= 'on' ;
436 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restart' }))
438 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
440 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
442 if (!(- e
"${General::swroot}/proxy/enable" ))
444 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
447 if (! $errormessage ) { system ( '/usr/local/bin/restartsquid' ); }
448 $tcsettings { 'TCMODE' }= 'on' ;
451 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'toggle enable disable' }))
453 open ( FILE
, "> $tcfile " );
456 foreach $line ( @tclist )
459 unless ( $tcsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
463 @temp = split ( /\,/ , $line );
464 if ( $temp [ 15 ] eq 'on' ) { $temp [ 15 ] = 'off' ; } else { $temp [ 15 ] = 'on' }
465 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 " ;
469 $tcsettings { 'CHANGED' }= 'yes' ;
470 $tcsettings { 'TCMODE' }= 'on' ;
473 if (! $errormessage ) {
474 $tcsettings { 'ENABLERULE' }= 'on' ;
475 $tcsettings { 'TO_HOUR' }= '24' ;
478 if (( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) && ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) && (! $errormessage ))
481 foreach $line ( @tclist )
484 if ( $tcsettings { 'ID' } eq $id )
487 @temp = split ( /\,/ , $line );
488 $tcsettings { 'DEFINITION' } = $temp [ 0 ];
489 $tcsettings { 'MON' } = $temp [ 1 ];
490 $tcsettings { 'TUE' } = $temp [ 2 ];
491 $tcsettings { 'WED' } = $temp [ 3 ];
492 $tcsettings { 'THU' } = $temp [ 4 ];
493 $tcsettings { 'FRI' } = $temp [ 5 ];
494 $tcsettings { 'SAT' } = $temp [ 6 ];
495 $tcsettings { 'SUN' } = $temp [ 7 ];
496 $tcsettings { 'FROM_HOUR' } = $temp [ 8 ];
497 $tcsettings { 'FROM_MINUTE' } = $temp [ 9 ];
498 $tcsettings { 'TO_HOUR' } = $temp [ 10 ];
499 $tcsettings { 'TO_MINUTE' } = $temp [ 11 ];
500 $tcsettings { 'SRC' } = $temp [ 12 ];
501 $tcsettings { 'DST' } = $temp [ 13 ];
502 $tcsettings { 'ACCESS' } = $temp [ 14 ];
503 $tcsettings { 'ENABLERULE' } = $temp [ 15 ];
504 $tcsettings { 'COMMENT' } = $temp [ 16 ];
507 $tcsettings { 'TCMODE' }= 'on' ;
510 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter set user quota' }) { $uqsettings { 'UQMODE' } = 'on' }
512 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'add' }))
514 $uqsettings { 'UQMODE' }= 'on' ;
516 if ((!( $uqsettings { 'TIME_QUOTA' } =~ /^\d+/ )) || ( $uqsettings { 'TIME_QUOTA' } < '1' ))
518 $errormessage = $Lang :: tr
{ 'urlfilter quota time error' };
521 @temp = split ( /\n/ , $uqsettings { 'QUOTA_USERS' });
522 undef $uqsettings { 'QUOTA_USERS' };
525 s/^\s+//g ; s/\s+$//g ;
526 if ( $_ ) { $uqsettings { 'QUOTA_USERS' } .= $_ . " \n " ; }
529 if ( $uqsettings { 'QUOTA_USERS' } eq '' )
531 $errormessage = $Lang :: tr
{ 'urlfilter quota user error' };
534 $_ = $uqsettings { 'QUOTA_USERS' };
536 my $quota_users = $_ ;
538 if ( $uqsettings { 'QUOTA_USERS' } =~ /\\/ )
540 $errormessage = $Lang :: tr
{ 'urlfilter invalid user error' };
543 if (! $errormessage ) {
544 if ( $uqsettings { 'ENABLEQUOTA' } eq 'on' ) { $uqsettings { 'ACTIVE' } = $uqsettings { 'ENABLEQUOTA' }; } else { $uqsettings { 'ACTIVE' } = 'off' }
546 $uqsettings { 'ENABLERULE' } = 'on' ;
547 if ( $uqsettings { 'EDITING' } eq 'no' ) {
548 open ( FILE
, ">> $uqfile " );
550 print FILE
" $uqsettings {'TIME_QUOTA'}, $uqsettings {'SPORADIC'}, $uqsettings {'RENEWAL'}, $quota_users , $uqsettings {'ACTIVE'} \n " ;
552 open ( FILE
, "> $uqfile " );
555 foreach $line ( @uqlist )
558 if ( $uqsettings { 'EDITING' } eq $id ) {
559 print FILE
" $uqsettings {'TIME_QUOTA'}, $uqsettings {'SPORADIC'}, $uqsettings {'RENEWAL'}, $quota_users , $uqsettings {'ACTIVE'} \n " ;
560 } else { print FILE
" $line " ; }
565 $uqsettings { 'CHANGED' }= 'yes' ;
566 $uqsettings { 'MODE' }= 'USERQUOTA' ;
567 $uqsettings { 'UQMODE' }= 'on' ;
570 if ( $uqsettings { 'EDITING' } ne 'no' )
572 $uqsettings { 'ACTION' } = $Lang :: tr
{ 'edit' };
573 $uqsettings { 'ID' } = $uqsettings { 'EDITING' };
578 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'remove' }))
581 open ( FILE
, "> $uqfile " );
583 foreach $line ( @uqlist )
586 unless ( $uqsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
589 $uqsettings { 'CHANGED' }= 'yes' ;
590 $uqsettings { 'UQMODE' }= 'on' ;
593 if (! $errormessage ) {
594 $uqsettings { 'ENABLEQUOTA' }= 'on' ;
597 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) && (! $errormessage ))
600 foreach $line ( @uqlist )
603 if ( $uqsettings { 'ID' } eq $id )
606 @temp = split ( /\,/ , $line );
607 $uqsettings { 'TIME_QUOTA' } = $temp [ 0 ];
608 $uqsettings { 'SPORADIC' } = $temp [ 1 ];
609 $uqsettings { 'RENEWAL' } = $temp [ 2 ];
610 $uqsettings { 'QUOTA_USERS' } = $temp [ 3 ];
611 $uqsettings { 'ENABLEQUOTA' } = $temp [ 4 ];
614 $uqsettings { 'UQMODE' }= 'on' ;
617 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'toggle enable disable' }))
619 open ( FILE
, "> $uqfile " );
622 foreach $line ( @uqlist )
625 unless ( $uqsettings { 'ID' } eq $id ) { print FILE
" $line " ; }
629 @temp = split ( /\,/ , $line );
630 if ( $temp [ 4 ] eq 'on' ) { $temp [ 4 ] = 'off' ; } else { $temp [ 4 ] = 'on' }
631 print FILE
" $temp [0], $temp [1], $temp [2], $temp [3], $temp [4] \n " ;
635 $uqsettings { 'CHANGED' }= 'yes' ;
636 $uqsettings { 'UQMODE' }= 'on' ;
639 if (( $uqsettings { 'MODE' } eq 'USERQUOTA' ) && ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter restart' }))
641 if (!( $proxysettings { 'ENABLE_FILTER' } eq 'on' ))
643 $errormessage = $Lang :: tr
{ 'urlfilter not enabled' };
645 if (!(- e
"${General::swroot}/proxy/enable" ))
647 $errormessage = $Lang :: tr
{ 'urlfilter web proxy service required' };
650 if (! $errormessage ) { system ( '/usr/local/bin/restartsquid' ); }
651 $uqsettings { 'UQMODE' }= 'on' ;
654 if ( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter blacklist editor' }) { $besettings { 'BEMODE' } = 'on' ; }
656 if ( $besettings { 'MODE' } eq 'BLACKLIST_EDITOR' )
658 @temp = split ( /\n/ , $besettings { 'BE_DOMAINS' });
659 undef $besettings { 'BE_DOMAINS' };
662 s/^\s+//g ; s/\s+$//g ;
663 if ( $_ ) { $besettings { 'BE_DOMAINS' } .= $_ . " \n " ; }
665 chomp ( $besettings { 'BE_DOMAINS' });
666 @temp = split ( /\n/ , $besettings { 'BE_URLS' });
667 undef $besettings { 'BE_URLS' };
670 s/^\s+//g ; s/\s+$//g ;
671 if ( $_ ) { $besettings { 'BE_URLS' } .= $_ . " \n " ; }
673 chomp ( $besettings { 'BE_URLS' });
674 @temp = split ( /\n/ , $besettings { 'BE_EXPRESSIONS' });
675 undef $besettings { 'BE_EXPRESSIONS' };
678 s/^\s+//g ; s/\s+$//g ;
679 if ( $_ ) { $besettings { 'BE_EXPRESSIONS' } .= $_ . " \n " ; }
681 chomp ( $besettings { 'BE_EXPRESSIONS' });
684 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter load blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
686 $besettings { 'BEMODE' } = 'on' ;
688 $besettings { 'BE_NAME' } = $besettings { 'BE_BLACKLIST' };
690 delete $besettings { 'BE_DOMAINS' };
691 delete $besettings { 'BE_URLS' };
692 delete $besettings { 'BE_EXPRESSIONS' };
694 if (- e
" $dbdir / $besettings {'BE_NAME'}/domains" )
696 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/domains" );
697 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_DOMAINS' } .= $_ } };
699 chomp ( $besettings { 'BE_DOMAINS' });
701 if (- e
" $dbdir / $besettings {'BE_NAME'}/urls" )
703 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/urls" );
704 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_URLS' } .= $_ } };
706 chomp ( $besettings { 'BE_URLS' });
708 if (- e
" $dbdir / $besettings {'BE_NAME'}/expressions" )
710 open ( FILE
, " $dbdir / $besettings {'BE_NAME'}/expressions" );
711 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_EXPRESSIONS' } .= $_ } };
713 chomp ( $besettings { 'BE_EXPRESSIONS' });
717 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter import blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
719 $besettings { 'BEMODE' } = 'on' ;
721 & Header
:: getcgihash
( \
%besettings , { 'wantfile' => 1 , 'filevar' => 'IMPORTFILE' });
723 if (!( $besettings { 'IMPORTFILE' } =~ /.tar.gz$/ ))
725 $errormessage = $Lang :: tr
{ 'urlfilter wrong filetype' };
727 if (!- d
" $editdir " ) { mkdir ( " $editdir " ); }
729 if ( copy
( $besettings { 'IMPORTFILE' }, " $editdir /blacklist.tar.gz" ) != 1 )
734 my $exitcode = system ( "/bin/tar --no-same-owner --preserve-permissions -xzf $editdir /blacklist.tar.gz -C $editdir " );
737 $errormessage = $Lang :: tr
{ 'urlfilter tar error' };
740 foreach (< $editdir /blacklists/ *>)
745 $besettings { 'BE_NAME' } = substr ( $_ , rindex ( $_ , "/" )+ 1 );
751 $errormessage = $Lang :: tr
{ 'urlfilter invalid import file' };
753 delete $besettings { 'BE_DOMAINS' };
754 delete $besettings { 'BE_URLS' };
755 delete $besettings { 'BE_EXPRESSIONS' };
757 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/domains" )
759 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/domains" );
760 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_DOMAINS' } .= $_ } };
762 chomp ( $besettings { 'BE_DOMAINS' });
764 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/urls" )
766 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/urls" );
767 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_URLS' } .= $_ } };
769 chomp ( $besettings { 'BE_URLS' });
771 if (- e
" $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" )
773 open ( FILE
, " $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" );
774 while (< FILE
>) { unless ( $_ eq ' \n ' ) { $besettings { 'BE_EXPRESSIONS' } .= $_ } };
776 chomp ( $besettings { 'BE_EXPRESSIONS' });
781 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
787 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter export blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
789 $besettings { 'BEMODE' } = 'on' ;
791 if ( $besettings { 'BE_NAME' } eq '' )
793 $errormessage = $Lang :: tr
{ 'urlfilter category name error' };
794 } elsif ( $besettings { 'BE_DOMAINS' } || $besettings { 'BE_URLS' } || $besettings { 'BE_EXPRESSIONS' }) {
796 $_ = $besettings { 'BE_NAME' }; tr/A-Z/a-z/ ; $besettings { 'BE_NAME' } = $_ ;
798 if (!(- d
" $editdir " )) { mkdir ( " $editdir " ); }
799 if (!(- d
" $editdir /blacklists" )) { mkdir ( " $editdir /blacklists" ); }
800 if (!(- d
" $editdir /blacklists/ $besettings {'BE_NAME'}" )) { mkdir ( " $editdir /blacklists/ $besettings {'BE_NAME'}" ); }
802 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/domains" );
804 print FILE
" $besettings {'BE_DOMAINS'} \n " ;
806 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/urls" );
808 print FILE
" $besettings {'BE_URLS'} \n " ;
810 open ( FILE
, "> $editdir /blacklists/ $besettings {'BE_NAME'}/expressions" );
812 print FILE
" $besettings {'BE_EXPRESSIONS'} \n " ;
815 if ( system ( "/bin/tar -C $editdir -czf $editdir / $besettings {'BE_NAME'}.tar.gz blacklists" ))
817 $errormessage = $Lang :: tr
{ 'urlfilter export error' };
821 print "Content-type: application/gzip \n " ;
822 print "Content-length: " ;
823 print (- s
" $editdir / $besettings {'BE_NAME'}.tar.gz" );
825 print "Content-disposition: attachment; filename= $besettings {'BE_NAME'}.tar.gz \n\n " ;
827 open ( FILE
, " $editdir / $besettings {'BE_NAME'}.tar.gz" );
828 while (< FILE
>) { print ; }
831 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
835 $errormessage = $Lang :: tr
{ 'urlfilter category data error' };
839 if (( $besettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter install blacklist' }) && ( $besettings { 'MODE' } = 'BLACKLIST_EDITOR' ))
841 $besettings { 'BEMODE' } = 'on' ;
843 if ( $besettings { 'BE_NAME' } eq '' )
845 $errormessage = $Lang :: tr
{ 'urlfilter category name error' };
846 } elsif ( $besettings { 'BE_DOMAINS' } || $besettings { 'BE_URLS' } || $besettings { 'BE_EXPRESSIONS' }) {
848 $_ = $besettings { 'BE_NAME' }; tr/A-Z/a-z/ ; $besettings { 'BE_NAME' } = $_ ;
850 if (!- d
" $editdir " ) { mkdir ( " $editdir " ); }
852 if (!- d
" $dbdir / $besettings {'BE_NAME'}" ) { mkdir ( " $dbdir / $besettings {'BE_NAME'}" ); }
854 if (- e
" $dbdir / $besettings {'BE_NAME'}/domains" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/domains" ); }
855 if ( $besettings { 'BE_DOMAINS' })
857 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/domains" );
859 print FILE
" $besettings {'BE_DOMAINS'} \n " ;
862 if (- e
" $dbdir / $besettings {'BE_NAME'}/urls" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/urls" ); }
863 if ( $besettings { 'BE_URLS' })
865 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/urls" );
867 print FILE
" $besettings {'BE_URLS'} \n " ;
870 if (- e
" $dbdir / $besettings {'BE_NAME'}/expressions" ) { unlink ( " $dbdir / $besettings {'BE_NAME'}/expressions" ); }
871 if ( $besettings { 'BE_EXPRESSIONS' })
873 open ( FILE
, "> $dbdir / $besettings {'BE_NAME'}/expressions" );
875 print FILE
" $besettings {'BE_EXPRESSIONS'} \n " ;
879 open ( FILE
, "> $editdir /install.conf" );
881 print FILE
"logdir /var/log/squidGuard \n " ;
882 print FILE
"dbhome $dbdir / $besettings {'BE_NAME'} \n\n " ;
883 print FILE
"dest $besettings {'BE_NAME'} { \n " ;
884 if ( $besettings { 'BE_DOMAINS' }) { print FILE
" domainlist domains \n " ; }
885 if ( $besettings { 'BE_URLS' }) { print FILE
" urllist urls \n " ; }
886 if ( $besettings { 'BE_EXPRESSIONS' }) { print FILE
" expressions expressions \n " ; }
888 print FILE
"acl { \n " ;
889 print FILE
" default { \n " ;
890 print FILE
" pass none \n " ;
895 system ( "rm -f $dbdir / $besettings {'BE_NAME'}/*.db" );
896 system ( "/usr/sbin/squidGuard -c $editdir /install.conf -C all" );
897 system ( "chmod a+w $dbdir / $besettings {'BE_NAME'}/*.db" );
899 & readblockcategories
;
904 system ( '/usr/local/bin/restartsquid' ) unless ( $besettings { 'NORESTART' } eq 'on' );
906 if (- d
$editdir ) { system ( "rm -rf $editdir " ); }
908 $errormessage = $Lang :: tr
{ 'urlfilter category data error' };
912 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter save schedule' })
914 if (( $filtersettings { 'UPDATE_SOURCE' } eq 'custom' ) && ( $filtersettings { 'CUSTOM_UPDATE_URL' } eq '' ))
916 $errormessage = $Lang :: tr
{ 'urlfilter custom url required' };
918 open ( FILE
, "> $updconffile " );
919 print FILE
"ENABLE_AUTOUPDATE= $filtersettings {'ENABLE_AUTOUPDATE'} \n " ;
920 print FILE
"UPDATE_SCHEDULE= $filtersettings {'UPDATE_SCHEDULE'} \n " ;
921 print FILE
"UPDATE_SOURCE= $filtersettings {'UPDATE_SOURCE'} \n " ;
922 print FILE
"CUSTOM_UPDATE_URL= $filtersettings {'CUSTOM_UPDATE_URL'} \n " ;
925 if (- e
$upd_cron_dly ) { unlink ( $upd_cron_dly ); }
926 if (- e
$upd_cron_wly ) { unlink ( $upd_cron_wly ); }
927 if (- e
$upd_cron_mly ) { unlink ( $upd_cron_mly ); }
929 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'daily' ))
931 symlink ( "../bin/autoupdate.pl" , $upd_cron_dly )
933 symlink ( "/bin/false" , $upd_cron_dly )
936 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'weekly' ))
938 symlink ( "../bin/autoupdate.pl" , $upd_cron_wly )
940 symlink ( "/bin/false" , $upd_cron_wly )
943 if (( $filtersettings { 'ENABLE_AUTOUPDATE' } eq 'on' ) && ( $filtersettings { 'UPDATE_SCHEDULE' } eq 'monthly' ))
945 symlink ( "../bin/autoupdate.pl" , $upd_cron_mly )
947 symlink ( "/bin/false" , $upd_cron_mly )
952 if ( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter update now' })
954 if ( $filtersettings { 'UPDATE_SOURCE' } eq 'custom' )
956 if ( $filtersettings { 'CUSTOM_UPDATE_URL' } eq '' )
958 $errormessage = $Lang :: tr
{ 'urlfilter custom url required' };
960 system ( "${General::swroot}/urlfilter/bin/autoupdate.pl $filtersettings {'CUSTOM_UPDATE_URL'} &" );
963 system ( "${General::swroot}/urlfilter/bin/autoupdate.pl $filtersettings {'UPDATE_SOURCE'} &" );
968 if (- e
"${General::swroot}/urlfilter/settings" ) { & General
:: readhash
( "${General::swroot}/urlfilter/settings" , \
%filtersettings ); }
972 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ 'off' } = '' ;
973 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ 'on' } = '' ;
974 $checked { 'ENABLE_CUSTOM_BLACKLIST' }{ $filtersettings { 'ENABLE_CUSTOM_BLACKLIST' }} = "checked='checked'" ;
975 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ 'off' } = '' ;
976 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ 'on' } = '' ;
977 $checked { 'ENABLE_CUSTOM_WHITELIST' }{ $filtersettings { 'ENABLE_CUSTOM_WHITELIST' }} = "checked='checked'" ;
978 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ 'off' } = '' ;
979 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ 'on' } = '' ;
980 $checked { 'ENABLE_CUSTOM_EXPRESSIONS' }{ $filtersettings { 'ENABLE_CUSTOM_EXPRESSIONS' }} = "checked='checked'" ;
981 $checked { 'BLOCK_EXECUTABLES' }{ 'off' } = '' ;
982 $checked { 'BLOCK_EXECUTABLES' }{ 'on' } = '' ;
983 $checked { 'BLOCK_EXECUTABLES' }{ $filtersettings { 'BLOCK_EXECUTABLES' }} = "checked='checked'" ;
984 $checked { 'BLOCK_AUDIO-VIDEO' }{ 'off' } = '' ;
985 $checked { 'BLOCK_AUDIO-VIDEO' }{ 'on' } = '' ;
986 $checked { 'BLOCK_AUDIO-VIDEO' }{ $filtersettings { 'BLOCK_AUDIO-VIDEO' }} = "checked='checked'" ;
987 $checked { 'BLOCK_ARCHIVES' }{ 'off' } = '' ;
988 $checked { 'BLOCK_ARCHIVES' }{ 'on' } = '' ;
989 $checked { 'BLOCK_ARCHIVES' }{ $filtersettings { 'BLOCK_ARCHIVES' }} = "checked='checked'" ;
990 $checked { 'ENABLE_REWRITE' }{ 'off' } = '' ;
991 $checked { 'ENABLE_REWRITE' }{ 'on' } = '' ;
992 $checked { 'ENABLE_REWRITE' }{ $filtersettings { 'ENABLE_REWRITE' }} = "checked='checked'" ;
993 $checked { 'SHOW_CATEGORY' }{ 'off' } = '' ;
994 $checked { 'SHOW_CATEGORY' }{ 'on' } = '' ;
995 $checked { 'SHOW_CATEGORY' }{ $filtersettings { 'SHOW_CATEGORY' }} = "checked='checked'" ;
996 $checked { 'SHOW_URL' }{ 'off' } = '' ;
997 $checked { 'SHOW_URL' }{ 'on' } = '' ;
998 $checked { 'SHOW_URL' }{ $filtersettings { 'SHOW_URL' }} = "checked='checked'" ;
999 $checked { 'SHOW_IP' }{ 'off' } = '' ;
1000 $checked { 'SHOW_IP' }{ 'on' } = '' ;
1001 $checked { 'SHOW_IP' }{ $filtersettings { 'SHOW_IP' }} = "checked='checked'" ;
1002 $checked { 'ENABLE_DNSERROR' }{ 'off' } = '' ;
1003 $checked { 'ENABLE_DNSERROR' }{ 'on' } = '' ;
1004 $checked { 'ENABLE_DNSERROR' }{ $filtersettings { 'ENABLE_DNSERROR' }} = "checked='checked'" ;
1005 $checked { 'ENABLE_JPEG' }{ 'off' } = '' ;
1006 $checked { 'ENABLE_JPEG' }{ 'on' } = '' ;
1007 $checked { 'ENABLE_JPEG' }{ $filtersettings { 'ENABLE_JPEG' }} = "checked='checked'" ;
1008 $checked { 'ENABLE_EXPR_LISTS' }{ 'off' } = '' ;
1009 $checked { 'ENABLE_EXPR_LISTS' }{ 'on' } = '' ;
1010 $checked { 'ENABLE_EXPR_LISTS' }{ $filtersettings { 'ENABLE_EXPR_LISTS' }} = "checked='checked'" ;
1011 $checked { 'BLOCK_IP_ADDR' }{ 'off' } = '' ;
1012 $checked { 'BLOCK_IP_ADDR' }{ 'on' } = '' ;
1013 $checked { 'BLOCK_IP_ADDR' }{ $filtersettings { 'BLOCK_IP_ADDR' }} = "checked='checked'" ;
1014 $checked { 'BLOCK_ALL' }{ 'off' } = '' ;
1015 $checked { 'BLOCK_ALL' }{ 'on' } = '' ;
1016 $checked { 'BLOCK_ALL' }{ $filtersettings { 'BLOCK_ALL' }} = "checked='checked'" ;
1017 $checked { 'ENABLE_EMPTY_ADS' }{ 'off' } = '' ;
1018 $checked { 'ENABLE_EMPTY_ADS' }{ 'on' } = '' ;
1019 $checked { 'ENABLE_EMPTY_ADS' }{ $filtersettings { 'ENABLE_EMPTY_ADS' }} = "checked='checked'" ;
1020 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ 'off' } = '' ;
1021 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ 'on' } = '' ;
1022 $checked { 'ENABLE_GLOBAL_WHITELIST' }{ $filtersettings { 'ENABLE_GLOBAL_WHITELIST' }} = "checked='checked'" ;
1023 $checked { 'ENABLE_SAFESEARCH' }{ 'off' } = '' ;
1024 $checked { 'ENABLE_SAFESEARCH' }{ 'on' } = '' ;
1025 $checked { 'ENABLE_SAFESEARCH' }{ $filtersettings { 'ENABLE_SAFESEARCH' }} = "checked='checked'" ;
1026 $checked { 'ENABLE_LOG' }{ 'off' } = '' ;
1027 $checked { 'ENABLE_LOG' }{ 'on' } = '' ;
1028 $checked { 'ENABLE_LOG' }{ $filtersettings { 'ENABLE_LOG' }} = "checked='checked'" ;
1029 $checked { 'ENABLE_USERNAME_LOG' }{ 'off' } = '' ;
1030 $checked { 'ENABLE_USERNAME_LOG' }{ 'on' } = '' ;
1031 $checked { 'ENABLE_USERNAME_LOG' }{ $filtersettings { 'ENABLE_USERNAME_LOG' }} = "checked='checked'" ;
1032 $checked { 'ENABLE_CATEGORY_LOG' }{ 'off' } = '' ;
1033 $checked { 'ENABLE_CATEGORY_LOG' }{ 'on' } = '' ;
1034 $checked { 'ENABLE_CATEGORY_LOG' }{ $filtersettings { 'ENABLE_CATEGORY_LOG' }} = "checked='checked'" ;
1036 foreach $category ( @filtergroups ) {
1037 $checked { $category }{ 'off' } = '' ;
1038 $checked { $category }{ 'on' } = '' ;
1039 $checked { $category }{ $filtersettings { $category }} = "checked='checked'" ;
1042 $selected { 'DEFINITION' }{ $tcsettings { 'DEFINITION' }} = "selected='selected'" ;
1043 $selected { 'FROM_HOUR' }{ $tcsettings { 'FROM_HOUR' }} = "selected='selected'" ;
1044 $selected { 'FROM_MINUTE' }{ $tcsettings { 'FROM_MINUTE' }} = "selected='selected'" ;
1045 $selected { 'TO_HOUR' }{ $tcsettings { 'TO_HOUR' }} = "selected='selected'" ;
1046 $selected { 'TO_MINUTE' }{ $tcsettings { 'TO_MINUTE' }} = "selected='selected'" ;
1048 @selectedcategories = split ( /\|/ , $tcsettings { 'DST' });
1049 foreach ( @selectedcategories )
1051 $selected { 'DST' }{ $_ } = "selected='selected'" ;
1054 $selected { 'ACCESS' }{ $tcsettings { 'ACCESS' }} = "selected='selected'" ;
1056 $checked { 'ENABLERULE' }{ 'off' } = '' ;
1057 $checked { 'ENABLERULE' }{ 'on' } = '' ;
1058 $checked { 'ENABLERULE' }{ $tcsettings { 'ENABLERULE' }} = "checked='checked'" ;
1059 $checked { 'MON' }{ 'off' } = '' ;
1060 $checked { 'MON' }{ 'on' } = '' ;
1061 $checked { 'MON' }{ $tcsettings { 'MON' }} = "checked='checked'" ;
1062 $checked { 'TUE' }{ 'off' } = '' ;
1063 $checked { 'TUE' }{ 'on' } = '' ;
1064 $checked { 'TUE' }{ $tcsettings { 'TUE' }} = "checked='checked'" ;
1065 $checked { 'WED' }{ 'off' } = '' ;
1066 $checked { 'WED' }{ 'on' } = '' ;
1067 $checked { 'WED' }{ $tcsettings { 'WED' }} = "checked='checked'" ;
1068 $checked { 'THU' }{ 'off' } = '' ;
1069 $checked { 'THU' }{ 'on' } = '' ;
1070 $checked { 'THU' }{ $tcsettings { 'THU' }} = "checked='checked'" ;
1071 $checked { 'FRI' }{ 'off' } = '' ;
1072 $checked { 'FRI' }{ 'on' } = '' ;
1073 $checked { 'FRI' }{ $tcsettings { 'FRI' }} = "checked='checked'" ;
1074 $checked { 'SAT' }{ 'off' } = '' ;
1075 $checked { 'SAT' }{ 'on' } = '' ;
1076 $checked { 'SAT' }{ $tcsettings { 'SAT' }} = "checked='checked'" ;
1077 $checked { 'SUN' }{ 'off' } = '' ;
1078 $checked { 'SUN' }{ 'on' } = '' ;
1079 $checked { 'SUN' }{ $tcsettings { 'SUN' }} = "checked='checked'" ;
1081 $selected { 'SPORADIC' }{ $uqsettings { 'SPORADIC' }} = "selected='selected'" ;
1082 $selected { 'RENEWAL' } { $uqsettings { 'RENEWAL' }} = "selected='selected'" ;
1084 $checked { 'ENABLEQUOTA' }{ 'off' } = '' ;
1085 $checked { 'ENABLEQUOTA' }{ 'on' } = '' ;
1086 $checked { 'ENABLEQUOTA' }{ $uqsettings { 'ENABLEQUOTA' }} = "checked='checked'" ;
1088 $selected { 'BE_BLACKLIST' }{ $besettings { 'BE_BLACKLIST' }} = "selected='selected'" ;
1091 & Header
:: showhttpheaders
();
1093 & Header
:: openpage
( $Lang :: tr
{ 'urlfilter configuration' }, 1 , '' );
1095 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
1097 if ( $errormessage ) {
1098 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
1099 print "<font class='base'> $errormessage </font> \n " ;
1100 & Header
:: closebox
();
1101 } elsif (( $tcsettings { 'CHANGED' } eq 'yes' ) || ( $uqsettings { 'CHANGED' } eq 'yes' ) ) {
1103 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
1104 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter restart notification'}:" );
1105 print "<class name='base'> $Lang ::tr{'urlfilter restart message'} \n " ;
1106 if ( $uqsettings { 'MODE' } eq 'USERQUOTA' ) { print "<p><class name='base'> $Lang ::tr{'urlfilter quota restart message'} \n " ; }
1108 print "<p><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter restart'}' />" ;
1109 if ( $tcsettings { 'MODE' } eq 'TIMECONSTRAINT' ) { print "<input type='hidden' name='MODE' value='TIMECONSTRAINT' />" ; }
1110 if ( $uqsettings { 'MODE' } eq 'USERQUOTA' ) { print "<input type='hidden' name='MODE' value='USERQUOTA' />" ; }
1111 & Header
:: closebox
();
1115 if ( $restoremessage ) {
1116 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter restore results'}:" );
1117 print "<class name='base'> $restoremessage \n " ;
1118 print " </class> \n " ;
1119 & Header
:: closebox
();
1122 if ((! $tcsettings { 'TCMODE' }) && (! $uqsettings { 'UQMODE' }) && (! $besettings { 'BEMODE' })) {
1124 if (!( $filtersettings { 'ACTION' } eq $Lang :: tr
{ 'urlfilter manage repository' })) {
1126 #==========================================================
1128 # Section: Main Configuration
1130 #==========================================================
1132 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1134 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter filter settings'}:" );
1136 <table width='100%'>
1138 <td colspan='4'><b> $Lang ::tr{'urlfilter block categories'}</b></td>
1143 if ( @categories == 0 ) {
1146 <td><i> $Lang ::tr{'urlfilter no categories'}</i></td>
1156 for ( $n = 0 ; $n <= @categories ; $n = $n + $i ) {
1157 for ( $i = 0 ; $i <= 3 ; $i ++) {
1158 if ( $i eq 0 ) { print "<tr> \n " ; }
1159 if (( $n + $i ) < @categories ) {
1160 print "<td width='15%'> @categories [ $n + $i ]:<\/td> \n " ;
1161 print "<td width='10%'><input type='checkbox' name= @filtergroups [ $n + $i ] $checked { @filtergroups [ $n + $i ]}{'on'} /></td> \n " ;
1163 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1170 <table width='100%'>
1172 <td><b> $Lang ::tr{'urlfilter custom blacklist'}</b></td>
1178 <td colspan='2'> $Lang ::tr{'urlfilter blocked domains'} <img src='/blob.gif' alt='*' /></td>
1179 <td colspan='2'> $Lang ::tr{'urlfilter blocked urls'} <img src='/blob.gif' alt='*' /></td>
1182 <td colspan='2' width='50%'><textarea name='CUSTOM_BLACK_DOMAINS' cols='32' rows='6' wrap='off'>
1186 print $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
1190 <td colspan='2' width='50%'><textarea name='CUSTOM_BLACK_URLS' cols='32' rows='6' wrap='off'>
1194 print $filtersettings { 'CUSTOM_BLACK_URLS' };
1200 <table width='100%'>
1202 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom blacklist'}:</td>
1203 <td><input type='checkbox' name='ENABLE_CUSTOM_BLACKLIST' $checked {'ENABLE_CUSTOM_BLACKLIST'}{'on'} /></td>
1209 <table width='100%'>
1211 <td><b> $Lang ::tr{'urlfilter custom whitelist'}</b></td>
1217 <td colspan='2'> $Lang ::tr{'urlfilter allowed domains'} <img src='/blob.gif' alt='*' /></td>
1218 <td colspan='2'> $Lang ::tr{'urlfilter allowed urls'} <img src='/blob.gif' alt='*' /></td>
1221 <td colspan='2' width='50%'><textarea name='CUSTOM_WHITE_DOMAINS' cols='32' rows='6' wrap='off'>
1225 print $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
1229 <td colspan='2' width='50%'><textarea name='CUSTOM_WHITE_URLS' cols='32' rows='6' wrap='off'>
1233 print $filtersettings { 'CUSTOM_WHITE_URLS' };
1239 <table width='100%'>
1241 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom whitelist'}:</td>
1242 <td><input type='checkbox' name='ENABLE_CUSTOM_WHITELIST' $checked {'ENABLE_CUSTOM_WHITELIST'}{'on'} /></td>
1248 <table width='100%'>
1250 <td colspan='4'><b> $Lang ::tr{'urlfilter custom expression list'}</b></td>
1253 <td colspan='4'> $Lang ::tr{'urlfilter blocked expressions'} <img src='/blob.gif' alt='*' /></td>
1256 <td colspan='4'><textarea name='CUSTOM_EXPRESSIONS' cols='70' rows='3' wrap='off'>
1260 print $filtersettings { 'CUSTOM_EXPRESSIONS' };
1266 <td class='base' width='25%'> $Lang ::tr{'urlfilter enable custom expression list'}:</td>
1267 <td><input type='checkbox' name='ENABLE_CUSTOM_EXPRESSIONS' $checked {'ENABLE_CUSTOM_EXPRESSIONS'}{'on'} /></td>
1273 <table width='100%'>
1275 <td colspan='4'><b> $Lang ::tr{'urlfilter file ext block'}</b></td>
1278 <td width='25%' class='base'> $Lang ::tr{'urlfilter block executables'}:</td>
1279 <td width='12%'><input type='checkbox' name='BLOCK_EXECUTABLES' $checked {'BLOCK_EXECUTABLES'}{'on'} /></td>
1280 <td width='25%' class='base'> $Lang ::tr{'urlfilter block audio-video'}:</td>
1281 <td><input type='checkbox' name='BLOCK_AUDIO-VIDEO' $checked {'BLOCK_AUDIO-VIDEO'}{'on'} /></td>
1284 <td class='base'> $Lang ::tr{'urlfilter block archives'}:</td>
1285 <td><input type='checkbox' name='BLOCK_ARCHIVES' $checked {'BLOCK_ARCHIVES'}{'on'} /></td>
1291 <table width='100%'>
1293 <td colspan='4'><b> $Lang ::tr{'urlfilter local file redirection'}</b></td>
1296 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable rewrite rules'}:</td>
1297 <td width='12%'><input type='checkbox' name='ENABLE_REWRITE' $checked {'ENABLE_REWRITE'}{'on'} /></td>
1302 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter manage repository'}'></td>
1309 <table width='100%'>
1311 <td colspan='2'><b> $Lang ::tr{'urlfilter network access control'}</b></td>
1316 <td class='base'> $Lang ::tr{'urlfilter unfiltered clients'}: <img src='/blob.gif' alt='*' /></td>
1317 <td><input type='text' name='UNFILTERED_CLIENTS' value=' $filtersettings {'UNFILTERED_CLIENTS'}' size='30' /></td>
1318 <td class='base'> $Lang ::tr{'urlfilter banned clients'}: <img src='/blob.gif' alt='*' /></td>
1319 <td><input type='text' name='BANNED_CLIENTS' value=' $filtersettings {'BANNED_CLIENTS'}' size='30' /></td>
1323 <table width='100%'>
1325 <td colspan='4'><b> $Lang ::tr{'urlfilter timebased access control'}</b></td>
1328 <td width='25%'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter set time constraints'}'></td>
1329 <td width='25%'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter set user quota'}'></td>
1335 <table width='100%'>
1337 <td colspan='4'><b> $Lang ::tr{'urlfilter block settings'}</b></td>
1340 <td width='25%' class='base'> $Lang ::tr{'urlfilter show category'}:</td>
1341 <td width='12%'><input type='checkbox' name='SHOW_CATEGORY' $checked {'SHOW_CATEGORY'}{'on'} /></td>
1342 <td width='25%' class='base'> $Lang ::tr{'urlfilter redirectpage'}: <img src='/blob.gif' alt='*' /></td>
1343 <td><input type='text' name='REDIRECT_PAGE' value=' $filtersettings {'REDIRECT_PAGE'}' size='40' /></td>
1346 <td class='base'> $Lang ::tr{'urlfilter show url'}:</td>
1347 <td><input type='checkbox' name='SHOW_URL' $checked {'SHOW_URL'}{'on'} /></td>
1348 <td class='base'> $Lang ::tr{'urlfilter msg text 1'}: <img src='/blob.gif' alt='*' /></td>
1349 <td><input type='text' name='MSG_TEXT_1' value=' $filtersettings {'MSG_TEXT_1'}' size='40' /></td>
1352 <td class='base'> $Lang ::tr{'urlfilter show ip'}:</td>
1353 <td><input type='checkbox' name='SHOW_IP' $checked {'SHOW_IP'}{'on'} /></td>
1354 <td class='base'> $Lang ::tr{'urlfilter msg text 2'}: <img src='/blob.gif' alt='*' /></td>
1355 <td><input type='text' name='MSG_TEXT_2' value=' $filtersettings {'MSG_TEXT_2'}' size='40' /></td>
1358 <td class='base'> $Lang ::tr{'urlfilter show dnserror'}:</td>
1359 <td><input type='checkbox' name='ENABLE_DNSERROR' $checked {'ENABLE_DNSERROR'}{'on'} /></td>
1360 <td class='base'> $Lang ::tr{'urlfilter msg text 3'}: <img src='/blob.gif' alt='*' /></td>
1361 <td><input type='text' name='MSG_TEXT_3' value=' $filtersettings {'MSG_TEXT_3'}' size='40' /></td>
1364 <td class='base'> $Lang ::tr{'urlfilter enable jpeg'}:</td>
1365 <td><input type='checkbox' name='ENABLE_JPEG' $checked {'ENABLE_JPEG'}{'on'} /></td>
1371 <table width='100%'>
1373 <td colspan='4'><b> $Lang ::tr{'urlfilter advanced settings'}</b></td>
1376 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable expression lists'}:</td>
1377 <td width='12%'><input type='checkbox' name='ENABLE_EXPR_LISTS' $checked {'ENABLE_EXPR_LISTS'}{'on'} /></td>
1378 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable log'}:</td>
1379 <td><input type='checkbox' name='ENABLE_LOG' $checked {'ENABLE_LOG'}{'on'} /></td>
1382 <td class='base'> $Lang ::tr{'urlfilter safesearch'}:</td>
1383 <td><input type='checkbox' name='ENABLE_SAFESEARCH' $checked {'ENABLE_SAFESEARCH'}{'on'} /></td>
1384 <td class='base'> $Lang ::tr{'urlfilter username log'}:</td>
1385 <td><input type='checkbox' name='ENABLE_USERNAME_LOG' $checked {'ENABLE_USERNAME_LOG'}{'on'} /></td>
1388 <td class='base'> $Lang ::tr{'urlfilter empty ads'}:</td>
1389 <td><input type='checkbox' name='ENABLE_EMPTY_ADS' $checked {'ENABLE_EMPTY_ADS'}{'on'} /></td>
1390 <td class='base'> $Lang ::tr{'urlfilter category log'}:</td>
1391 <td><input type='checkbox' name='ENABLE_CATEGORY_LOG' $checked {'ENABLE_CATEGORY_LOG'}{'on'} /></td>
1394 <td class='base'> $Lang ::tr{'urlfilter block ip'}:</td>
1395 <td><input type='checkbox' name='BLOCK_IP_ADDR' $checked {'BLOCK_IP_ADDR'}{'on'} /></td>
1396 <td class='base'> $Lang ::tr{'urlfilter children'}:</td>
1397 <td><input type='text' name='CHILDREN' value=' $filtersettings {'CHILDREN'}' size='5' /></td>
1400 <td class='base'> $Lang ::tr{'urlfilter block all'}:</td>
1401 <td><input type='checkbox' name='BLOCK_ALL' $checked {'BLOCK_ALL'}{'on'} /></td>
1402 <td class='base'> $Lang ::tr{'urlfilter whitelist always allowed'}:</td>
1403 <td><input type='checkbox' name='ENABLE_GLOBAL_WHITELIST' $checked {'ENABLE_GLOBAL_WHITELIST'}{'on'} /></td>
1407 <table width='100%'>
1410 <img src='/blob.gif' align='top' alt='*' />
1411 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
1413 <td align='right'>
1417 <table width='100%'>
1420 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
1421 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter save and restart'}' /></td>
1428 & Header
:: closebox
();
1432 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1434 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter maintenance'}:" );
1437 <table width='100%'>
1439 <td class='base'><b> $Lang ::tr{'urlfilter blacklist update'}</b></td>
1442 <td> $Lang ::tr{'urlfilter upload information'}<p> $Lang ::tr{'urlfilter upload text'}:</td>
1445 <td><input type='file' name='UPDATEFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter upload blacklist'}' /></td>
1451 <table width='100%'>
1453 <td colspan='2' class='base'><b> $Lang ::tr{'urlfilter automatic blacklist update'}</b>
1456 if (- e
" $updflagfile " )
1458 $blacklistage = int (- M
" $updflagfile " );
1459 print " <b>[</b> <small><i> $Lang ::tr{'urlfilter blacklist age 1'} <b> $blacklistage </b> $Lang ::tr{'urlfilter blacklist age 2'}</i></small> <b>]</b>" ;
1462 $updatesettings { 'UPDATE_SCHEDULE' } = 'monthly' ;
1463 $updatesettings { 'CUSTOM_UPDATE_URL' } = '' ;
1465 if (- e
" $updconffile " ) { & General
:: readhash
( " $updconffile " , \
%updatesettings ); }
1467 $checked { 'ENABLE_AUTOUPDATE' }{ 'off' } = '' ;
1468 $checked { 'ENABLE_AUTOUPDATE' }{ 'on' } = '' ;
1469 $checked { 'ENABLE_AUTOUPDATE' }{ $updatesettings { 'ENABLE_AUTOUPDATE' }} = "checked='checked'" ;
1471 $selected { 'UPDATE_SCHEDULE' }{ $updatesettings { 'UPDATE_SCHEDULE' }} = "selected='selected'" ;
1473 $selected { 'UPDATE_SOURCE' }{ $updatesettings { 'UPDATE_SOURCE' }} = "selected='selected'" ;
1479 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable automatic blacklist update'}:</td>
1480 <td width='75%' class='base'><input type='checkbox' name='ENABLE_AUTOUPDATE' $checked {'ENABLE_AUTOUPDATE'}{'on'} /></td>
1483 <td class='base'> $Lang ::tr{'urlfilter automatic update schedule'}:</td>
1485 <select name='UPDATE_SCHEDULE'>
1486 <option value='daily' $selected {'UPDATE_SCHEDULE'}{'daily'}> $Lang ::tr{'urlfilter daily'}</option>
1487 <option value='weekly' $selected {'UPDATE_SCHEDULE'}{'weekly'}> $Lang ::tr{'urlfilter weekly'}</option>
1488 <option value='monthly' $selected {'UPDATE_SCHEDULE'}{'monthly'}> $Lang ::tr{'urlfilter monthly'}</option>
1493 <td class='base'> $Lang ::tr{'urlfilter select source'}:</td>
1494 <td class='base' colspan='2'>
1495 <select name='UPDATE_SOURCE'>
1499 foreach ( @source_urllist ) {
1501 $source_name = substr ( $_ , 0 , rindex ( $_ , "," ));
1502 $source_url = substr ( $_ , index ( $_ , "," )+ 1 );
1503 print " \t <option value=' $source_url ' $selected {'UPDATE_SOURCE'}{ $source_url }> $source_name </option> \n " ;
1507 <option value='custom' $selected {'UPDATE_SOURCE'}{'custom'}> $Lang ::tr{'urlfilter custom url'}</option>
1512 <td> $Lang ::tr{'urlfilter custom url'}:</td>
1513 <td><input type='text' name='CUSTOM_UPDATE_URL' value=' $updatesettings {'CUSTOM_UPDATE_URL'}' size='72' /></td>
1516 <table width='100%'>
1518 <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>
1524 <table width='100%'>
1526 <td class='base'><b> $Lang ::tr{'urlfilter blacklist editor'}</b></td>
1529 <td> $Lang ::tr{'urlfilter blacklist editor info'}</td>
1532 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter blacklist editor'}' /></td>
1538 <table width='100%'>
1540 <td colspan='4' class='base'><b> $Lang ::tr{'urlfilter backup settings'}</b></td>
1543 <td width='25%' class='base'> $Lang ::tr{'urlfilter enable full backup'}:</td>
1544 <td width='12%' class='base'><input type='checkbox' name='ENABLE_FULLBACKUP' $checked {'ENABLE_FULLBACKUP'}{'on'} /></td>
1549 <td colspan='4' class='base'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter backup'}' /></td>
1555 <table width='100%'>
1557 <td class='base'><b> $Lang ::tr{'urlfilter restore settings'}</b></td>
1560 <td> $Lang ::tr{'urlfilter restore text'}:</td>
1563 <td><input type='file' name='UPDATEFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter restore'}' /></td>
1570 & Header
:: closebox
();
1574 #==========================================================
1576 # Section: Manage Repository
1578 #==========================================================
1580 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
1582 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter manage local file repository'}:" );
1584 <table width='100%'>
1586 <td> $Lang ::tr{'urlfilter repository information'}<br><br></td>
1589 <td> $Lang ::tr{'urlfilter upload file text'}:</td>
1592 <td><input type='file' name='UPLOADFILE' size='50' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter upload file'}' /></td>
1595 <td><br><b> $Lang ::tr{'urlfilter upload file information 1'}:</b> $Lang ::tr{'urlfilter upload file information 2'}</td>
1599 <table width='100%'>
1601 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
1608 & Header
:: closebox
();
1610 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'urlfilter current files'}: </b>[ $repository ]" );
1612 @repositorylist = < $repository /*>;
1614 undef @repositoryfiles ;
1615 foreach ( @repositorylist )
1617 if (!- d
) { push ( @repositoryfiles , substr ( $_ , rindex ( $_ , "/" )+ 1 )); }
1620 if ( @repositoryfiles )
1623 <table width='100%'>
1625 <td align='center'><b> $Lang ::tr{'urlfilter filename'}</b></td>
1626 <td width='15%' align='center'><b> $Lang ::tr{'urlfilter filesize'}</b></td>
1627 <td width='10%'></td>
1632 foreach $line ( @repositoryfiles )
1636 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
1638 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
1639 $filesize = (- s
" $repository / $line " );
1640 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/ ;
1643 <td> $line </td>
1644 <td align='right'> $filesize </td>
1647 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
1648 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
1649 <input type='hidden' name='ID' value=' $line ' />
1650 <input type='hidden' name='ACTION' value=' $Lang ::tr{'urlfilter remove file'}' />
1667 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
1668 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
1669 <td class='base'> $Lang ::tr{'remove'}</td>
1676 print "<i> $Lang ::tr{'urlfilter empty repository'}</i> \n " ;
1679 & Header
:: closebox
();
1683 } elsif ( $tcsettings { 'TCMODE' }) {
1685 #==========================================================
1687 # Section: Set Time Constraints
1689 #==========================================================
1691 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
1693 $buttontext = $Lang :: tr
{ 'urlfilter add rule' };
1694 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
1695 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter edit time constraint rule' }. ':' );
1696 $buttontext = $Lang :: tr
{ 'urlfilter update rule' };
1698 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter add new time constraint rule' }. ':' );
1702 <table width='100%'>
1704 <td width='2%'> $Lang ::tr{'urlfilter constraint definition'}</td>
1705 <td width='1%'> </td>
1706 <td width='2%' align='center'> $Lang ::tr{'urlfilter monday'}</td>
1707 <td width='2%' align='center'> $Lang ::tr{'urlfilter tuesday'}</td>
1708 <td width='2%' align='center'> $Lang ::tr{'urlfilter wednesday'}</td>
1709 <td width='2%' align='center'> $Lang ::tr{'urlfilter thursday'}</td>
1710 <td width='2%' align='center'> $Lang ::tr{'urlfilter friday'}</td>
1711 <td width='2%' align='center'> $Lang ::tr{'urlfilter saturday'}</td>
1712 <td width='2%' align='center'> $Lang ::tr{'urlfilter sunday'}</td>
1713 <td width='1%'> </td>
1714 <td width='7%' colspan=3> $Lang ::tr{'urlfilter from'}</td>
1715 <td width='1%'> </td>
1716 <td width='7%' colspan=3> $Lang ::tr{'urlfilter to'}</td>
1721 <select name='DEFINITION'>
1722 <option value='within' $selected {'DEFINITION'}{'within'}> $Lang ::tr{'urlfilter constraint within'}</option>
1723 <option value='outside' $selected {'DEFINITION'}{'outside'}> $Lang ::tr{'urlfilter constraint outside'}</option>
1727 <td class='base'><input type='checkbox' name='MON' $checked {'MON'}{'on'} /></td>
1728 <td class='base'><input type='checkbox' name='TUE' $checked {'TUE'}{'on'} /></td>
1729 <td class='base'><input type='checkbox' name='WED' $checked {'WED'}{'on'} /></td>
1730 <td class='base'><input type='checkbox' name='THU' $checked {'THU'}{'on'} /></td>
1731 <td class='base'><input type='checkbox' name='FRI' $checked {'FRI'}{'on'} /></td>
1732 <td class='base'><input type='checkbox' name='SAT' $checked {'SAT'}{'on'} /></td>
1733 <td class='base'><input type='checkbox' name='SUN' $checked {'SUN'}{'on'} /></td>
1736 <select name='FROM_HOUR'>
1739 for ( $i = 0 ; $i <= 24 ; $i ++) {
1740 $_ = sprintf ( " %02s " , $i );
1741 print "<option $selected {'FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1748 <select name='FROM_MINUTE'>
1751 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1752 $_ = sprintf ( " %02s " , $i );
1753 print "<option $selected {'FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1760 <select name='TO_HOUR'>
1763 for ( $i = 0 ; $i <= 24 ; $i ++) {
1764 $_ = sprintf ( " %02s " , $i );
1765 print "<option $selected {'TO_HOUR'}{ $_ }> $_ </option> \n " ;
1772 <select name='TO_MINUTE'>
1775 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1776 $_ = sprintf ( " %02s " , $i );
1777 print "<option $selected {'TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1788 <table width='100%'>
1790 <td width='5%'> $Lang ::tr{'urlfilter source'}</td>
1791 <td width='1%'> </td>
1792 <td width='5%'> $Lang ::tr{'urlfilter dst'} <img src='/blob.gif' alt='*'><img src='/blob.gif' alt='*'></td>
1793 <td width='1%'> </td>
1794 <td width='5%'> $Lang ::tr{'urlfilter access'}</td>
1798 <td valign='top'><input type='text' name='SRC' value=' $tcsettings {'SRC'}' size='32' /></td>
1800 <td class='base' rowspan='3' valign='top'>
1801 <select name='DST' size='4' multiple>
1802 <option value='any' $selected {'DST'}{'any'} = "selected='selected'"> $Lang ::tr{'urlfilter category all'}</option>
1803 <option value='in-addr' $selected {'DST'}{'in-addr'} = "selected='selected'">in-addr</option>
1807 & readblockcategories
;
1808 foreach ( @categories )
1810 print "<option value=' $_ ' $selected {'DST'}{ $_ }> $_ </option> \n " ;
1814 <option value='files' $selected {'DST'}{'files'} = "selected='selected'">files</option>
1815 <option value='custom-blocked' $selected {'DST'}{'custom-blocked'} = "selected='selected'">custom-blocked</option>
1816 <option value='custom-expressions' $selected {'DST'}{'custom-expressions'} = "selected='selected'">custom-expressions</option>
1820 <td class='base' valign='top'>
1821 <select name='ACCESS'>
1822 <option value='block' $selected {'ACCESS'}{'block'}> $Lang ::tr{'urlfilter mode block'}</option>
1823 <option value='allow' $selected {'ACCESS'}{'allow'}> $Lang ::tr{'urlfilter mode allow'}</option>
1829 <td> $Lang ::tr{'remark'} <img src='/blob.gif' alt='*'></td>
1836 <td><input type='text' name='COMMENT' value=' $tcsettings {'COMMENT'}' size='32' /></td>
1844 <table width='100%'>
1846 <td class='base'> $Lang ::tr{'urlfilter enabled'}<input type='checkbox' name='ENABLERULE' $checked{'ENABLERULE'}{'on'} /></td>
1854 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
1855 <td><input type='hidden' name='MODE' value='TIMECONSTRAINT' /></td>
1856 <td><input type='submit' name='SUBMIT' value=' $buttontext ' /></td>
1857 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
1859 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
1863 <table width='100%'>
1865 <td width='1%' align='right'> <img src='/blob.gif' align='top' alt='*' /> </td>
1866 <td><font class='base'> $Lang ::tr{'this field may be blank'}</font></td>
1869 <td width='1%' align='right'><img src='/blob.gif' align='top' alt='*' /><img src='/blob.gif' align='top' alt='*' /> </td>
1870 <td><font class='base'> $Lang ::tr{'urlfilter select multi'}</font></td>
1876 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
1877 print "<input type='hidden' name='EDITING' value=' $tcsettings {'ID'}' /> \n " ;
1879 print "<input type='hidden' name='EDITING' value='no' /> \n " ;
1882 & Header
:: closebox
();
1885 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'current rules' });
1887 <table width='100%'>
1889 <td width='5%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter constraint definition'}</b></td>
1890 <td width='10%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter time space'}</b></td>
1891 <td width='15%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter src'}</b></td>
1892 <td width='5%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter dst'}</b></td>
1893 <td width='10%' class='boldbase' colspan='4' align='center'> </td>
1898 if ( $tcsettings { 'ACTION' } ne '' or $changed ne 'no' )
1900 open ( FILE
, $tcfile );
1906 foreach $line ( @tclist )
1910 @temp = split ( /\,/ , $line );
1911 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $tcsettings { 'ID' } eq $id ) {
1912 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
1914 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
1916 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
1917 if ( $temp [ 0 ] eq 'within' ) { $temp [ 0 ]= $Lang :: tr
{ 'urlfilter constraint within' }; } else { $temp [ 0 ]= $Lang :: tr
{ 'urlfilter constraint outside' }; }
1918 if ( $temp [ 13 ] eq 'any' ) { $temp [ 13 ]= $Lang :: tr
{ 'urlfilter category all' }; }
1919 if ( $temp [ 15 ] eq 'on' ) { $gif = 'on.gif' ; $toggle = 'off' ; $gdesc = $Lang :: tr
{ 'click to disable' };}
1920 else { $gif = 'off.gif' ; $toggle = 'on' ; $gdesc = $Lang :: tr
{ 'click to enable' }; }
1921 if ( $temp [ 14 ] eq 'block' ) { $led = 'led-red.gif' ; $ldesc = $Lang :: tr
{ 'urlfilter block access' };}
1922 else { $led = 'led-green.gif' ; $ldesc = $Lang :: tr
{ 'urlfilter allow access' }; }
1925 if ( $temp [ 1 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter mon' }; } else { $time .= '=' ; }
1926 if ( $temp [ 2 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter tue' }; } else { $time .= '=' ; }
1927 if ( $temp [ 3 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter wed' }; } else { $time .= '=' ; }
1928 if ( $temp [ 4 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter thu' }; } else { $time .= '=' ; }
1929 if ( $temp [ 5 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter fri' }; } else { $time .= '=' ; }
1930 if ( $temp [ 6 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter sat' }; } else { $time .= '=' ; }
1931 if ( $temp [ 7 ] eq 'on' ) { $time .= $Lang :: tr
{ 'urlfilter sun' }; } else { $time .= '=' ; }
1932 $time = $time . ' ' . $temp [ 8 ]. ':' . $temp [ 9 ]. ' to ' . $temp [ 10 ]. ':' . $temp [ 11 ];
1935 <td align='center'> $temp [0]</td>
1936 <td align='center' nowrap> $time </td>
1937 <td align='center'> $temp [12]</td>
1938 <td align='center'> $temp [13]</td>
1939 <td align='center'><image src='/images/urlfilter/ $led ' alt=' $ldesc '></td>
1942 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
1943 <input type='image' name=' $Lang ::tr{'toggle enable disable'}' src='/images/ $gif ' title=' $gdesc ' alt=' $gdesc ' />
1944 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1945 <input type='hidden' name='ID' value=' $id ' />
1946 <input type='hidden' name='ACTIVE' value=' $toggle ' />
1947 <input type='hidden' name='ACTION' value=' $Lang ::tr{'toggle enable disable'}' />
1952 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
1953 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
1954 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1955 <input type='hidden' name='ID' value=' $id ' />
1956 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
1961 <form method='post' name='frmc $id ' action=' $ENV {'SCRIPT_NAME'}'>
1962 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
1963 <input type='hidden' name='MODE' value='TIMECONSTRAINT' />
1964 <input type='hidden' name='ID' value=' $id ' />
1965 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
1972 if ( $tcsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $tcsettings { 'ID' } eq $id ) {
1973 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
1975 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
1977 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
1979 <td align='center' colspan='4'> $temp [16]
1981 <td align='center' colspan='4'>
1990 # If the time constraint file contains entries, print entries and action icons
1991 if (! - z
" $tcfile " ) {
1996 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
1997 <td> <img src='/images/urlfilter/led-green.gif' alt=' $Lang ::tr{'urlfilter allow access'}' /></td>
1998 <td class='base'> $Lang ::tr{'urlfilter allow'}</td>
1999 <td> <img src='/images/urlfilter/led-red.gif' alt=' $Lang ::tr{'urlfilter block access'}' /></td>
2000 <td class='base'> $Lang ::tr{'urlfilter block'}</td>
2001 <td> <img src='/images/on.gif' alt=' $Lang ::tr{'click to disable'}' /></td>
2002 <td class='base'> $Lang ::tr{'click to disable'}</td>
2003 <td> <img src='/images/off.gif' alt=' $Lang ::tr{'click to enable'}' /></td>
2004 <td class='base'> $Lang ::tr{'click to enable'}</td>
2005 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2006 <td class='base'> $Lang ::tr{'edit'}</td>
2007 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2008 <td class='base'> $Lang ::tr{'remove'}</td>
2015 & Header
:: closebox
();
2017 } elsif ( $uqsettings { 'UQMODE' }) {
2019 #==========================================================
2021 # Section: Set User Quota
2023 #==========================================================
2025 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
2027 $buttontext = $Lang :: tr
{ 'urlfilter add rule' };
2028 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2029 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter edit user quota rule' }. ':' );
2030 $buttontext = $Lang :: tr
{ 'urlfilter update rule' };
2032 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter add new user quota rule' }. ':' );
2036 <table width='100%'>
2038 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
2041 <td class='base'> $Lang ::tr{'urlfilter user time quota'}:</td>
2042 <td><input type='text' name='TIME_QUOTA' value=' $uqsettings {'TIME_QUOTA'}' size='5' /></td>
2043 <td colspan='2' rowspan= '5' valign='top' class='base'>
2044 <table cellpadding='0' cellspacing='0'>
2046 <!-- intentionally left empty -->
2049 <td> $Lang ::tr{'urlfilter assigned quota users'}:</td>
2052 <!-- intentionally left empty -->
2055 <!-- intentionally left empty -->
2058 <td><textarea name='QUOTA_USERS' cols='32' rows='6' wrap='off'>
2062 $uqsettings { 'QUOTA_USERS' } =~ s/\|/\n/g ;
2063 print $uqsettings { 'QUOTA_USERS' };
2072 <td class='base'> $Lang ::tr{'urlfilter activity detection'}:</td>
2073 <td class='base'><select name='SPORADIC'>
2074 <option value='0' $selected {'SPORADIC'}{'0'}> $Lang ::tr{'urlfilter disabled'}</option>
2075 <option value='300' $selected {'SPORADIC'}{'300'}>5 $Lang ::tr{'urlfilter minutes'}</option>
2076 <option value='900' $selected {'SPORADIC'}{'900'}>15 $Lang ::tr{'urlfilter minutes'}</option>
2080 <td class='base'> $Lang ::tr{'urlfilter renewal period'}:</td>
2081 <td class='base'><select name='RENEWAL'>
2082 <option value='hourly' $selected {'RENEWAL'}{'hourly'}> $Lang ::tr{'urlfilter hourly'}</option>
2083 <option value='daily' $selected {'RENEWAL'}{'daily'}> $Lang ::tr{'urlfilter daily'}</option>
2084 <option value='weekly' $selected {'RENEWAL'}{'weekly'}> $Lang ::tr{'urlfilter weekly'}</option>
2088 <td colspan='2'> </td>
2091 <td class='base'> $Lang ::tr{'urlfilter enabled'}</td>
2092 <td class='base'><input type='checkbox' name='ENABLEQUOTA' $checked {'ENABLEQUOTA'}{'on'} /></td>
2100 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2101 <td><input type='hidden' name='MODE' value='USERQUOTA' /></td>
2102 <td><input type='submit' name='SUBMIT' value=' $buttontext ' /></td>
2103 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
2105 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2113 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2114 print "<input type='hidden' name='EDITING' value=' $uqsettings {'ID'}' /> \n " ;
2116 print "<input type='hidden' name='EDITING' value='no' /> \n " ;
2119 & Header
:: closebox
();
2122 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'current rules' });
2124 <table width='100%'>
2126 <td width='15%' class='boldbase' align='center'><b><nobr> $Lang ::tr{'urlfilter time quota'}</nobr></b></td>
2127 <td width='15%' class='boldbase' align='center'><b><nobr> $Lang ::tr{'urlfilter activity detection'}</nobr></b></td>
2128 <td width='10%' class='boldbase' align='center'><b> $Lang ::tr{'urlfilter renewal'}</b></td>
2129 <td class='boldbase' align='center'><b> $Lang ::tr{'urlfilter assigned users'}</b></td>
2130 <td width='20%' class='boldbase' colspan='4' align='center'> </td>
2135 if ( $uqsettings { 'ACTION' } ne '' or $changed ne 'no' )
2137 open ( FILE
, $uqfile );
2143 foreach $line ( @uqlist )
2147 @temp = split ( /\,/ , $line );
2148 if ( $uqsettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $uqsettings { 'ID' } eq $id ) {
2149 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2151 print "<tr bgcolor=' $Header ::table1colour'> \n " ; }
2153 print "<tr bgcolor=' $Header ::table2colour'> \n " ; }
2154 if ( $temp [ 4 ] eq 'on' ) { $gif = 'on.gif' ; $toggle = 'off' ; $gdesc = $Lang :: tr
{ 'click to disable' };}
2155 else { $gif = 'off.gif' ; $toggle = 'on' ; $gdesc = $Lang :: tr
{ 'click to enable' }; }
2157 $temp [ 5 ] = $temp [ 1 ];
2158 if ( $temp [ 1 ] eq '0' ) { $temp [ 5 ] = $Lang :: tr
{ 'urlfilter disabled' } } else { $temp [ 5 ] = ( $temp [ 5 ]/ 60 ). ' ' . $Lang :: tr
{ 'urlfilter minutes' } }
2159 $_ = $temp [ 3 ]; s/\|/, /g ; $temp [ 6 ] = $_ ;
2162 <td align='center'> $temp [0] $Lang ::tr{'urlfilter minutes'}</td>
2163 <td align='center'> $temp [5]</td>
2164 <td align='center'> $Lang ::tr{'urlfilter '. $temp [2]}</td>
2165 <td align='center'> $temp [6]</td>
2168 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2169 <input type='image' name=' $Lang ::tr{'toggle enable disable'}' src='/images/ $gif ' title=' $gdesc ' alt=' $gdesc ' />
2170 <input type='hidden' name='MODE' value='USERQUOTA' />
2171 <input type='hidden' name='ID' value=' $id ' />
2172 <input type='hidden' name='ACTIVE' value=' $toggle ' />
2173 <input type='hidden' name='ACTION' value=' $Lang ::tr{'toggle enable disable'}' />
2178 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2179 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2180 <input type='hidden' name='MODE' value='USERQUOTA' />
2181 <input type='hidden' name='ID' value=' $id ' />
2182 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2187 <form method='post' name='frmc $id ' action=' $ENV {'SCRIPT_NAME'}'>
2188 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2189 <input type='hidden' name='MODE' value='USERQUOTA' />
2190 <input type='hidden' name='ID' value=' $id ' />
2191 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2202 # If the user quota file contains entries, print entries and action icons
2203 if (! - z
" $uqfile " ) {
2208 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2209 <td> <img src='/images/on.gif' alt=' $Lang ::tr{'click to disable'}' /></td>
2210 <td class='base'> $Lang ::tr{'click to disable'}</td>
2211 <td> <img src='/images/off.gif' alt=' $Lang ::tr{'click to enable'}' /></td>
2212 <td class='base'> $Lang ::tr{'click to enable'}</td>
2213 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2214 <td class='base'> $Lang ::tr{'edit'}</td>
2215 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2216 <td class='base'> $Lang ::tr{'remove'}</td>
2223 & Header
:: closebox
();
2227 #==========================================================
2229 # Section: Blacklist editor
2231 #==========================================================
2233 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype='multipart/form-data'> \n " ;
2235 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'urlfilter urlfilter blacklist editor' }. ':' );
2239 <table width='100%'>
2241 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
2244 <td class='base'><b> $Lang ::tr{'urlfilter blacklist name'}</b></td>
2247 <td class='base'> $Lang ::tr{'urlfilter blacklist category name'}:</td>
2248 <td><input type='text' name='BE_NAME' value=' $besettings {'BE_NAME'}' size='12' /></td>
2252 <table width='100%'>
2254 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='20%'></td>
2257 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter edit domains urls expressions'}</b></td>
2260 <td colspan='2'> $Lang ::tr{'urlfilter domains'}</td>
2261 <td colspan='2'> $Lang ::tr{'urlfilter urls'}</td>
2264 <td colspan='2'><textarea name='BE_DOMAINS' cols='38' rows='10' wrap='off'>
2268 print $besettings { 'BE_DOMAINS' };
2272 <td colspan='2'><textarea name='BE_URLS' cols='38' rows='10' wrap='off'>
2276 print $besettings { 'BE_URLS' };
2282 <td colspan='4'> $Lang ::tr{'urlfilter expressions'}</td>
2285 <td colspan='4'><textarea name='BE_EXPRESSIONS' cols='80' rows='3' wrap='off'>
2289 print $besettings { 'BE_EXPRESSIONS' };
2296 <table width='100%'>
2298 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter load blacklist'}</b></td>
2301 <td width='25%' class='base'> $Lang ::tr{'urlfilter select blacklist'}:</td>
2302 <td width='20%' class='base'>
2303 <select name='BE_BLACKLIST'>
2307 & readblockcategories
;
2308 foreach ( @categories )
2310 print "<option value=' $_ ' $selected {'BE_BLACKLIST'}{ $_ }> $_ </option> \n " ;
2319 <td colpsan='4'><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter load blacklist'}' /></td>
2324 <table width='100%'>
2326 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter import blacklist'}</b></td>
2329 <td colspan='4'> $Lang ::tr{'urlfilter import text'}:</td>
2332 <td nowrap><input type='file' name='IMPORTFILE' size='40' /> <input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter import blacklist'}' /></td>
2333 <td><input type='hidden' name='MODE' value='BLACKLIST_EDITOR' /></td>
2337 <table width='100%'>
2339 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter export blacklist'}</b></td>
2342 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter export blacklist'}' /></td>
2346 <table width='100%'>
2348 <td class='base' colspan='4'><b> $Lang ::tr{'urlfilter install blacklist'}</b></td>
2351 <td width='25%' class='base'> $Lang ::tr{'urlfilter dont restart urlfilter'}:</td>
2352 <td width='20%' class='base'><input type='checkbox' name='NORESTART' $checked {'NORESTART'}{'on'} /></td>
2357 <td><input type='submit' name='ACTION' value=' $Lang ::tr{'urlfilter install blacklist'}' /></td>
2360 <td class='base' colspan='4'><br> $Lang ::tr{'urlfilter install information'}</td>
2366 <td><input type='reset' name='ACTION' value=' $Lang ::tr{'urlfilter reset'}' /></td>
2368 <td><input type='button' name='return2main' value=' $Lang ::tr{'urlfilter back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2375 & Header
:: closebox
();
2380 & Header
:: closebigbox
();
2382 & Header
:: closepage
();
2384 # -------------------------------------------------------------------
2390 delete $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2391 delete $filtersettings { 'CUSTOM_BLACK_URLS' };
2392 delete $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2393 delete $filtersettings { 'CUSTOM_WHITE_URLS' };
2394 delete $filtersettings { 'CUSTOM_EXPRESSIONS' };
2395 delete $filtersettings { 'BACKGROUND' };
2396 delete $filtersettings { 'UPDATEFILE' };
2398 & General
:: writehash
( "${General::swroot}/urlfilter/settings" , \
%filtersettings );
2401 # -------------------------------------------------------------------
2403 sub readblockcategories
2406 foreach $blacklist (< $dbdir /*>) {
2407 if (- d
$blacklist ) {
2408 $lastslashpos = rindex ( $blacklist , "/" );
2409 if ( $lastslashpos > - 1 ) {
2410 $section = substr ( $blacklist , $lastslashpos + 1 );
2412 $section = $blacklist ;
2414 if (!( $section eq 'custom' )) { push ( @categories , $section ) };
2418 @filtergroups = @categories ;
2419 foreach ( @filtergroups ) {
2425 # -------------------------------------------------------------------
2429 if (- e
" $dbdir /custom/blocked/domains" ) {
2430 open ( FILE
, " $dbdir /custom/blocked/domains" );
2431 delete $filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2432 while (< FILE
>) { $filtersettings { 'CUSTOM_BLACK_DOMAINS' } .= $_ };
2436 if (- e
" $dbdir /custom/blocked/urls" ) {
2437 open ( FILE
, " $dbdir /custom/blocked/urls" );
2438 delete $filtersettings { 'CUSTOM_BLACK_URLS' };
2439 while (< FILE
>) { $filtersettings { 'CUSTOM_BLACK_URLS' } .= $_ };
2443 if (- e
" $dbdir /custom/blocked/expressions" ) {
2444 open ( FILE
, " $dbdir /custom/blocked/expressions" );
2445 delete $filtersettings { 'CUSTOM_EXPRESSIONS' };
2446 while (< FILE
>) { $filtersettings { 'CUSTOM_EXPRESSIONS' } .= $_ };
2450 if (- e
" $dbdir /custom/allowed/domains" ) {
2451 open ( FILE
, " $dbdir /custom/allowed/domains" );
2452 delete $filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2453 while (< FILE
>) { $filtersettings { 'CUSTOM_WHITE_DOMAINS' } .= $_ };
2456 if (- e
" $dbdir /custom/allowed/urls" ) {
2457 open ( FILE
, " $dbdir /custom/allowed/urls" );
2458 delete $filtersettings { 'CUSTOM_WHITE_URLS' };
2459 while (< FILE
>) { $filtersettings { 'CUSTOM_WHITE_URLS' } .= $_ };
2464 # -------------------------------------------------------------------
2466 sub aggregatedconstraints
2486 @tmp1 = split ( /\,/ , $x );
2490 @tmp2 = split ( /\,/ );
2491 if ( $tmp2 [ 15 ] eq 'on' )
2493 if (( $tmp1 [ 0 ] eq $tmp2 [ 0 ]) && ( $tmp1 [ 12 ] eq $tmp2 [ 12 ]) && ( $tmp1 [ 13 ] eq $tmp2 [ 13 ]) && ( $tmp1 [ 14 ] eq $tmp2 [ 14 ]))
2496 $tmp2 [ 16 ] .= " weekly " ;
2497 if ( $tmp1 [ 1 ] eq 'on' ) { $tmp2 [ 16 ] .= "m" ; }
2498 if ( $tmp1 [ 2 ] eq 'on' ) { $tmp2 [ 16 ] .= "t" ; }
2499 if ( $tmp1 [ 3 ] eq 'on' ) { $tmp2 [ 16 ] .= "w" ; }
2500 if ( $tmp1 [ 4 ] eq 'on' ) { $tmp2 [ 16 ] .= "h" ; }
2501 if ( $tmp1 [ 5 ] eq 'on' ) { $tmp2 [ 16 ] .= "f" ; }
2502 if ( $tmp1 [ 6 ] eq 'on' ) { $tmp2 [ 16 ] .= "a" ; }
2503 if ( $tmp1 [ 7 ] eq 'on' ) { $tmp2 [ 16 ] .= "s" ; }
2504 $tmp2 [ 16 ] .= " $tmp1 [8]: $tmp1 [9]- $tmp1 [10]: $tmp1 [11] \n " ;
2505 $_ = join ( "," , @tmp2 );
2512 $tmp1 [ 16 ] .= " weekly " ;
2513 if ( $tmp1 [ 1 ] eq 'on' ) { $tmp1 [ 16 ] .= "m" ; }
2514 if ( $tmp1 [ 2 ] eq 'on' ) { $tmp1 [ 16 ] .= "t" ; }
2515 if ( $tmp1 [ 3 ] eq 'on' ) { $tmp1 [ 16 ] .= "w" ; }
2516 if ( $tmp1 [ 4 ] eq 'on' ) { $tmp1 [ 16 ] .= "h" ; }
2517 if ( $tmp1 [ 5 ] eq 'on' ) { $tmp1 [ 16 ] .= "f" ; }
2518 if ( $tmp1 [ 6 ] eq 'on' ) { $tmp1 [ 16 ] .= "a" ; }
2519 if ( $tmp1 [ 7 ] eq 'on' ) { $tmp1 [ 16 ] .= "s" ; }
2520 $tmp1 [ 16 ] .= " $tmp1 [8]: $tmp1 [9]- $tmp1 [10]: $tmp1 [11] \n " ;
2521 $x = join ( "," , @tmp1 );
2531 # -------------------------------------------------------------------
2535 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\)\$" ;
2536 my $audiovideo = " \\ .\(aiff|asf|avi|dif|divx|mov|movie|mp3|mpe?g?|mpv2|ogg|ra?m|snd|qt|wav|wmf|wmv\)\$" ;
2537 my $archives = " \\ .\(bin|bz2|cab|cdr|dmg|gz|hqx|rar|smi|sit|sea|tar|tgz|zip\)\$" ;
2539 my $ident = " anonymous" ;
2552 if (!(- d
" $dbdir /custom" )) { mkdir ( " $dbdir /custom" ) }
2553 if (!(- d
" $dbdir /custom/blocked" )) { mkdir ( " $dbdir /custom/blocked" ) }
2554 if (!(- d
" $dbdir /custom/allowed" )) { mkdir ( " $dbdir /custom/allowed" ) }
2556 open ( FILE
, ">/ $dbdir /custom/blocked/domains" );
2557 print FILE
$filtersettings { 'CUSTOM_BLACK_DOMAINS' };
2559 open ( FILE
, ">/ $dbdir /custom/blocked/urls" );
2560 print FILE
$filtersettings { 'CUSTOM_BLACK_URLS' };
2562 open ( FILE
, ">/ $dbdir /custom/blocked/expressions" );
2563 print FILE
$filtersettings { 'CUSTOM_EXPRESSIONS' };
2565 open ( FILE
, ">/ $dbdir /custom/blocked/files" );
2566 if ( $filtersettings { 'BLOCK_EXECUTABLES' } eq 'on' ) { print FILE
" $executables \n " ; }
2567 if ( $filtersettings { 'BLOCK_AUDIO-VIDEO' } eq 'on' ) { print FILE
" $audiovideo \n " ; }
2568 if ( $filtersettings { 'BLOCK_ARCHIVES' } eq 'on' ) { print FILE
" $archives \n " ; }
2570 open ( FILE
, ">/ $dbdir /custom/allowed/domains" );
2571 print FILE
$filtersettings { 'CUSTOM_WHITE_DOMAINS' };
2573 open ( FILE
, ">/ $dbdir /custom/allowed/urls" );
2574 print FILE
$filtersettings { 'CUSTOM_WHITE_URLS' };
2577 if ( $filtersettings { 'ENABLE_USERNAME_LOG' } eq 'on' ) { $ident = "" ; }
2579 if ( $filtersettings { 'REDIRECT_PAGE' } eq '' )
2581 if (( $filtersettings { 'SHOW_CATEGORY' } eq 'on' ) || ( $filtersettings { 'SHOW_URL' } eq 'on' ) || ( $filtersettings { 'SHOW_IP' } eq 'on' )) {
2582 if ( $filtersettings { 'SHOW_CATEGORY' } eq 'on' ) { $redirect .= "&category= %t " ; }
2583 if ( $filtersettings { 'SHOW_URL' } eq 'on' ) { $redirect .= "&url= %u " ; }
2584 if ( $filtersettings { 'SHOW_IP' } eq 'on' ) { $redirect .= "&ip= %a " ; }
2585 $redirect =~ s/^&/?/ ;
2586 $redirect = "http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/redirect.cgi" . $redirect ;
2588 $redirect = "http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/redirect.cgi" ;
2590 } else { $redirect = $filtersettings { 'REDIRECT_PAGE' }; }
2592 if ( $filtersettings { 'ENABLE_DNSERROR' } eq 'on' ) { $redirect = "302:http://0.0.0.0" ; }
2596 if ( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' )
2598 $defaultrule .= "custom-allowed " ;
2600 if ( $filtersettings { 'BLOCK_ALL' } eq 'on' )
2602 $defaultrule .= "none" ;
2606 if ( $filtersettings { 'BLOCK_IP_ADDR' } eq 'on' )
2608 $defaultrule .= "!in-addr " ;
2610 for ( $i = 0 ; $i <= @filtergroups ; $i ++) {
2611 if ( $filtersettings { @filtergroups [ $i ]} eq 'on' )
2613 $defaultrule .= "! @categories [ $i ] " ;
2616 if ( $filtersettings { 'ENABLE_CUSTOM_BLACKLIST' } eq 'on' )
2618 $defaultrule .= "!custom-blocked " ;
2620 if ( $filtersettings { 'ENABLE_CUSTOM_EXPRESSIONS' } eq 'on' )
2622 $defaultrule .= "!custom-expressions " ;
2624 if (( $filtersettings { 'BLOCK_EXECUTABLES' } eq 'on' ) ||
2625 ( $filtersettings { 'BLOCK_AUDIO-VIDEO' } eq 'on' ) ||
2626 ( $filtersettings { 'BLOCK_ARCHIVES' } eq 'on' ))
2628 $defaultrule .= "!files " ;
2630 $defaultrule .= "any" ;
2633 open ( FILE
, ">${General::swroot}/urlfilter/squidGuard.conf" ) or die "Unable to write squidGuard.conf file" ;
2636 print FILE
"logdir /var/log/squidGuard \n " ;
2637 print FILE
"dbhome $dbdir \n\n " ;
2639 undef @repositoryfiles ;
2640 if ( $filtersettings { 'ENABLE_REWRITE' } eq 'on' )
2642 @repositorylist = < $repository /*>;
2643 foreach ( @repositorylist )
2645 if (!- d
) { push ( @repositoryfiles , substr ( $_ , rindex ( $_ , "/" )+ 1 )); }
2649 if ((( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles )) || ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' ))
2651 print FILE
"rewrite rew-rule-0 { \n " ;
2653 if (( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles ))
2655 print FILE
" # rewrite localfiles \n " ;
2656 foreach ( @repositoryfiles )
2658 print FILE
" s@.*/ $_ \$\ @http :// $netsettings {'GREEN_ADDRESS'}:81/repository/ $_ \ @i \n " ;
2662 if ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )
2664 print FILE
" # rewrite safesearch \n " ;
2665 print FILE
" s@(.* \\ Wgoogle \\ . \\ w+/(webhp|search|imghp|images|grphp|groups|frghp|froogle) \\ ?)(.*)( \\ bsafe= \\ w+)(.*)\@ \\ 1 \\ 3safe=strict \\ 5\ @i \n " ;
2666 print FILE
" s@(.* \\ Wgoogle \\ . \\ w+/(webhp|search|imghp|images|grphp|groups|frghp|froogle) \\ ?)(.*)\@ \\ 1safe=strict \\ \& \\ 3\ @i \n " ;
2667 print FILE
" s@(.* \\ Wsearch \\ .yahoo \\ . \\ w+/search \\ W)(.*)( \\ bvm= \\ w+)(.*)\@ \\ 1 \\ 2vm=r \\ 4\ @i \n " ;
2668 print FILE
" s@(.* \\ Wsearch \\ .yahoo \\ . \\ w+/search \\ W.*)\@ \\ 1 \\ \&vm=r\ @i \n " ;
2669 print FILE
" s@(.* \\ Walltheweb \\ .com/customize \\ ?)(.*)( \\ bcopt_offensive= \\ w+)(.*)\@ \\ 1 \\ 2copt_offensive=on \\ 4\ @i \n " ;
2674 if ((!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) && ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )) {
2675 print FILE
"rewrite rew-rule-1 { \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 " ;
2684 print FILE
" # rewrite nothing \n " ;
2706 $uq [ 0 ] = $uq [ 0 ] * 60 ;
2707 if ( $uq [ 1 ] eq '0' ) {
2708 if ( $uq [ 2 ] eq 'hourly' ) { $uq [ 1 ] = 3600 }
2709 if ( $uq [ 2 ] eq 'daily' ) { $uq [ 1 ] = 86400 }
2710 if ( $uq [ 2 ] eq 'weekly' ) { $uq [ 1 ] = 604800 }
2713 print FILE
"src quota- $idx { \n " ;
2714 print FILE
" user $uq [3] \n " ;
2715 print FILE
" userquota $uq [0] $uq [1] $uq [2] \n " ;
2723 @tclist = & aggregatedconstraints
;
2732 if ( $tc [ 15 ] eq 'on' )
2735 print FILE
"src network- $idx { \n " ;
2736 print FILE
" ip $tc [12] \n " ;
2746 if ( $tc [ 15 ] eq 'on' )
2749 print FILE
"time constraint- $idx { \n " ;
2750 print FILE
" $tc [16] \n " ;
2756 if (!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) {
2757 print FILE
"src unfiltered { \n " ;
2758 print FILE
" ip $filtersettings {'UNFILTERED_CLIENTS'} \n " ;
2761 if (!( $filtersettings { 'BANNED_CLIENTS' } eq '' )) {
2762 print FILE
"src banned { \n " ;
2763 print FILE
" ip $filtersettings {'BANNED_CLIENTS'} \n " ;
2767 foreach $category ( @categories ) {
2768 print FILE
"dest $category { \n " ;
2769 if (- e
" $dbdir / $category /domains" ) {
2770 print FILE
" domainlist $category \/domains \n " ;
2772 if (- e
" $dbdir / $category /urls" ) {
2773 print FILE
" urllist $category \/urls \n " ;
2775 if ((- e
" $dbdir / $category /expressions" ) && ( $filtersettings { 'ENABLE_EXPR_LISTS' } eq 'on' )) {
2776 print FILE
" expressionlist $category \/expressions \n " ;
2778 if (( $category eq 'ads' ) && ( $filtersettings { 'ENABLE_EMPTY_ADS' } eq 'on' ))
2780 print FILE
" redirect http:\/\/ $netsettings {'GREEN_ADDRESS'}:81\/images/urlfilter/1x1.gif \n " ;
2782 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2784 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2786 print FILE
" logfile $ident $category .log \n " ;
2788 print FILE
" logfile $ident urlfilter.log \n " ;
2794 print FILE
"dest files { \n " ;
2795 print FILE
" expressionlist custom\/blocked\/files \n " ;
2796 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2798 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2800 print FILE
" logfile $ident files.log \n " ;
2802 print FILE
" logfile $ident urlfilter.log \n " ;
2807 print FILE
"dest custom-allowed { \n " ;
2808 print FILE
" domainlist custom\/allowed\/domains \n " ;
2809 print FILE
" urllist custom\/allowed\/urls \n " ;
2812 print FILE
"dest custom-blocked { \n " ;
2813 print FILE
" domainlist custom\/blocked\/domains \n " ;
2814 print FILE
" urllist custom\/blocked\/urls \n " ;
2815 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2817 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2819 print FILE
" logfile $ident custom.log \n " ;
2821 print FILE
" logfile $ident urlfilter.log \n " ;
2826 print FILE
"dest custom-expressions { \n " ;
2827 print FILE
" expressionlist custom\/blocked\/expressions \n " ;
2828 if ( $filtersettings { 'ENABLE_LOG' } eq 'on' )
2830 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2832 print FILE
" logfile $ident custom.log \n " ;
2834 print FILE
" logfile $ident urlfilter.log \n " ;
2839 print FILE
"acl { \n " ;
2840 if (!( $filtersettings { 'UNFILTERED_CLIENTS' } eq '' )) {
2841 print FILE
" unfiltered { \n " ;
2842 print FILE
" pass all \n " ;
2843 if ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' )
2845 print FILE
" rewrite rew-rule-1 \n " ;
2847 print FILE
" } \n\n " ;
2849 if (!( $filtersettings { 'BANNED_CLIENTS' } eq '' )) {
2850 print FILE
" banned { \n " ;
2851 print FILE
" pass " ;
2852 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2854 print FILE
"custom-allowed " ;
2856 print FILE
"none \n " ;
2857 print FILE
" } \n\n " ;
2874 $qredirect = $redirect ;
2875 $qredirect =~ s/\%t/\%q\%20-\%20\%i/ ;
2876 print FILE
" quota- $idx { \n " ;
2877 print FILE
" pass " ;
2878 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2880 print FILE
"custom-allowed " ;
2882 print FILE
"none \n " ;
2883 unless ( $redirect eq $qredirect ) { print FILE
" redirect $qredirect \n " ; }
2884 print FILE
" } \n\n " ;
2896 @ec = split ( /\|/ , $tc [ 13 ]);
2897 if ( $tc [ 15 ] eq 'on' )
2900 print FILE
" network- $idx $tc [0] constraint- $idx { \n " ;
2901 print FILE
" pass " ;
2903 if ( $filtersettings { 'BLOCK_ALL' } eq 'on' )
2905 if ( $tc [ 14 ] eq 'block' )
2907 if (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' )) {
2908 if (( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'on' ))
2910 print FILE
"custom-allowed " ;
2914 print FILE
$defaultrule ;
2921 print FILE
$defaultrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2924 if ( $tc [ 14 ] eq 'block' )
2926 $tcrule = $defaultrule ;
2927 if ( $filtersettings { 'ENABLE_CUSTOM_WHITELIST' } eq 'on' ) {
2928 $tcrule =~ s/custom-allowed // ;
2929 print FILE
"custom-allowed " unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ) && ( $filtersettings { 'ENABLE_GLOBAL_WHITELIST' } eq 'off' ));
2931 if (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' )) {
2936 print FILE
"! $_ " unless ( index ( $defaultrule , "!" . $_ . " " ) ge 0 );
2939 print FILE
$tcrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2941 $tcrule = $defaultrule ;
2944 $tcrule =~ s/!$_ // ;
2945 print FILE
" $_ " if ( $_ eq 'any' );
2947 print FILE
$tcrule unless (( @ec == 1 ) && ( $ec [ 0 ] eq 'any' ));
2953 print FILE
" } \n\n " ;
2958 print FILE
" default { \n " ;
2959 print FILE
" pass $defaultrule \n " ;
2960 if (( $filtersettings { 'ENABLE_LOG' } eq 'on' ) && ( $filtersettings { 'BLOCK_ALL' } eq 'on' ))
2962 if ( $filtersettings { 'ENABLE_CATEGORY_LOG' } eq 'on' )
2964 print FILE
" logfile" . $ident . " default.log \n " ;
2966 print FILE
" logfile" . $ident . " urlfilter.log \n " ;
2969 if ((( $filtersettings { 'ENABLE_REWRITE' } eq 'on' ) && ( @repositoryfiles )) || ( $filtersettings { 'ENABLE_SAFESEARCH' } eq 'on' ))
2971 print FILE
" rewrite rew-rule-0 \n " ;
2973 print FILE
" redirect $redirect \n " ;
2980 # -------------------------------------------------------------------