3 # Save or delete a proxy restriction
5 require './squid-lib.pl';
6 $access{'actrl'} || &error($text{'eacl_ecannot'});
8 &lock_file($config{'squid_conf'});
10 $whatfailed = $text{'sahttp_ftspr'};
12 @https = &find_config("http_access", $conf);
13 if (defined($in{'index'})) {
14 $http = $conf->[$in{'index'}];
17 # delete this restriction
18 splice(@https, &indexof($http, @https), 1);
22 @vals = ( $in{'action'} );
23 foreach $y (split(/\0/, $in{'yes'})) {
27 foreach $n (split(/\0/, $in{'no'})) {
31 $newhttp = { 'name' => 'http_access', 'values' => \@vals };
32 if ($http) { splice(@https, &indexof($http, @https), 1, $newhttp); }
33 else { push(@https, $newhttp); }
36 # Find the last referenced ACL
37 @acls = grep { $used{$_->{'values'}->[0]} } &find_config("acl", $conf);
38 $lastacl = @acls ? $acls[$#acls] : undef;
40 &save_directive($conf, "http_access", \@https, $lastacl);
42 &unlock_file($config{'squid_conf'});
43 &webmin_log($in{'delete'} ? 'delete' : $http ? 'modify' : 'create', "http");
44 &redirect("edit_acl.cgi?mode=http");