mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
Fix to factor out read_help_file
sub to be accessible by theme
This commit is contained in:
36
help.cgi
36
help.cgi
@ -59,42 +59,6 @@ $help =~ s/<if\s+([^>]*)>([\000-\177]*?)<\/if>/ifhelp($1, $2)/ige;
|
||||
print $help;
|
||||
&popup_footer();
|
||||
|
||||
# read_help_file(module, file)
|
||||
# Reads the contents of a help file, either unpacked or from a ZIP
|
||||
sub read_help_file
|
||||
{
|
||||
my ($module, $file) = @_;
|
||||
my $path = &help_file($module, $file);
|
||||
if (-r $path) {
|
||||
return &read_file_contents($path);
|
||||
}
|
||||
my $gzpath = $path.".gz";
|
||||
if (-r $gzpath) {
|
||||
my $out = &backquote_command(
|
||||
"gunzip -c ".quotemeta($gzpath)." 2>/dev/null");
|
||||
return $? ? undef : $out;
|
||||
}
|
||||
my $zip = $path;
|
||||
$zip =~ s/\/[^\/]+$/\/help.zip/;
|
||||
if (-r $zip) {
|
||||
my @files;
|
||||
foreach my $o (@lang_order_list) {
|
||||
next if ($o eq "en");
|
||||
push(@files, $file.".".$o.".auto.html");
|
||||
push(@files, $file.".".$o.".html");
|
||||
}
|
||||
push(@files, $file.".html");
|
||||
foreach my $f (@files) {
|
||||
my $out = &backquote_command(
|
||||
"unzip -p ".quotemeta($zip)." ".
|
||||
quotemeta($f)." 2>/dev/null");
|
||||
return $out if ($out && !$?);
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
# inchelp(path)
|
||||
sub inchelp
|
||||
{
|
||||
|
Reference in New Issue
Block a user