--- web/cgi-bin/docs.cgi 2004/03/24 13:11:42 1.8 +++ web/cgi-bin/docs.cgi 2004/03/25 22:51:20 1.13 @@ -6,14 +6,14 @@ use CGI; $| = 1; # Settings -my ($incdir) = "../nwww"; +my ($incdir) = "../htdocs"; # Include files my ($doctype) = "$incdir/doctype.inc"; my ($style) = "$incdir/style.inc"; my ($header) = "$incdir/header.inc"; my ($footer) = "$incdir/footer.inc"; -my ($menu) = "$incdir/menu.inc" ; +my ($menu) = "$incdir/menu-static.inc" ; my ($query) = new CGI; @@ -35,7 +35,7 @@ unless ($doc =~ /^[a-zA-Z_\-0-9\.\/]+$/) { print "Malformed request."; exit; } -$doc = "../htdocs/documentation/".$doc; +$doc = "../htdocs/cms/documentation/".$doc; my($docname) = $doc =~ /\/([^\/]+)$/; @@ -98,7 +98,7 @@ END exit 0; # Print a file, whilst escaping HTML: - -sub print_file ($) { +sub print_file { my ($urls) = '(' . join ('|', qw{ http telnet @@ -109,32 +109,36 @@ my ($urls) = '(' . join ('|', qw{ } ) . ')'; -my ($ltrs) = '\w'; -my ($gunk) = '/#~:.?+=&%@!\-'; -my ($punc) = '.:?\-'; -my ($any) = "${ltrs}${gunk}${punc}"; -my ($filename) = @_; -if(open(FILE, $filename)) { - print "
\n"; - # Use $_ implicitly throughout. - while ("; + else { + print "Failed to open $docname."; + } } -else { - print "Failed to open $docname."; -} -} -# Print a file without escaping HTML: - +# Print the contents of a file containing html sub print_html ($) { -my ($filename) = @_; -print `cat $filename 2>&1`; + my ($filename) = @_; + open(FILE, $filename); + while() { - # Must do the next line first! - s/&/&/g; - s/</g; - s/>/>/g; - s/"/"/g; - s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/$1<\/a>/igox; - print; + my ($ltrs) = '\w'; + my ($gunk) = '/#~:.?+=&%@!\-'; + my ($punc) = '.:?\-'; + my ($any) = "${ltrs}${gunk}${punc}"; + my ($filename) = @_; + if(open(FILE, $filename)) { + print " \n"; + # Use $_ implicitly throughout. + while ("; } - print "\n) { + # Must do the next line first! + s/&/&/g; + s/</g; + s/>/>/g; + s/"/"/g; + s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/$1<\/a>/igox; + print; + } + print "\n