require 'mysql-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the mysql module
sub acl_security_form
{
print "
$text{'acl_dbs'} | \n";
print "\n";
printf " %s\n",
$_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'};
printf " %s \n",
$_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
print " | \n";
print "$text{'acl_delete'} | \n";
printf " %s\n",
$_[0]->{'delete'} ? 'checked' : '', $text{'yes'};
printf " %s |
\n",
$_[0]->{'delete'} ? '' : 'checked', $text{'no'};
print " $text{'acl_stop'} | \n";
printf " %s\n",
$_[0]->{'stop'} ? 'checked' : '', $text{'yes'};
printf " %s |
\n",
$_[0]->{'stop'} ? '' : 'checked', $text{'no'};
print " $text{'acl_edonly'} | \n";
printf " %s\n",
$_[0]->{'edonly'} ? 'checked' : '', $text{'yes'};
printf " %s |
\n",
$_[0]->{'edonly'} ? '' : 'checked', $text{'no'};
print " $text{'acl_indexes'} | \n";
print "",&ui_yesno_radio("indexes", $_[0]->{'indexes'})," | \n";
print "$text{'acl_views'} | \n";
print "",&ui_yesno_radio("views", $_[0]->{'views'})," |
\n";
print " $text{'acl_create'} | \n";
printf " %s\n",
$_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'};
printf " %s\n",
$_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'};
printf "\n",
$_[0]->{'max'};
printf " %s |
\n",
$_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'};
print " $text{'acl_perms'} | \n";
printf " %s\n",
$_[0]->{'perms'} == 1 ? 'checked' : '', $text{'yes'};
printf " %s\n",
$_[0]->{'perms'} == 2 ? 'checked' : '', $text{'acl_only'};
printf " %s\n",
$_[0]->{'perms'} == 0 ? 'checked' : '', $text{'no'};
print " |
\n";
print " $text{'acl_login'} | \n";
printf " %s \n",
$_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'};
printf "\n",
$_[0]->{'user'} ? 'checked' : '';
printf "%s \n",
$text{'acl_user'}, $_[0]->{'user'};
printf "%s |
\n",
$text{'acl_pass'}, $_[0]->{'pass'};
print " $text{'acl_buser'} | \n";
printf " %s\n",
$_[0]->{'buser'} ? "" : "checked", $text{'acl_bnone'};
printf "\n",
$_[0]->{'buser'} ? "checked" : "";
printf " %s |
\n",
$_[0]->{'buser'}, &user_chooser_button("buser");
print " $text{'acl_bpath'} | \n";
printf " %s |
\n",
$_[0]->{'bpath'}, &file_chooser_button("bpath", 1);
}
# acl_security_save(&options)
# Parse the form for security options for the mysql module
sub acl_security_save
{
if ($in{'dbs_def'}) {
$_[0]->{'dbs'} = '*';
}
else {
$_[0]->{'dbs'} = join(" ", split(/\0/, $in{'dbs'}));
}
$_[0]->{'create'} = $in{'create'};
$_[0]->{'indexes'} = $in{'indexes'};
$_[0]->{'views'} = $in{'views'};
$_[0]->{'max'} = $in{'max'};
$_[0]->{'delete'} = $in{'delete'};
$_[0]->{'bpath'} = $in{'bpath'};
$_[0]->{'buser'} = $in{'buser_def'} ? undef : $in{'buser'};
$_[0]->{'stop'} = $in{'stop'};
$_[0]->{'perms'} = $in{'perms'};
$_[0]->{'edonly'} = $in{'edonly'};
if ($in{'user_def'}) {
delete($_[0]->{'user'});
delete($_[0]->{'pass'});
}
else {
$_[0]->{'user'} = $in{'user'};
$_[0]->{'pass'} = $in{'pass'};
}
}