Skip to content

Commit

Permalink
Fix to prevent escaping module used from Virtualmin; move link
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Mar 11, 2022
1 parent 0c12755 commit a459baf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions config.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
Expand Down Expand Up @@ -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'});
3 changes: 2 additions & 1 deletion config_save.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions generate.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ 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);
my $data = &find_value("DirData", $conf);
if ($in{'wipe'} && $data) {
print &text('gen_wiping', "<tt>".&html_escape($data)."</tt>"),"<br>\n";
my $c = &clear_data_directory($in{'dom'}, $data);
print &text('gen_wipedone', $c),"<p>\n";
print &text('gen_wipedone', $c),"\n";
print "$text{'gen_just_done'}<br>\n";
}

print &text('gen_doing', "<tt>$in{'dom'}</tt>", "<tt>$log</tt>"),"<br>\n";
Expand All @@ -31,8 +32,8 @@ if ($ok && !&virtual_server::domain_has_website($d)) {
&generate_html($in{'dom'}, $outdir);
}
print "</pre>";
print(($ok ? &text('gen_done', "view.cgi?config=$in{'dom'}")
: $text{'gen_failed'}), "<p>\n");
print(($ok ? ("<p></p> ".&text('gen_done', "view.cgi?config=$in{'dom'}"))
: "$text{'gen_failed'}"), "<p>\n");

&ui_print_footer("", $text{'index_return'});

!$in{'linked'} && &ui_print_footer("", $text{'index_return'});
2 changes: 1 addition & 1 deletion virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
);
Expand Down

0 comments on commit a459baf

Please sign in to comment.