-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselect_config.cgi
48 lines (34 loc) · 1.31 KB
/
select_config.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl
require "vsftpd-lib.pl";
use libvsftpdconfig::HtmlUICreator;
use libvsftpdconfig::ConfigManager;
&ReadParse();
ui_print_header(undef, $text{'select_title'}, "", "profile", 1, 1);
if (exists $in{'selected'}) {
print '<div style="font-weight: bold">' . text('selected_ok') . "</div><br/><br/>";
}
elsif (exists $in{'error'}) {
my $error = $in{'error'};
error_setup($text{'select_error_save'});
error(HtmlUICreator::render_error_save());
}
else {
print text('select_description');
print ui_form_start("save_select.cgi", "post");
foreach my $o (@{$ConfigManager::profiles}) {
print "<div>";
my @option = @{$o};
print ui_oneradio('profile', $option[0], $text{'select_profile_' . $option[0]}, undef);
foreach my $feat (@{$option[2]}) {
# Little trick to make sure we show the default value, change is not actually persisted
# so it's safe
my $instance = ConfigManager::instance()->config_instance($feat);
$instance->value($option[1]{$feat} ? $option[1]{$feat} : $instance->type()->value_default());
print "<div>" . $text{"select_profile_" . $option[0] . "_" . $feat} . ": " .
HtmlUICreator::render_config_instance($feat, 7) . "</div>";
}
print "</div>";
}
print ui_form_end([['select', $text{'select_do'}]]);
}
ui_print_footer(undef, $text{'return_text'});