ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/docs.cgi
(Generate patch)

Comparing web/cgi-bin/docs.cgi (file contents):
Revision 1.8 by tdb, Wed Mar 24 13:11:42 2004 UTC vs.
Revision 1.13 by tdb, Thu Mar 25 22:51:20 2004 UTC

# Line 6 | Line 6 | use CGI;
6   $| = 1;
7  
8   # Settings
9 < my ($incdir) = "../nwww";
9 > my ($incdir) = "../htdocs";
10  
11   # Include files
12   my ($doctype) = "$incdir/doctype.inc";
13   my ($style) = "$incdir/style.inc";
14   my ($header) = "$incdir/header.inc";
15   my ($footer) = "$incdir/footer.inc";
16 < my ($menu) = "$incdir/menu.inc" ;
16 > my ($menu) = "$incdir/menu-static.inc" ;
17  
18   my ($query) = new CGI;
19  
# Line 35 | Line 35 | unless ($doc =~ /^[a-zA-Z_\-0-9\.\/]+$/) {
35      print "Malformed request.";
36      exit;
37   }
38 < $doc = "../htdocs/documentation/".$doc;
38 > $doc = "../htdocs/cms/documentation/".$doc;
39  
40   my($docname) = $doc =~ /\/([^\/]+)$/;
41  
# Line 98 | Line 98 | END
98   exit 0;
99  
100   # Print a file, whilst escaping HTML: -
101 < sub print_file ($) {
101 > sub print_file {
102   my ($urls) = '(' . join ('|', qw{
103                 http
104                 telnet
# Line 109 | Line 109 | my ($urls) = '(' . join ('|', qw{
109                 } )
110             . ')';
111  
112 < my ($ltrs) = '\w';
113 < my ($gunk) = '/#~:.?+=&%@!\-';
114 < my ($punc) = '.:?\-';
115 < my ($any) = "${ltrs}${gunk}${punc}";
116 < my ($filename) = @_;
117 < if(open(FILE, $filename)) {
118 <    print "          <pre>\n";
119 <    # Use $_ implicitly throughout.
120 <    while (<FILE>) {
121 <        # Must do the next line first!
122 <        s/&/&amp;/g;
123 <        s/</&lt;/g;
124 <        s/>/&gt;/g;
125 <        s/"/&quot;/g;
126 <        s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/<a href="$1">$1<\/a>/igox;
127 <        print;
112 >    my ($ltrs) = '\w';
113 >    my ($gunk) = '/#~:.?+=&%@!\-';
114 >    my ($punc) = '.:?\-';
115 >    my ($any) = "${ltrs}${gunk}${punc}";
116 >    my ($filename) = @_;
117 >    if(open(FILE, $filename)) {
118 >        print "          <pre>\n";
119 >        # Use $_ implicitly throughout.
120 >        while (<FILE>) {
121 >            # Must do the next line first!
122 >            s/&/&amp;/g;
123 >            s/</&lt;/g;
124 >            s/>/&gt;/g;
125 >            s/"/&quot;/g;
126 >            s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/<a href="$1">$1<\/a>/igox;
127 >            print;
128 >        }
129 >        print "\n</pre>";
130      }
131 <    print "\n</pre>";
131 >    else {
132 >        print "Failed to open $docname.";
133 >    }
134   }
131 else {
132    print "Failed to open $docname.";
133 }
134 }
135  
136 < # Print a file without escaping HTML: -
136 > # Print the contents of a file containing html
137   sub print_html ($) {
138 < my ($filename) = @_;
139 < print `cat $filename 2>&1`;
138 >    my ($filename) = @_;
139 >    open(FILE, $filename);
140 >    while(<FILE>) {
141 >        print;
142 >    }
143 >    close FILE;
144   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines