X-Git-Url: http://git.i-scream.org/?a=blobdiff_plain;f=cgi-bin%2Fdocs.cgi;h=ee22b7b9ed4c8f05aeda8a797f03484ec286a06c;hb=a8233ee6515c3f035580bd7711f9484dbb71fbf8;hp=402c9e505ba29cb49bd023f9ed76ce1ed741b7ca;hpb=044ce3d999326b8748cd8f2821ed593298bb07ba;p=www.i-scream.org.git diff --git a/cgi-bin/docs.cgi b/cgi-bin/docs.cgi index 402c9e5..ee22b7b 100755 --- a/cgi-bin/docs.cgi +++ b/cgi-bin/docs.cgi @@ -6,10 +6,14 @@ use CGI; $| = 1; # Settings -my ($menu) = "../nwww/menu.inc" ; -my ($header) = "../nwww/header.inc"; -my ($footer) = "../nwww/footer.inc"; -my ($style) = "../nwww/style.inc"; +my ($incdir) = "../nwww"; + +# 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 ($query) = new CGI; @@ -17,6 +21,7 @@ my ($query) = new CGI; # This prevents malicious users using "../" to view files. my ($doc) = ($query->param('doc') =~ /^\s*([^\.]*?\.txt)\s*$/); +# This should be application/xhtml+xml print "Content-type: text/html\n\n"; unless (defined $doc) { @@ -34,57 +39,66 @@ $doc = "../htdocs/documentation/".$doc; my($docname) = $doc =~ /\/([^\/]+)$/; -print <<"END"; - +&print_html($doctype); - +print <<"END"; -
-\n"; - # Use $_ implicitly throughout. - while ("; -} -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) = @_; + my($virtual) = ''; + my(@virtualresponse) = `/web/i-scream/nwww.cgi-bin/logo.cgi`; + 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 ("; + } + else { + print "Failed to open $docname."; } - print ") { + # 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