#!/usr/bin/perl
# help.cgi
# Displays help HTML for some module, with substitutions
BEGIN { push(@INC, "."); };
use WebminCore;
&init_config();
&error_setup($text{'help_err'});
$ENV{'PATH_INFO'} !~ /[\\\&\;\`\'\"\|\*\?\~\<\>\^\(\)\[\]\{\}\$\n\r]/ ||
&error($text{'help_epath'});
$ENV{'PATH_INFO'} =~ /^\/(\S+)\/(\S+)$/ || &error($text{'help_epath'});
$module = $1; $file = $2;
# if it ends with .gif assume it is a direct URL
if ($file =~ /\.(gif|jpg|jpeg|png)$/i) {
&redirect("$module/$file");
exit;
}
# read the help file
$help = &read_help_file($module, $file);
$help || &helperror(&text('help_efile3',
&html_escape($file), &html_escape($module)));
# Modify help file based on module
if (&foreign_exists($module) &&
&foreign_require($module) &&
&foreign_defined($module, 'help_pre_load')) {
$help = &foreign_call($module, "help_pre_load", $help);
}
# find and replace the section
if ($help =~ s/([^<]+)<\/header>//i) {
&popup_header($1);
print &ui_subheading($1);
}
else {
&helperror($text{'help_eheader'});
}
# replace any explicit use of with the ui-lib function
$uihr = &ui_hr();
$help =~ s//$uihr/ig;
# find and replace the