X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Furlfilter.cgi;h=6e99397ec0c40ce40c0375d7b7b2e95b69d155a5;hb=63043a1b44d360006cae4d4311506b972b63f2b7;hp=23410835dc7c5e3aa391604136d56236200fa23a;hpb=75a16ec4855e6bf780e7f39d4a4c75ed2fbf544a;p=ipfire-2.x.git diff --git a/html/cgi-bin/urlfilter.cgi b/html/cgi-bin/urlfilter.cgi index 23410835dc..6e99397ec0 100644 --- a/html/cgi-bin/urlfilter.cgi +++ b/html/cgi-bin/urlfilter.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # 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 # @@ -59,7 +59,7 @@ my $tcfile = "${General::swroot}/urlfilter/timeconst"; 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"; @@ -353,15 +353,6 @@ if (($filtersettings{'ACTION'} eq $Lang::tr{'save'}) || $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'); } } @@ -1452,12 +1443,6 @@ print <$Lang::tr{'urlfilter msg text 3'}: * - - $Lang::tr{'urlfilter enable jpeg'}: - -   -   -
@@ -2542,6 +2527,13 @@ sub savesettings 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); } @@ -2558,7 +2550,7 @@ sub readblockcategories @filtergroups = @categories; foreach (@filtergroups) { - s/\//_SLASH_/g; + s/\//_/g; tr/a-z/A-Z/; $_ = "FILTER_".$_; } @@ -2981,7 +2973,24 @@ sub writeconfigfile 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";