Skip to content

Commit

Permalink
Fix to pass URL params to config page
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Nov 11, 2023
1 parent 12576df commit a25add2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
13 changes: 12 additions & 1 deletion authentic.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
%gconfig,
%tconfig,
%text,
$scriptname,
$basic_virtualmin_domain,
$basic_virtualmin_menu,
$cb,
Expand Down Expand Up @@ -120,7 +121,17 @@ sub theme_header
my $cprog =
$user_module_config_directory ? "uconfig.cgi" :
"config.cgi";
print "<a href=\"$theme_webprefix/$cprog?", &get_module_name() . "\">", $text{'header_config'}, "</a><br>\n";
my $params = "";
my %in;
&ReadParse(\%in);
foreach my $k (keys %in) {
foreach my $v (split(/\0/, $in{$k})) {
$params .= "&_cparam_".
&urlize($k)."=".&urlize($v);
}
}
$params .= "&_cscript=".&urlize($scriptname);
print "<a href=\"$theme_webprefix/$cprog?module=", &get_module_name().$params . "\">", $text{'header_config'}, "</a><br>\n";
}
}
print "</div>\n";
Expand Down
4 changes: 3 additions & 1 deletion config.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ if (@sections > 1) {
# We have some sections .. show a menu to select
print &ui_form_start("config.cgi");
print &ui_hidden("module", $module), "\n";
print &hidden_config_cparams(\%in);
print &ui_span_local($theme_text{'settings_config_configuration_category'} . ":", 'row-block-label') . "\n";
print &ui_select("section", $in{'section'}, \@sections, 1, 0, 0, 0, "onChange='form.submit()'");
print &ui_button_group_local(
Expand Down Expand Up @@ -134,6 +135,7 @@ $sname = $theme_text{'theme_xhred_config_configurable_options'} if (!$sname);
print &ui_form_start("config_save.cgi", "post");
print &ui_hidden("module", $module), "\n";
print &ui_hidden("section", $in{'section'}), "\n";
print &hidden_config_cparams(\%in);
if ($section) {

# Find next section
Expand Down Expand Up @@ -178,4 +180,4 @@ print &ui_table_end();
print &ui_form_end([["save", $text{'save'}], $section ? (["save_next", $theme_text{'settings_config_save_and_next'}]) : ()]);

%moduletext = &load_language($module);
&ui_print_footer("/$module/", $moduletext{'index_return'} || $text{'index'});
&ui_print_footer(navigation_link_clean(&link_config_cparams($module, \%in)), $moduletext{'index_return'} || $text{'index'});
6 changes: 4 additions & 2 deletions config_save.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ if (&foreign_check("webmin")) {
}

&webmin_log("_config_", undef, undef, \%in, $module);
my $redir = &link_config_cparams($module, \%in);
if ($in{'save_next'}) {
&redirect("config.cgi?module=$module&section=$in{'section_next'}");
&redirect("config.cgi?module=$module&section=$in{'section_next'}".
($redir =~ /\?(.*)$/ ? "&".$1 : ""));
} else {
&redirect("/$module/");
&redirect($redir);
}
4 changes: 2 additions & 2 deletions theme.info
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ mversion=00
bversion=00
webmin=1
usermin=1
depends=2.100 2.000
depends_reason=https://github.com/webmin/webmin/pull/1917 https://github.com/webmin/webmin/pull/1915 https://github.com/webmin/webmin/pull/1951
depends=2.106 2.006
depends_reason=https://github.com/webmin/webmin/commit/aca2a9a52439e58333613e5421a65dff2f093e0b

0 comments on commit a25add2

Please sign in to comment.