#!/usr/local/bin/perl # help.cgi # Displays help HTML for some module, with substitutions $trust_unknown_referers = 1; require './web-lib.pl'; &init_config(); require './ui-lib.pl'; &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 $path = &help_file($module, $file); @st = stat($path); open(HELP, $path) || &helperror(&text('help_efile', $path)); read(HELP, $help, $st[7]); close(HELP); # find and replace the
section if ($help =~ s/
([^<]+)<\/header>//i) { &popup_header($1); print &ui_subheading($1); } else { &helperror($text{'help_eheader'}); } # find and replace the