require 'updown-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the updown module
sub acl_security_form
{
print "
$text{'acl_upload'} \n";
printf " %s\n",
$_[0]->{'upload'} ? "checked" : "", $text{'yes'};
printf " %s \n",
$_[0]->{'upload'} ? "" : "checked", $text{'no'};
print " $text{'acl_max'} \n";
printf " %s\n",
$_[0]->{'max'} ? "" : "checked", $text{'acl_unlim'};
printf " \n",
$_[0]->{'max'} ? "checked" : "";
printf " %s \n",
$_[0]->{'max'}, $text{'acl_b'};
print " $text{'acl_download'} \n";
printf " %s\n",
$_[0]->{'download'} == 1 ? "checked" : "", $text{'yes'};
printf " %s\n",
$_[0]->{'download'} == 2 ? "checked" : "", $text{'acl_nosched'};
printf " %s \n",
$_[0]->{'download'} == 0 ? "checked" : "", $text{'no'};
print " $text{'acl_users'} \n";
printf " $text{'acl_all'} \n",
$_[0]->{'mode'} == 0 ? "checked" : "";
printf " $text{'acl_this'} \n",
$_[0]->{'mode'} == 3 ? "checked" : "";
printf " $text{'acl_only'}\n",
$_[0]->{'mode'} == 1 ? "checked" : "";
printf " %s \n",
$_[0]->{'mode'} == 1 ? $_[0]->{'users'} : "",
&user_chooser_button("userscan", 1);
printf " $text{'acl_except'}\n",
$_[0]->{'mode'} == 2 ? "checked" : "";
printf " %s \n",
$_[0]->{'mode'} == 2 ? $_[0]->{'users'} : "",
&user_chooser_button("userscannot", 1);
print " $text{'acl_dirs'} \n";
print " \n";
printf " %s \n",
$_[0]->{'home'} ? 'checked' : '', $text{'acl_home'};
print " $text{'acl_fetch'} \n";
printf " %s\n",
$_[0]->{'fetch'} ? "checked" : "", $text{'yes'};
printf " %s \n",
$_[0]->{'fetch'} ? "" : "checked", $text{'no'};
}
# acl_security_save(&options)
# Parse the form for security options for the cron module
sub acl_security_save
{
$_[0]->{'upload'} = $in{'upload'};
$_[0]->{'max'} = $in{'max_def'} ? undef : $in{'max'};
$_[0]->{'download'} = $in{'download'};
$_[0]->{'mode'} = $in{'mode'};
$_[0]->{'users'} = $in{'mode'} == 0 || $in{'mode'} == 3 ? "" :
$in{'mode'} == 1 ? $in{'userscan'}
: $in{'userscannot'};
local @dirs = split(/\s+/, $in{'dirs'});
map { s/\/+/\//g } @dirs;
map { s/([^\/])\/+$/$1/ } @dirs;
$_[0]->{'dirs'} = join(" ", @dirs);
$_[0]->{'home'} = $in{'home'};
$_[0]->{'fetch'} = $in{'fetch'};
}