# mod_access.pl
# Defines editors for host restriction directives
sub mod_access_directives
{
local($rv);
$rv = [ [ 'allow deny order', 1, 4, 'directory htaccess' ] ];
return &make_directives($rv, $_[0], "mod_access");
}
sub edit_allow_deny_order
{
local($d, @w, $i, @type, @mode, @what, $rv);
foreach $d (@{$_[0]}, @{$_[1]}) {
@w = split(/\s+/, $d->{'value'});
for($i=1; $i<@w; $i++) {
push(@type, lc($d->{'name'}) eq "allow" ? 1 : 2);
push(@what, $w[$i]);
if ($w[$i] =~ /^env=(\S+)$/) {
$what[$#what] = $1;
push(@mode, 6);
}
elsif ($w[$i] =~ /^[0-9\.]+\/[0-9]+$/) { push(@mode, 5); }
elsif ($w[$i] =~ /^[0-9\.]+\/[0-9\.]+$/) { push(@mode, 4); }
elsif ($w[$i] =~ /^\d+\.\d+\.\d+\.\d+$/) { push(@mode, 2); }
elsif ($w[$i] =~ /^[0-9\.]+$/) { push(@mode, 3); }
elsif ($w[$i] eq "all") { push(@mode, 0); }
else { push(@mode, 1); }
}
}
push(@type, ""); push(@what, ""); push(@mode, 0);
$rv = "$text{'mod_access_order'}\n".
&choice_input($_[2]->[0]->{'value'}, "order", "",
"$text{'mod_access_denyallow'},deny,allow", "$text{'mod_access_allowdeny'},allow,deny",
"$text{'mod_access_mutual'},mutual-failure", "$text{'mod_access_default'},")."
\n";
$rv .= "
$text{'mod_access_action'} | $text{'mod_access_cond'} |
".&select_input($type[$i], "allow_type_$i", "", ",0", "$text{'mod_access_allow'},1", "$text{'mod_access_deny'},2")." | \n"; $rv .= "".&select_input($mode[$i], "allow_mode_$i", "0", @sels); $rv .= sprintf " | \n", $mode[$i] ? $what[$i] : ""; $rv .= "