version 3.3, 2000/07/27 16:16:41 |
version 3.9, 2000/07/29 12:41:25 |
|
|
# |
# |
# Based on: |
# Based on: |
# * Bill Fenners cvsweb.cgi revision 1.28 available from: |
# * Bill Fenners cvsweb.cgi revision 1.28 available from: |
# http://www.freebsd.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi |
# http://www.FreeBSD.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi |
# |
# |
# Copyright (c) 1996-1998 Bill Fenner |
# Copyright (c) 1996-1998 Bill Fenner |
# (c) 1998-1999 Henner Zeller |
# (c) 1998-1999 Henner Zeller |
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
# |
# |
|
# $zId: cvsweb.cgi,v 1.93 2000/07/27 17:42:28 hzeller Exp $ |
# $Id$ |
# $Id$ |
# |
# |
### |
### |
|
|
$checkoutMagic $doCheckout $scriptname $scriptwhere |
$checkoutMagic $doCheckout $scriptname $scriptwhere |
$where $pathinfo $Browser $nofilelinks $maycompress @stickyvars |
$where $pathinfo $Browser $nofilelinks $maycompress @stickyvars |
%funcline_regexp $is_mod_perl |
%funcline_regexp $is_mod_perl |
$is_lynx $is_msie $is_mozilla3 |
$is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased |
%input $query $barequery $sortby $bydate $byrev $byauthor |
%input $query $barequery $sortby $bydate $byrev $byauthor |
$bylog $byfile $hr_default $logsort $cvstree $cvsroot |
$bylog $byfile $hr_default $logsort $cvstree $cvsroot |
$mimetype $defaultTextPlain $defaultViewable $allow_compress |
$mimetype $defaultTextPlain $defaultViewable $allow_compress |
Line 133 $is_mod_perl = defined($ENV{MOD_PERL}); |
|
Line 134 $is_mod_perl = defined($ENV{MOD_PERL}); |
|
# per file, so disable the link at the icon |
# per file, so disable the link at the icon |
# in this case: |
# in this case: |
$Browser = $ENV{HTTP_USER_AGENT} || ''; |
$Browser = $ENV{HTTP_USER_AGENT} || ''; |
$is_lynx = ($Browser =~ m`^Lynx/`); |
$is_lynx = ($Browser =~ m`^Lynx/`i); |
|
$is_w3m = ($Browser =~ m`^w3m/`i); |
$is_msie = ($Browser =~ m`MSIE`); |
$is_msie = ($Browser =~ m`MSIE`); |
$is_mozilla3 = ($Browser =~ m`^Mozilla/[3456789]`); |
$is_mozilla3 = ($Browser =~ m`^Mozilla/[3-9]`); |
|
|
$nofilelinks = $is_lynx; |
$is_textbased = ($is_lynx || $is_w3m); |
|
|
|
$nofilelinks = $is_textbased; |
|
|
# newer browsers accept gzip content encoding |
# newer browsers accept gzip content encoding |
# and state this in a header |
# and state this in a header |
# (netscape did always but didn't state it) |
# (netscape did always but didn't state it) |
Line 158 $maycompress =(($ENV{HTTP_ACCEPT_ENCODING} =~ m`gzip` |
|
Line 162 $maycompress =(($ENV{HTTP_ACCEPT_ENCODING} =~ m`gzip` |
|
# to hold our state - they will be added (with |
# to hold our state - they will be added (with |
# their current value) to any link/query string |
# their current value) to any link/query string |
# you construct |
# you construct |
@stickyvars = qw(cvsroot hideattic sortby logsort fonly_with_tag); |
@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag); |
|
|
if (-f $config) { |
if (-f $config) { |
do $config; |
do $config; |
Line 217 foreach (keys %DEFAULTVALUE) |
|
Line 221 foreach (keys %DEFAULTVALUE) |
|
$barequery = ""; |
$barequery = ""; |
foreach (@stickyvars) { |
foreach (@stickyvars) { |
# construct a query string with the sticky non default parameters set |
# construct a query string with the sticky non default parameters set |
if (defined($input{$_}) && $input{$_} ne "" && $input{$_} ne $DEFAULTVALUE{$_}) { |
if (defined($input{$_}) && $input{$_} ne '' && |
if ($barequery) { |
!(defined($DEFAULTVALUE{$_}) && $input{$_} eq $DEFAULTVALUE{$_})) { |
|
if ($barequery) { |
$barequery = $barequery . "&"; |
$barequery = $barequery . "&"; |
} |
} |
my $thisval = urlencode($_) . "=" . urlencode($input{$_}); |
my $thisval = urlencode($_) . "=" . urlencode($input{$_}); |
|
|
|
|
# get #PR as link .. |
# get #PR as link .. |
if ($pr && defined($prcgi)) { |
if ($pr && defined($prcgi)) { |
1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1<A HREF="$prcgi?pr=$2">$2</A>`i; |
1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1<A HREF="$prcgi$2">$2</A>`i; |
$string =~ s`\b${prcategories}/(\d+)\b`<A HREF="$prcgi?pr=$1">$&</A>`igo; |
$string =~ s`\b${prcategories}/(\d+)\b`<A HREF="$prcgi$1">$&</A>`igo; |
} |
} |
|
|
return $string; |
return $string; |
|
|
Apache->request->status((split(/ /, $errcode))[0]); |
Apache->request->status((split(/ /, $errcode))[0]); |
} |
} |
else { |
else { |
print "Status: $errcode\n"; |
print "Status: $errcode\r\n"; |
} |
} |
html_header("Error"); |
html_header("Error"); |
print "Error: $errmsg\n"; |
print "Error: $errmsg\n"; |
|
|
Apache->request->header_out(Location => $url); |
Apache->request->header_out(Location => $url); |
} |
} |
else { |
else { |
print "Status: 301 Moved\n"; |
print "Status: 301 Moved\r\n"; |
print "Location: $url\n"; |
print "Location: $url\r\n"; |
} |
} |
html_header("Moved"); |
html_header("Moved"); |
print "This document is located <A HREF=$url>here</A>.\n"; |
print "This document is located <A HREF=$url>here</A>.\n"; |
Line 1468 sub getDirLogs { |
|
Line 1473 sub getDirLogs { |
|
if ($tag) { |
if ($tag) { |
#can't use -r<tag> as - is allowed in tagnames, but misinterpreated by rlog.. |
#can't use -r<tag> as - is allowed in tagnames, but misinterpreated by rlog.. |
if (! open($fh, "-|")) { |
if (! open($fh, "-|")) { |
close(STDERR); # rlog may complain; ignore. |
open(STDERR, '>/dev/null'); # rlog may complain; ignore. |
exec("rlog",@files); |
exec('rlog', @files); |
} |
} |
} |
} |
else { |
else { |
my $kidpid = open($fh, "-|"); |
my $kidpid = open($fh, "-|"); |
if (! $kidpid) { |
if (! $kidpid) { |
close(STDERR); # rlog may complain; ignore. |
open(STDERR, '>/dev/null'); # rlog may complain; ignore. |
exec("rlog","-r",@files); |
exec('rlog', '-r', @files); |
} |
} |
} |
} |
$state = "start"; |
$state = "start"; |
Line 2325 sub navigateHeader ($$$$$) { |
|
Line 2330 sub navigateHeader ($$$$$) { |
|
$swhere = urlencode($filename) if ($swhere eq ""); |
$swhere = urlencode($filename) if ($swhere eq ""); |
print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; |
print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; |
print "<HTML>\n<HEAD>\n"; |
print "<HTML>\n<HEAD>\n"; |
print '<!-- CVSweb $Revision$ -->'; |
print '<!-- CVSweb $zRevision: 1.93 $ $Revision$ -->'; |
print "\n<TITLE>$path$filename - $title - $rev</TITLE></HEAD>\n"; |
print "\n<TITLE>$path$filename - $title - $rev</TITLE></HEAD>\n"; |
print "<BODY BGCOLOR=\"$backcolor\">\n"; |
print "<BODY BGCOLOR=\"$backcolor\">\n"; |
print "<table width=\"100%\" border=0 cellspacing=0 cellpadding=1 bgcolor=\"$navigationHeaderColor\">"; |
print "<table width=\"100%\" border=0 cellspacing=0 cellpadding=1 bgcolor=\"$navigationHeaderColor\">"; |
Line 2631 sub http_header { |
|
Line 2636 sub http_header { |
|
Apache->request->header_out(Last_modified => scalar gmtime($moddate) . " GMT"); |
Apache->request->header_out(Last_modified => scalar gmtime($moddate) . " GMT"); |
} |
} |
else { |
else { |
print "Last-Modified: " . scalar gmtime($moddate) . " GMT\n"; |
print "Last-Modified: " . scalar gmtime($moddate) . " GMT\r\n"; |
} |
} |
} |
} |
if ($is_mod_perl) { |
if ($is_mod_perl) { |
Apache->request->content_type($content_type); |
Apache->request->content_type($content_type); |
} |
} |
else { |
else { |
print "Content-type: $content_type\n"; |
print "Content-type: $content_type\r\n"; |
} |
} |
if ($allow_compress && $maycompress) { |
if ($allow_compress && $maycompress) { |
my $fh = do {local(*FH);}; |
my $fh = do {local(*FH);}; |
Line 2649 sub http_header { |
|
Line 2654 sub http_header { |
|
Apache->request->send_http_header; |
Apache->request->send_http_header; |
} |
} |
else { |
else { |
print "Content-encoding: x-gzip\n"; |
print "Content-encoding: x-gzip\r\n"; |
print "Vary: Accept-Encoding\n"; #RFC 2068, 14.43 |
print "Vary: Accept-Encoding\r\n"; #RFC 2068, 14.43 |
print "\n"; # Close headers |
print "\r\n"; # Close headers |
} |
} |
$| = 1; $| = 0; # Flush header output |
$| = 1; $| = 0; # Flush header output |
select ($fh); |
select ($fh); |
Line 2662 sub http_header { |
|
Line 2667 sub http_header { |
|
Apache->request->send_http_header; |
Apache->request->send_http_header; |
} |
} |
else { |
else { |
print "\n"; # Close headers |
print "\r\n"; # Close headers |
} |
} |
print "<font size=-1>Unable to find gzip binary in the \$PATH to compress output</font><br>"; |
print "<font size=-1>Unable to find gzip binary in the \$PATH to compress output</font><br>"; |
} |
} |
Line 2672 sub http_header { |
|
Line 2677 sub http_header { |
|
Apache->request->send_http_header; |
Apache->request->send_http_header; |
} |
} |
else { |
else { |
print "\n"; # Close headers |
print "\r\n"; # Close headers |
} |
} |
} |
} |
} |
} |
|
|
sub html_header($) { |
sub html_header($) { |
my ($title) = @_; |
my ($title) = @_; |
my $version = '$Revision$'; |
my $version = '$zRevision: 1.93 $ $Revision$'; |
http_header(); |
http_header(); |
print <<EOH; |
print <<EOH; |
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" |
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" |