2007-04-12 20:24:50 +00:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
# config.cgi
|
|
|
|
# Display a form for editing the configuration of a module.
|
|
|
|
|
2018-07-04 12:24:02 -07:00
|
|
|
BEGIN { push(@INC, "."); };
|
2009-03-01 07:49:06 +00:00
|
|
|
use WebminCore;
|
2007-04-12 20:24:50 +00:00
|
|
|
require './config-lib.pl';
|
|
|
|
&init_config();
|
2009-08-17 14:24:52 -07:00
|
|
|
&ReadParse();
|
2008-02-08 22:48:02 +00:00
|
|
|
$m = $in{'module'} || $ARGV[0];
|
2019-10-21 13:12:44 -07:00
|
|
|
%module_info = &get_module_info($m);
|
|
|
|
%module_info || &error($text{'config_emodule'});
|
2025-05-08 14:13:18 +03:00
|
|
|
&foreign_available($m) || $module_info{'noacl'} ||
|
|
|
|
&error($text{'config_eaccess'});
|
2007-04-12 20:24:50 +00:00
|
|
|
%access = &get_module_acl(undef, $m);
|
|
|
|
$access{'noconfig'} &&
|
|
|
|
&error($text{'config_ecannot'});
|
|
|
|
if (-r &help_file($m, "config_intro")) {
|
|
|
|
$help = [ "config_intro", $m ];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$help = undef;
|
|
|
|
}
|
|
|
|
&ui_print_header(&text('config_dir', $module_info{'desc'}),
|
|
|
|
$text{'config_title'}, "", $help, 0, 1);
|
|
|
|
|
|
|
|
print &ui_form_start("config_save.cgi", "post");
|
2023-11-10 16:57:24 -08:00
|
|
|
print &hidden_config_cparams(\%in);
|
2007-04-12 20:24:50 +00:00
|
|
|
print &ui_hidden("module", $m),"\n";
|
|
|
|
print &ui_table_start(&text('config_header', $module_info{'desc'}),
|
|
|
|
"width=100%", 2);
|
2009-03-06 18:56:11 +00:00
|
|
|
&read_file("$config_directory/$m/config", \%newconfig);
|
2021-02-22 15:18:29 +03:00
|
|
|
&load_module_preferences($m, \%newconfig);
|
2007-04-12 20:24:50 +00:00
|
|
|
$mdir = &module_root_directory($m);
|
|
|
|
if (-r "$mdir/config_info.pl") {
|
|
|
|
# Module has a custom config editor
|
|
|
|
&foreign_require($m, "config_info.pl");
|
|
|
|
local $fn = "${m}::config_form";
|
|
|
|
if (defined(&$fn)) {
|
|
|
|
$func++;
|
2009-03-06 18:56:11 +00:00
|
|
|
&foreign_call($m, "config_form", \%newconfig);
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$func) {
|
|
|
|
# Use config.info to create config inputs
|
2021-02-21 13:45:41 -08:00
|
|
|
my $cdir;
|
|
|
|
foreach my $d (map { $_."/".$m } @theme_root_directories) {
|
|
|
|
$cdir = $d if (-r $d."/config.info");
|
|
|
|
}
|
|
|
|
$cdir ||= $mdir;
|
|
|
|
&generate_config(\%newconfig, "$cdir/config.info", $m);
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
|
|
|
print &ui_table_end();
|
|
|
|
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
|
|
|
|
2023-11-10 16:57:24 -08:00
|
|
|
&ui_print_footer(&link_config_cparams($m, \%in), $text{'index'});
|
2007-04-12 20:24:50 +00:00
|
|
|
|