###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
my $uqfile = "${General::swroot}/urlfilter/userquota";
my $dbdir = "${General::swroot}/urlfilter/blacklists";
my $editdir = "${General::swroot}/urlfilter/editor";
-my $repository = "/home/httpd/html/repository";
+my $repository = "/var/urlrepo";
my $hintcolour = '#FFFFCC';
my $sourceurlfile = "${General::swroot}/urlfilter/autoupdate/autoupdate.urls";
$filtersettings{'ENABLE_LOG'} = 'off';
$filtersettings{'ENABLE_USERNAME_LOG'} = 'off';
$filtersettings{'ENABLE_CATEGORY_LOG'} = 'off';
-$filtersettings{'CHILDREN'} = '5';
$filtersettings{'ENABLE_AUTOUPDATE'} = 'off';
$filtersettings{'ACTION'} = '';
}
if ($errormessage) { goto ERROR; }
- if (!($filtersettings{'CHILDREN'} =~ /^\d+$/) || ($filtersettings{'CHILDREN'} < 1))
- {
- $errormessage = $Lang::tr{'urlfilter invalid num of children'};
- goto ERROR;
- }
-
if ((!($filtersettings{'REDIRECT_PAGE'} eq '')) && (!($filtersettings{'REDIRECT_PAGE'} =~ /^https?:\/\//)))
{
$filtersettings{'REDIRECT_PAGE'} = "http://".$filtersettings{'REDIRECT_PAGE'};
$filtersettings{'VALID'} = 'yes';
&savesettings;
- system("chown -R nobody.nobody $dbdir");
-
- if (-e "$dbdir/custom/allowed/domains.db") { unlink("$dbdir/custom/allowed/domains.db"); }
- if (-e "$dbdir/custom/allowed/urls.db") { unlink("$dbdir/custom/allowed/urls.db"); }
- if (-e "$dbdir/custom/blocked/domains.db") { unlink("$dbdir/custom/blocked/domains.db"); }
- if (-e "$dbdir/custom/blocked/urls.db") { unlink("$dbdir/custom/blocked/urls.db"); }
-
- &setpermissions ($dbdir);
-
system('/usr/local/bin/squidctrl restart >/dev/null 2>&1');
}
}
<td class='base'>$Lang::tr{'urlfilter msg text 3'}: <img src='/blob.gif' alt='*' /></td>
<td><input type='text' name='MSG_TEXT_3' value='$filtersettings{'MSG_TEXT_3'}' size='40' /></td>
</tr>
-<tr>
- <td class='base'>$Lang::tr{'urlfilter enable jpeg'}:</td>
- <td><input type='checkbox' name='ENABLE_JPEG' $checked{'ENABLE_JPEG'}{'on'} /></td>
- <td> </td>
- <td> </td>
-</tr>
</table>
<hr size='1'>
<table width='100%'>
<tr>
<td class='base'>$Lang::tr{'urlfilter block ip'}:</td>
<td><input type='checkbox' name='BLOCK_IP_ADDR' $checked{'BLOCK_IP_ADDR'}{'on'} /></td>
- <td class='base'>$Lang::tr{'urlfilter children'}:</td>
- <td><input type='text' name='CHILDREN' value='$filtersettings{'CHILDREN'}' size='5' /></td>
</tr>
<tr>
<td class='base'>$Lang::tr{'urlfilter block all'}:</td>
delete $filtersettings{'BACKGROUND'};
delete $filtersettings{'UPDATEFILE'};
+ system("chown -R nobody.nobody $dbdir");
+ system('/usr/bin/squidGuard -C custom/allowed/domains >/dev/null 2>&1');
+ system('/usr/bin/squidGuard -C custom/allowed/urls >/dev/null 2>&1');
+ system('/usr/bin/squidGuard -C custom/blocked/domains >/dev/null 2>&1');
+ system('/usr/bin/squidGuard -C custom/blocked/urls >/dev/null 2>&1 ');
+ &setpermissions ($dbdir);
+
&General::writehash("${General::swroot}/urlfilter/settings", \%filtersettings);
}
@filtergroups = @categories;
foreach (@filtergroups) {
- s/\//_SLASH_/g;
+ s/\//_/g;
tr/a-z/A-Z/;
$_ = "FILTER_".$_;
}
foreach $category (@categories) {
$blacklist = $category;
$category =~ s/\//_/g;
- if ( $filtersettings{"FILTER_".uc($category)} ne "on" ){next;}
+
+ if ( $filtersettings{"FILTER_".uc($category)} ne "on" ){
+ my $constraintrule = "false";
+
+ foreach (@tclist){
+ chomp;
+ @tc = split(/\,/);
+ $tc[13] =~ s/\//_/g;
+ if ($tc[15] eq 'on' && $tc[13] =~ $category){
+ $constraintrule = "true";
+ }
+ }
+
+ if ( $constraintrule eq "false"){
+ next;
+ }
+ }
+
print FILE "dest $category {\n";
if (-e "$dbdir/$blacklist/domains") {
print FILE " domainlist $blacklist\/domains\n";