]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/proxy.cgi
Change redirector children settings to proxy cgi
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / proxy.cgi
index d7827c486958f1e191c633d9affd61a4c5550b50..e349dfd1428c55a5fd3a5c494a24d3eadae361c9 100644 (file)
@@ -1,17 +1,29 @@
 #!/usr/bin/perl
-#
-# (c) 2004-2007 marco.s - http://www.advproxy.net
-#
-# This code is distributed under the terms of the GPL
-#
-# $Id: advproxy.cgi,v 2.1.0 2007/03/06 00:00:00 marco.s Exp $
-#
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  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        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 use strict;
 
 # enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
 
 require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
@@ -21,6 +33,11 @@ my @squidversion = `/usr/sbin/squid -v`;
 my $http_port='81';
 my $https_port='444';
 
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
 my %proxysettings=();
 my %netsettings=();
 my %filtersettings=();
@@ -85,7 +102,7 @@ my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors";
 
 my $identhosts = "$identdir/hosts";
 
-my $authdir  = "/usr/lib/squid/auth";
+my $authdir  = "/usr/lib/squid/";
 my $errordir = "/usr/lib/squid/errors";
 
 my $acl_src_subnets = "$acldir/src_subnets.acl";
@@ -144,16 +161,6 @@ close(FILE);
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 
-$filtersettings{'CHILDREN'} = '5';
-if (-e "${General::swroot}/urlfilter/settings") {
-       &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings);
-}
-
-$xlratorsettings{'CHILDREN'} = '5';
-if (-e "${General::swroot}/updatexlrator/settings") {
-       &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
-}
-
 &Header::showhttpheaders();
 
 $proxysettings{'ACTION'} = '';
@@ -166,8 +173,8 @@ $proxysettings{'TRANSPARENT_BLUE'} = 'off';
 $proxysettings{'PROXY_PORT'} = '800';
 $proxysettings{'VISIBLE_HOSTNAME'} = '';
 $proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
-$proxysettings{'ERR_LANGUAGE'} = 'English';
-$proxysettings{'ERR_DESIGN'} = 'IPCop';
+$proxysettings{'ERR_LANGUAGE'} = 'German';
+$proxysettings{'ERR_DESIGN'} = 'ipfire';
 $proxysettings{'SUPPRESS_VERSION'} = 'off';
 $proxysettings{'FORWARD_VIA'} = 'off';
 $proxysettings{'FORWARD_IPADDRESS'} = 'off';
@@ -245,6 +252,8 @@ $proxysettings{'IDENT_ENABLE_ACL'} = 'off';
 $proxysettings{'IDENT_USER_ACL'} = 'positive';
 $proxysettings{'ENABLE_FILTER'} = 'off';
 $proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
+$proxysettings{'ENABLE_CLAMAV'} = 'off';
+$proxysettings{'CHILDREN'} = '5';
 
 $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
 
@@ -359,6 +368,11 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
        {
                $errormessage = $Lang::tr{'invalid maximum incoming size'};
                goto ERROR;
+       }
+               if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1))
+       {
+               $errormessage = $Lang::tr{'advproxy invalid num of children'};
+               goto ERROR;
        }
        if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on')
        {
@@ -367,7 +381,7 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
                {
                        chomp;
                        @useragent = split(/,/);
-                       if ($proxysettings{'UA_'.@useragent[0]} eq 'on') { $browser_regexp .= "@useragent[2]|"; }
+                       if ($proxysettings{'UA_'.$useragent[0]} eq 'on') { $browser_regexp .= "$useragent[2]|"; }
                }
                chop($browser_regexp);
                if (!$browser_regexp)
@@ -576,32 +590,36 @@ ERROR:
                $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'};
                $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'};
                $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'};
+               $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'};
                &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings);
 
                &writeconfig;
                &writepacfile;
 
