\n";
# Directory to protect
print " | $text{'dir_dir'} | \n";
if ($in{'new'}) {
printf " %s\n",
$dir->[0], &file_chooser_button("dir", 1);
}
else {
print "\n";
print "$dir->[0]\n";
}
print " | \n";
# File containing users
print " | $text{'dir_file'} | \n";
if ($can_htpasswd) {
# Allow choice of users file
if ($in{'new'}) {
print " ",
"$text{'dir_auto'} \n";
print " $text{'dir_sel'}\n";
}
printf " %s | \n",
$dir->[1], &file_chooser_button("file", 0);
}
else {
# Always automatic
if ($in{'new'}) {
print "$text{'dir_auto'} \n";
}
else {
print "$dir->[1] \n";
}
}
# File containing groups
if ($can_htgroups) {
print " | $text{'dir_gfile'} | \n";
printf " %s \n",
$dir->[4] ? "" : "checked", $text{'dir_none'};
if ($in{'new'}) {
print " ",
"$text{'dir_auto'} \n";
}
printf " %s\n",
$dir->[4] ? "checked" : "", $text{'dir_sel'};
printf " %s | \n",
$dir->[4], &file_chooser_button("gfile", 0);
}
# If MD5 encryption is available, show option for it
@crypts = ( 0 );
push(@crypts, 1) if ($config{'md5'});
push(@crypts, 2) if ($config{'sha1'});
push(@crypts, 3) if ($config{'digest'});
if (@crypts > 1) {
print " | $text{'dir_crypt'} | \n";
print "",&ui_radio("crypt", int($dir->[2]),
[ map { [ $_, $text{'dir_crypt'.$_} ] } @crypts ])," | \n";
}
else {
print "\n";
}
# Authentication realm
print " | $text{'dir_realm'} | \n";
if (!$in{'new'}) {
$conf = &foreign_call($apachemod, "get_htaccess_config",
"$dir->[0]/$config{'htaccess'}");
$realm = &foreign_call($apachemod, "find_directive",
"AuthName", $conf, 1);
}
printf " | \n",
$realm;
# Users and groups to allow
if (!$in{'new'}) {
$require = &foreign_call($apachemod, "find_directive_struct",
"require", $conf);
($rmode, @rwho) = @{$require->{'words'}} if ($require);
}
else {
$rmode = "valid-user";
}
print " | $text{'dir_require'} | \n";
print "",&ui_radio("require_mode", $rmode,
[ [ "valid-user", $text{'dir_requirev'}." " ],
[ "user", $text{'dir_requireu'}." ".
&ui_textbox("require_user",
$rmode eq "user" ? join(" ", @rwho) : "", 40)." " ],
[ "group", $text{'dir_requireg'}." ".
&ui_textbox("require_group",
$rmode eq "group" ? join(" ", @rwho) : "", 40)." " ] ]),
" | \n";
# Webmin synchronization mode
if ($can_sync) {
print "
| \n";
%sync = map { $_, 1 } split(/,/, $dir->[3]);
foreach $s ('create', 'update', 'delete') {
print " | ",$text{'dir_sync_'.$s}," | \n";
printf " %s\n",
$s, $sync{$s} ? "checked" : "", $text{'yes'};
printf " %s\n",
$s, $sync{$s} ? "" : "checked", $text{'no'};
print " | \n";
}
}
print " |