From a459baf5e738efa6fa89497cf421261759fcaea0 Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Fri, 11 Mar 2022 20:30:27 +0200 Subject: [PATCH] Fix to prevent escaping module used from Virtualmin; move link --- config.cgi | 7 ++++--- config_save.cgi | 3 ++- generate.cgi | 11 ++++++----- virtual_feature.pl | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/config.cgi b/config.cgi index 41a3a2e..42d91a0 100755 --- a/config.cgi +++ b/config.cgi @@ -14,7 +14,7 @@ if (&foreign_check("virtual-server")) { $d = &virtual_server::get_domain_by("dom", $in{'dom'}); } &ui_print_header($d ? &virtual_server::domain_in($d) : undef, - $text{'config_title'}, ""); + $text{'config_title'}, "", undef, undef, $in{'linked'} ? 1 : undef); print &ui_form_start("config_save.cgi", "post"); print &ui_hidden("dom", $in{'dom'}); @@ -121,7 +121,8 @@ if (@allplugins) { print &ui_submit($text{'save'}); print &ui_submit($text{'config_regen'}, 'gen'); -print &ui_checkbox('wipe', 1, $text{'config_wipe'}, 0); +print "  " . &ui_checkbox('wipe', 1, $text{'config_wipe'}, 0); +print &ui_hidden("linked", $in{'linked'} ? 1 : 0); print &ui_form_end(); -&ui_print_footer("", $text{'index_return'}); +!$in{'linked'} && &ui_print_footer("", $text{'index_return'}); diff --git a/config_save.cgi b/config_save.cgi index e9de0b0..0157ab9 100755 --- a/config_save.cgi +++ b/config_save.cgi @@ -69,7 +69,8 @@ if (&foreign_check("virtual-server")) { } if ($in{'gen'}) { &redirect("generate.cgi?dom=".&urlize($in{'dom'}). - "&wipe=".&urlize($in{'wipe'})); + "&wipe=".&urlize($in{'wipe'}). + "&linked=".&urlize($in{'linked'})); } elsif ($d) { &virtual_server::domain_redirect($d); diff --git a/generate.cgi b/generate.cgi index b4be87f..296788d 100755 --- a/generate.cgi +++ b/generate.cgi @@ -11,7 +11,7 @@ require './virtualmin-awstats-lib.pl'; &foreign_require("virtual-server"); my $d = &virtual_server::get_domain_by("dom", $in{'dom'}); -&ui_print_unbuffered_header(undef, $text{'gen_title'}, ""); +&ui_print_unbuffered_header(undef, $text{'gen_title'}, "", undef, undef, $in{'linked'} ? 1 : 0); my $conf = &get_config($in{'dom'}); my $log = &find_value("LogFile", $conf); @@ -19,7 +19,8 @@ my $data = &find_value("DirData", $conf); if ($in{'wipe'} && $data) { print &text('gen_wiping', "".&html_escape($data).""),"
\n"; my $c = &clear_data_directory($in{'dom'}, $data); - print &text('gen_wipedone', $c),"

\n"; + print &text('gen_wipedone', $c),"\n"; + print "$text{'gen_just_done'}
\n"; } print &text('gen_doing', "$in{'dom'}", "$log"),"
\n"; @@ -31,8 +32,8 @@ if ($ok && !&virtual_server::domain_has_website($d)) { &generate_html($in{'dom'}, $outdir); } print ""; -print(($ok ? &text('gen_done', "view.cgi?config=$in{'dom'}") - : $text{'gen_failed'}), "

\n"); +print(($ok ? ("

".&text('gen_done', "view.cgi?config=$in{'dom'}")) + : "$text{'gen_failed'}"), "

\n"); -&ui_print_footer("", $text{'index_return'}); +!$in{'linked'} && &ui_print_footer("", $text{'index_return'}); \ No newline at end of file diff --git a/virtual_feature.pl b/virtual_feature.pl index ef1cc2a..7572a68 100755 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -635,7 +635,7 @@ sub feature_links # Link to edit AWstats config for this domain { 'mod' => $module_name, 'desc' => $text{'links_config'}, - 'page' => 'config.cgi?dom='.&urlize($d->{'dom'}), + 'page' => 'config.cgi?linked=1&dom='.&urlize($d->{'dom'}), 'cat' => 'server', }, );