+               system ('/usr/local/bin/squidctrl', 'disable');
                unlink "${General::swroot}/proxy/enable";
                unlink "${General::swroot}/proxy/transparent";
                unlink "${General::swroot}/proxy/enable_blue";
                unlink "${General::swroot}/proxy/transparent_blue";
 
                if ($proxysettings{'ENABLE'} eq 'on') {
-                       system ('/usr/bin/touch', "${General::swroot}/proxy/enable"); }
-               if ($proxysettings{'TRANSPARENT'} eq 'on') {
+                       system ('/usr/bin/touch', "${General::swroot}/proxy/enable");
+                       system ('/usr/local/bin/squidctrl', 'enable'); }
+               if ($proxysettings{'TRANSPARENT'} eq 'on' && $proxysettings{'ENABLE'} eq 'on') {
                        system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); }
                if ($proxysettings{'ENABLE_BLUE'} eq 'on') {
-                       system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue"); }
-               if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') {
+                       system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue");
+                       system ('/usr/local/bin/squidctrl', 'enable'); }
+               if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on' && $proxysettings{'ENABLE_BLUE'} eq 'on') {
                        system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
 
-               if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/restartsquid'); }
+               if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); }
        }
 }
 
 if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'})
 {
-       system('/usr/local/bin/restartsquid','-f');
+       system('/usr/local/bin/squidctrl flush >/dev/null 2>&1');
 }
 
 if (!$errormessage)
@@ -739,9 +757,9 @@ $checked{'ENABLE_BROWSER_CHECK'}{$proxysettings{'ENABLE_BROWSER_CHECK'}} = "chec
 
 foreach (@useragentlist) {
        @useragent = split(/,/);
-       $checked{'UA_'.@useragent[0]}{'off'} = '';
-       $checked{'UA_'.@useragent[0]}{'on'} = '';
-       $checked{'UA_'.@useragent[0]}{$proxysettings{'UA_'.@useragent[0]}} = "checked='checked'";
+       $checked{'UA_'.$useragent[0]}{'off'} = '';
+       $checked{'UA_'.$useragent[0]}{'on'} = '';
+       $checked{'UA_'.$useragent[0]}{$proxysettings{'UA_'.$useragent[0]}} = "checked='checked'";
 }
 
 $checked{'AUTH_METHOD'}{'none'} = '';
@@ -808,6 +826,10 @@ $checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
 $checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
 $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
 
+$checked{'ENABLE_CLAMAV'}{'off'} = '';
+$checked{'ENABLE_CLAMAV'}{'on'} = '';
+$checked{'ENABLE_CLAMAV'}{$proxysettings{'ENABLE_CLAMAV'}} = "checked='checked'";
+
 &Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, '');
 
 &Header::openbigbox('100%', 'left', '', $errormessage);
@@ -897,7 +919,7 @@ print <<END
        <td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td>
        <td class='base'>$Lang::tr{'advproxy error design'}:</td>
        <td class='base'><select name='ERR_DESIGN'>
-               <option value='ipcop' $selected{'ERR_DESIGN'}{'ipcop'}>IPCop</option>
+               <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option>
                <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option>
        </select></td>
 </tr>
@@ -910,32 +932,40 @@ print <<END
 </table>
 <hr size='1'>
 <table width='100%'>
+<tr><td class='base' width='50%' ><b>$Lang::tr{'advproxy redirector children'}</b><input type='text' name='CHILDREN' value='$proxysettings{'CHILDREN'}' size='5' /></td>
+END
+;
+if ( -e "/usr/bin/squidclamav" ) {
+        print "<td class='base' width='33%'><b>$Lang::tr{'advproxy squidclamav'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_CLAMAV' $checked{'ENABLE_CLAMAV'}{'on'} /></td></tr>";
+}
+else
+{
+        print "<td class='base' width='33%'></td></tr>";
+}
+print <<END
+</tr>
+<tr><td class='base' width='50%'><b>$Lang::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
+<td class='base' width='50%'><b>$Lang::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td></tr>
+</table>
+<hr size='1'>
+<table width='100%'>
 <tr>
        <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td>
 </tr>
 <tr>
