diff --git a/squid/http_access.cgi b/squid/http_access.cgi index a5d0271e9..fabfa2548 100755 --- a/squid/http_access.cgi +++ b/squid/http_access.cgi @@ -2,11 +2,15 @@ # http_access.cgi # A form for editing or creating a proxy access restriction +use strict; +use warnings; +our (%text, %in, %access, $squid_version, %config); require './squid-lib.pl'; $access{'actrl'} || &error($text{'eacl_ecannot'}); &ReadParse(); -$conf = &get_config(); +my $conf = &get_config(); +my @http; if (!defined($in{'index'})) { &ui_print_header(undef, $text{'ahttp_header'}, "", undef, 0, 0, 0, &restart_button()); @@ -17,49 +21,45 @@ else { @http = @{$conf->[$in{'index'}]->{'values'}}; } -print "
\n"; +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'buttsave'} ], + @http ? ( [ 'delete', $text{'buttdel'} ] ) : ( ) ]); &ui_print_footer("edit_acl.cgi?mode=http", $text{'ahttp_return'}, "", $text{'index_return'}); diff --git a/squid/http_access_save.cgi b/squid/http_access_save.cgi index 0e8c00010..a58502dec 100755 --- a/squid/http_access_save.cgi +++ b/squid/http_access_save.cgi @@ -2,14 +2,18 @@ # http_access_save.cgi # Save or delete a proxy restriction +use strict; +use warnings; +our (%text, %in, %access, $squid_version, %config); require './squid-lib.pl'; $access{'actrl'} || &error($text{'eacl_ecannot'}); &ReadParse(); &lock_file($config{'squid_conf'}); -$conf = &get_config(); -$whatfailed = $text{'sahttp_ftspr'}; +my $conf = &get_config(); +&error_setup($text{'sahttp_ftspr'}); -@https = &find_config("http_access", $conf); +my @https = &find_config("http_access", $conf); +my ($http, %used); if (defined($in{'index'})) { $http = $conf->[$in{'index'}]; } @@ -19,23 +23,23 @@ if ($in{'delete'}) { } else { # update or create - @vals = ( $in{'action'} ); - foreach $y (split(/\0/, $in{'yes'})) { + my @vals = ( $in{'action'} ); + foreach my $y (split(/\0/, $in{'yes'})) { push(@vals, $y); $used{$y}++; } - foreach $n (split(/\0/, $in{'no'})) { + foreach my $n (split(/\0/, $in{'no'})) { push(@vals, "!$n"); $used{$n}++; } - $newhttp = { 'name' => 'http_access', 'values' => \@vals }; + my $newhttp = { 'name' => 'http_access', 'values' => \@vals }; if ($http) { splice(@https, &indexof($http, @https), 1, $newhttp); } else { push(@https, $newhttp); } } # Find the last referenced ACL -@acls = grep { $used{$_->{'values'}->[0]} } &find_config("acl", $conf); -$lastacl = @acls ? $acls[$#acls] : undef; +my @acls = grep { $used{$_->{'values'}->[0]} } &find_config("acl", $conf); +my $lastacl = @acls ? $acls[$#acls] : undef; &save_directive($conf, "http_access", \@https, $lastacl); &flush_file_lines();