webmin/squid/move_http_reply.cgi

26 lines
803 B
Plaintext
Raw Permalink Normal View History

2007-11-22 06:44:41 +00:00
#!/usr/local/bin/perl
# move_http.cgi
# Move a http_access directive up or down
2014-01-05 11:12:04 -08:00
use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
2014-01-05 11:12:04 -08:00
our (%text, %in, %access, $squid_version, %config);
2007-11-22 06:44:41 +00:00
require './squid-lib.pl';
$access{'actrl'} || &error($text{'eacl_ecannot'});
&lock_file($config{'squid_conf'});
2014-01-05 11:12:04 -08:00
my $conf = &get_config();
my ($pos, $move) = @ARGV;
2007-11-22 06:44:41 +00:00
2014-01-05 11:12:04 -08:00
my @http_relies = &find_config("http_reply_access", $conf);
my $newpos = $pos + $move;
my $oldv = $http_relies[$pos]->{'values'};
2007-11-22 06:44:41 +00:00
$http_relies[$pos]->{'values'} = $http_relies[$newpos]->{'values'};
$http_relies[$newpos]->{'values'} = $oldv;
&save_directive($conf, "http_reply_access", \@http_relies);
&flush_file_lines();
&unlock_file($config{'squid_conf'});
&webmin_log("move", "http");
&redirect("edit_acl.cgi?mode=reply");