-       <td width='25%' class='base'>$Lang::tr{'advproxy via forwarding'}:</td>
-       <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
-       <td width='25%' class='base'>$Lang::tr{'advproxy upstream proxy host:port'}&nbsp;<img src='/blob.gif' alt='*' /></td>
-       <td width='30%'><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td>
+       <td class='base'>$Lang::tr{'advproxy via forwarding'}:</td><td><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
+       <td class='base'>$Lang::tr{'advproxy upstream proxy host:port'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td>
 </tr>
 <tr>
-       <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td>
-       <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
-       <td class='base'>$Lang::tr{'advproxy upstream username'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
-       <td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td>
+       <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td><td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
+       <td class='base'>$Lang::tr{'advproxy upstream username'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td>
 </tr>
 <tr>
-       <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td>
-       <td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /></td>
-       <td class='base'>$Lang::tr{'advproxy upstream password'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
-       <td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td>
+       <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td><td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} />
+  <td class='base'>$Lang::tr{'advproxy upstream password'}:<img src='/blob.gif' alt='*' /></td><td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td>
 </tr>
 <tr>
-       <td class='base'>$Lang::tr{'advproxy no connection auth'}:</td>
-       <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
-       <td>&nbsp;</td>
-       <td>&nbsp;</td>
+       <td class='base' colspan='4'>$Lang::tr{'advproxy no connection auth'}:<input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
 </tr>
 </table>
 <hr size='1'>
@@ -944,16 +974,9 @@ print <<END
        <td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td>
 </tr>
 <tr>
-       <td width='25%' class='base'>$Lang::tr{'advproxy log enabled'}:</td>
-       <td width='20%'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
-       <td width='25%'class='base'>$Lang::tr{'advproxy log query'}:</td>
-       <td width='30%'><input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
-</tr>
-<tr>
-       <td>&nbsp;</td>
-       <td>&nbsp;</td>
-       <td class='base'>$Lang::tr{'advproxy log useragent'}:</td>
-       <td><input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
+       <td class='base'>$Lang::tr{'advproxy log enabled'}:<input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
+       <td class='base'>$Lang::tr{'advproxy log query'}:<input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
+       <td class='base'>$Lang::tr{'advproxy log useragent'}:<input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
 </tr>
 </table>
 <hr size='1'>
@@ -962,7 +985,7 @@ print <<END
        <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td>
 </tr>
 <tr>
-       <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
+       <td width='35%'></td><td width='15%'></td><td width='35%'></td><td width='15%'></td>
 </tr>
 <tr>
        <td class='base'>$Lang::tr{'advproxy ram cache size'}:</td>
@@ -1000,7 +1023,7 @@ print <<END
                                <!-- intentionally left empty -->
                        </tr>
                        <tr>
-                       <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
+                       <td align=center><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
 END
 ;
 
@@ -1044,7 +1067,7 @@ print <<END
        <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
 </tr>
 <tr>
-       <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
+       <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
 </tr>
 <tr>
        <td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td>
@@ -1079,7 +1102,7 @@ print <<END
        <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td>
 </tr>
 <tr>
-       <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='6' wrap='off'>
+       <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
 END
 ;
 
@@ -1133,7 +1156,7 @@ print <<END
        <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
 </tr>
 <tr>
-       <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='6' wrap='off'>
+       <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
 END
 ;
 
@@ -1141,7 +1164,7 @@ END
 
 print <<END
 </textarea></td>
-       <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='6' wrap='off'>
+       <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
 END
 ;
 
@@ -1160,7 +1183,7 @@ print <<END
        <td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
 </tr>
 <tr>
-       <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='6' wrap='off'>
+       <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
 END
 ;
 
@@ -1168,7 +1191,7 @@ END
 
 print <<END
 </textarea></td>
-       <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='6' wrap='off'>
+       <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
 END
 ;
 
@@ -1191,21 +1214,29 @@ if (-e $cre_enabled) { print <<END
 <table width='100%'>
 
 <tr>
-       <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b></td>
+       <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td>
 </tr>
 <tr>
        <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
 </tr>
 <tr>
-       <td class='base'>$Lang::tr{'advproxy enabled'}:</td>
-       <td><input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td>
+
+END
+;
+if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
+print <<END
        <td class='base'>$Lang::tr{'advproxy supervisor password'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
        <td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td>
 </tr>
 <tr>
        <td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td>
        <td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
-</tr>
+END
+;
+}
+print "</tr>";
+if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
+print <<END
 <tr>
        <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
 END
@@ -1223,12 +1254,11 @@ END
 print <<END
 </textarea></td>
 </tr>
-
-</table>
-
-<hr size='1'>
 END
 ;
+}
+print "</table><hr size='1'>";
+
 } else {
        print <<END
        <input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' />
@@ -1434,12 +1464,12 @@ print <<END
 <hr size='1'>
 <table width='100%'>
 <tr>
-       <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b></td>
-</tr>
-<tr>
-       <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
-       <td width='20%'><input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td>
+       <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td>
 </tr>
+END
+;
+if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){
+print <<END
 <tr>
        <td  colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
        <td>&nbsp;</td>
@@ -1457,18 +1487,21 @@ print <<END
        <td>&nbsp;</td>
        <td>&nbsp;</td>
 </tr>
+END
+;
+}
+print <<END
 </table>
+
 <hr size='1'>
 <table width='100%'>
 <tr>
-       <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b></td>
-</tr>
-<tr>
-       <td width='25%' class='base'>$Lang::tr{'advproxy UA enable filter'}:</td>
-       <td width='20%'><input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
-       <td>&nbsp;</td>
-       <td>&nbsp;</td>
+       <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
 </tr>
+END
+;
+if ( $proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on' ){
+print <<END
 <tr>
        <td colspan='4'><i>
 END
@@ -1487,13 +1520,13 @@ for ($n=0; $n<=@useragentlist; $n = $n + $i) {
                if ($i eq 0) { print "<tr>\n"; }
                if (($n+$i) < @useragentlist) {
                        @useragent = split(/,/,@useragentlist[$n+$i]);
-                       print "<td width='15%'>@useragent[1]:<\/td>\n";
-                       print "<td width='10%'><input type='checkbox' name='UA_@useragent[0]' $checked{'UA_'.@useragent[0]}{'on'} /></td>\n";
+                       print "<td width='15%'>$useragent[1]:<\/td>\n";
+                       print "<td width='10%'><input type='checkbox' name='UA_$useragent[0]' $checked{'UA_'.$useragent[0]}{'on'} /></td>\n";
                }
                if ($i eq 3) { print "<\/tr>\n"; }
        }
 }
-
+}
 print <<END
 </table>
 <hr size='1'>
@@ -1503,14 +1536,10 @@ print <<END
 </tr>
 <tr>
        <td class='base'>$Lang::tr{'advproxy fake useragent'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
-</tr>
-<tr>
-       <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
-</tr>
-<tr>
        <td class='base'>$Lang::tr{'advproxy fake referer'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
 </tr>
 <tr>
+       <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
        <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td>
 </tr>
 </table>
@@ -1519,32 +1548,6 @@ END
 ;
 
 print <<END
-<table width='100%'>
-<tr>
-       <td class='base' colspan='4'><b>$Lang::tr{'advproxy url filter'}</b></td>
-</tr>
-<tr>
-       <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
-       <td class='base' width='20%'><input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
-       <td>&nbsp;</td>
-       <td>&nbsp;</td>
-</tr>
-</table>
-<hr size='1'>
-
-<table width='100%'>
-<tr>
-       <td class='base' colspan='4'><b>$Lang::tr{'advproxy update accelerator'}</b></td>
-</tr>
-<tr>
-       <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
-       <td class='base' width='20%'><input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>
-       <td>&nbsp;</td>
-       <td>&nbsp;</td>
-</tr>
-</table>
-<hr size='1'>
-
 <table width='100%'>
 <tr>
        <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td>
@@ -2163,7 +2166,7 @@ if (-e $disgrp)
 
 # If the password file contains entries, print entries and action icons
 
-if (! -z "$userdb") {
+if ( $userdb ne "" ) {
        print <<END
        <tr>
                <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td>
@@ -2181,9 +2184,9 @@ END
                if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) {
                        print "<tr bgcolor='$Header::colouryellow'>\n"; }
                elsif ($id % 2) {
-                       print "<tr bgcolor='$Header::table1colour'>\n"; }
+                       print "<tr bgcolor='$color{'color20'}'>\n"; }
                else {
-                       print "<tr bgcolor='$Header::table2colour'>\n"; }
+                       print "<tr bgcolor='$color{'color22'}'>\n"; }
 
                print <<END
                <td align='center'>$temp[0]</td>
@@ -2730,7 +2733,7 @@ sub write_acls
 
 sub writepacfile
 {
-       open(FILE, ">/home/httpd/html/proxy.pac");
+       open(FILE, ">/srv/web/ipfire/html/proxy.pac");
        flock(FILE, 2);
        print FILE "function FindProxyForURL(url, host)\n";
        print FILE "{\n";
@@ -2753,9 +2756,34 @@ END
 ;
                if ($proxysettings{'ENABLE'} eq 'on')
                {
+                       print FILE "if (\n";
+                       print FILE "     (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))";
+
+                       undef @templist;
+                       if (-e "$acl_src_subnets") {
+                               open(SUBNETS,"$acl_src_subnets");
+                               @templist = <SUBNETS>;
+                               close(SUBNETS);
+                       }
+
+                       foreach (@templist)
+                       {
+                               @temp = split(/\//);
+                               if (
+                                       ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) && 
+                                       ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'})
+                                       )
+                               {
+                                       chomp $temp[1];
+                                       print FILE " ||\n     (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))";
+                               }
+                       }
+
+                       print FILE "\n";
+
                        print FILE <<END
-if (
-     (isInNet(myIpAddress(), "$netsettings{'GREEN_NETADDRESS'}", "$netsettings{'GREEN_NETMASK'}"))
+
+
    )
      return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
 END
@@ -2797,7 +2825,7 @@ sub writeconfig
 
        if ($proxysettings{'AUTH_REALM'} eq '')
        {
-               $authrealm = "IPCop Advanced Proxy Server";
+               $authrealm = "IPFire Advanced Proxy Server";
        } else {
                $authrealm = $proxysettings{'AUTH_REALM'};
        }
@@ -2860,9 +2888,9 @@ cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DI
 END
        ;
 
-       if (($proxysettings{'ERR_DESIGN'} eq 'ipcop') && ($proxysettings{'VISIBLE_HOSTNAME'} eq ''))
+       if (($proxysettings{'ERR_DESIGN'} eq 'ipfire' ))
        {
-               print FILE "error_directory $errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}\n\n";
+               print FILE "error_directory $errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}\n\n";
        } else {
                print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n";
        }
@@ -3147,7 +3175,7 @@ acl IPCop_no_access_mac arp "$acl_src_noaccess_mac"
 END
                ;
                print FILE "deny_info ";
-               if ((($proxysettings{'ERR_DESIGN'} eq 'ipcop') && (-e "$errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
+               if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
                    (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")))
                {
                        print FILE "ERR_ACCESS_DISABLED";
@@ -3156,7 +3184,7 @@ END
                }
                print FILE " IPCop_no_access_ips\n";
                print FILE "deny_info ";
-               if ((($proxysettings{'ERR_DESIGN'} eq 'ipcop') && (-e "$errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
+               if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
                    (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")))
                {
                        print FILE "ERR_ACCESS_DISABLED";
@@ -3653,36 +3681,10 @@ END
 
                print FILE "\nnever_direct allow all\n\n";
        }
-       if (($proxysettings{'ENABLE_FILTER'} eq 'on') && ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
+       if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on'))
        {
                print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n";
-               if ($filtersettings{'CHILDREN'} > $xlratorsettings{'CHILDREN'})
-               {
-                       print FILE "url_rewrite_children $filtersettings{'CHILDREN'}\n\n";
-               } else {
-                       print FILE "url_rewrite_children $xlratorsettings{'CHILDREN'}\n\n";
-               }
-       } else
-       {
-
-               if ($proxysettings{'ENABLE_FILTER'} eq 'on')
-               {
-                       print FILE <<END
-url_rewrite_program /usr/bin/squidGuard
-url_rewrite_children $filtersettings{'CHILDREN'}
-
-END
-                       ;
-               }
-               if ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')
-               {
-                       print FILE <<END
-url_rewrite_program /usr/sbin/updxlrator
-url_rewrite_children $xlratorsettings{'CHILDREN'}
-
-END
-                       ;
-               }
+               print FILE "url_rewrite_children $proxysettings{'CHILDREN'}\n\n";
        }
        close FILE;
 }
@@ -3707,7 +3709,7 @@ sub adduser
                close(FILE);
        } else {
                &deluser($str_user);
-               system("/usr/bin/htpasswd -b $userdb $str_user $str_pass");
+               system("/usr/sbin/htpasswd -b $userdb $str_user $str_pass");
        }
 
        if ($str_group eq 'standard') { open(FILE, ">>$stdgrp");