[BACK]Return to cvsweb.cgi CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / cvsweb

Diff for /cvsweb/cvsweb.cgi between version 1.1.1.37 and 4.5

version 1.1.1.37, 2007/03/17 21:52:33 version 4.5, 2019/11/09 09:24:13
Line 1 
Line 1 
 #!/usr/bin/perl -T  #!/usr/bin/perl
   # $Id$
   # $knu: cvsweb.cgi,v 1.299 2010/11/13 16:37:18 simon
 #  #
 # cvsweb - a CGI interface to CVS trees.  # cvsweb - a CGI interface to CVS trees.
 #  #
Line 44 
Line 46 
 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 # 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.
 #  
 # $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.295 2005/09/25 20:28:51 scop Exp $  
 # $zId: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $  
 # $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $  
 #  
 ###  
   
 require 5.006;  require 5.006;
   
 use strict;  use strict;
   
 use warnings;  use warnings;
 use filetest qw(access);  use filetest qw(access);
   
Line 69  use vars qw (
Line 64  use vars qw (
   @revisions %state %difflines %log %branchpoint @revorder $keywordsubstitution    @revisions %state %difflines %log %branchpoint @revorder $keywordsubstitution
   $prcgi @prcategories $re_prcategories $prkeyword $re_prkeyword $mancgi    $prcgi @prcategories $re_prcategories $prkeyword $re_prkeyword $mancgi
   $doCheckout $scriptname $scriptwhere    $doCheckout $scriptname $scriptwhere
   $where $Browser $nofilelinks $maycompress @stickyvars %funcline_regexp    $where $Browser $nofilelinks $maycompress @stickyvars
   $is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased    $is_links $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 $defaultDiffType $logsort $cvstree $cvsroot    $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot
Line 92  use vars qw (
Line 87  use vars qw (
 );  );
   
 use Cwd                   qw(abs_path);  use Cwd                   qw(abs_path);
 use File::Basename        qw(dirname);  
 use File::Path            qw(rmtree);  use File::Path            qw(rmtree);
 use File::Spec::Functions qw(canonpath catdir catfile curdir devnull rootdir  use File::Spec::Functions qw(canonpath catdir catfile curdir devnull rootdir
                              tmpdir updir);                               tmpdir updir);
Line 208  sub checkout_to_temp($$$);
Line 202  sub checkout_to_temp($$$);
 # (think mod_perl)...  # (think mod_perl)...
 delete(@ENV{qw(PATH IFS CDPATH ENV BASH_ENV)});  delete(@ENV{qw(PATH IFS CDPATH ENV BASH_ENV)});
   
 my ($mydir) = (dirname($0) =~ /(.*)/);    # untaint  # Location of the configuration file inside the web server chroot:
   $config = '/conf/cvsweb/cvsweb.conf';
   
 ##### Start of Configuration Area ########  
   
 # == EDIT this ==  
 # Locations to search for user configuration, in order:  
 for (catfile($mydir, 'cvsweb.conf'), '/usr/local/etc/cvsweb/cvsweb.conf') {  
   if (-r $_) {  
     $config = $_;  
     last;  
   }  
 }  
   
 ##### End of Configuration Area   ########  
   
 undef $mydir;  
   
 ######## Configuration parameters #########  ######## Configuration parameters #########
   
 @CVSrepositories = @CVSROOT = %CVSROOT = %MIRRORS = %DEFAULTVALUE = %ICONS =  @CVSrepositories = @CVSROOT = %CVSROOT = %MIRRORS = %DEFAULTVALUE = %ICONS =
Line 241  $cvstreedefault = $logo = $defaulttitle =
Line 221  $cvstreedefault = $logo = $defaulttitle =
   
 $allow_version_select = $allow_mailtos = $allow_log_extra = 1;  $allow_version_select = $allow_mailtos = $allow_log_extra = 1;
   
 @DIFFTYPES = qw(h H u c s);  @DIFFTYPES = qw(h H u c);
 @DIFFTYPES{@DIFFTYPES} = (  @DIFFTYPES{@DIFFTYPES} = (
   {    {
     'descr'   => 'colored',      'descr'   => 'colored',
Line 263  $allow_version_select = $allow_mailtos = $allow_log_ex
Line 243  $allow_version_select = $allow_mailtos = $allow_log_ex
     'opts'    => ['-c'],      'opts'    => ['-c'],
     'colored' => 0,      'colored' => 0,
   },    },
   {  
     'descr'   => 'side by side',  
     # width=168 should be enough to support 80 character line lengths  
     'opts'    => ['--side-by-side', '--width=168'],  
     'colored' => 0,  
   },  
 );  );
   
 @LOGSORTKEYS = qw(cvs date rev);  @LOGSORTKEYS = qw(cvs date rev);
Line 559  foreach (@stickyvars) {
Line 533  foreach (@stickyvars) {
 }  }
   
 if ($allow_enscript) {  if ($allow_enscript) {
   push(@DIFFTYPES, qw(uc cc sc));    push(@DIFFTYPES, qw(uc cc));
   @DIFFTYPES{qw(uc cc sc)} = (    @DIFFTYPES{qw(uc cc)} = (
     {      {
      'descr'   => 'unified, colored',       'descr'   => 'unified, colored',
      'opts'    => ['-u'],       'opts'    => ['-u'],
Line 571  if ($allow_enscript) {
Line 545  if ($allow_enscript) {
      'opts'    => ['-c'],       'opts'    => ['-c'],
      'colored' => 0,       'colored' => 0,
     },      },
     {  
      'descr'   => 'side by side, colored',  
      # width=168 should be enough to support 80 character line lengths  
      'opts'    => ['--side-by-side', '--width=168'],  
      'colored' => 0,  
     },  
   );    );
 } else {  } else {
   # No Enscript -> respect difftype, but don't offer colorization.    # No Enscript -> respect difftype, but don't offer colorization.
Line 883  if (-d $fullname) {
Line 851  if (-d $fullname) {
   
   my $infocols = 1;    my $infocols = 1;
   
   printf(<<EOF, 'Directory index of ' . htmlquote($where));    printf(<<EOF, $tablepadding, 'Directory index of ' . htmlquote($where));
 <table class="dir" width="100%%" cellspacing="0" cellpadding="$tablepadding" summary="%s">  <table class="dir" width="100%%" cellspacing="0" cellpadding="%s" summary="%s">
 <tr>  <tr>
 EOF  EOF
   printf('<th colspan="2"%s>', ($byfile ? ' class="sorted"' : ''));    printf('<th colspan="2"%s>', ($byfile ? ' class="sorted"' : ''));
Line 1028  EOF
Line 996  EOF
   
       # Show last change in dir        # Show last change in dir
       if ($filename) {        if ($filename) {
         print "</td>\n<td>&nbsp;</td>\n<td class=\"age\">";          my $ageclass = 'age';
         print readableTime(time() - $date, 0) if $date;          my $age      = '';
           if ($date) {
             $age       = readableTime(time() - $date, 0);
             $ageclass .= " $1" if ($age =~ /^\d+ ([a-z]+)/);
           }
           print "</td>\n<td>&nbsp;</td>\n<td class=\"$ageclass\">$age";
         print "</td>\n<td class=\"author\">", htmlquote($author)          print "</td>\n<td class=\"author\">", htmlquote($author)
           if $show_author;            if $show_author;
         print "</td>\n<td class=\"log\">";          print "</td>\n<td class=\"log\">";
Line 1084  EOF
Line 1057  EOF
       print '&nbsp;', &link(htmlquote($file), $url), $attic;        print '&nbsp;', &link(htmlquote($file), $url), $attic;
       print '</td><td class="graph">', graph_link($fileurl) if $allow_cvsgraph;        print '</td><td class="graph">', graph_link($fileurl) if $allow_cvsgraph;
       print "</td>\n<td width=\"30\">", display_link($fileurl, $rev);        print "</td>\n<td width=\"30\">", display_link($fileurl, $rev);
       print "</td>\n<td class=\"age\">";        my $ageclass = 'age';
       print readableTime(time() - $date, 0) if $date;        my $age      = '';
         if ($date) {
           $age       = readableTime(time() - $date, 0);
           $ageclass .= " $1" if ($age =~ /^\d+ ([a-z]+)/);
         }
         print "</td>\n<td class=\"$ageclass\">$age";
       print "</td>\n<td class=\"author\">", htmlquote($author) if $show_author;        print "</td>\n<td class=\"author\">", htmlquote($author) if $show_author;
       print "</td>\n<td class=\"log\">";        print "</td>\n<td class=\"log\">";
   
Line 1135  EOF
Line 1113  EOF
   if (scalar %tags || $input{only_with_tag}) {    if (scalar %tags || $input{only_with_tag}) {
     print "<form method=\"get\" action=\"./\">\n<p>\n";      print "<form method=\"get\" action=\"./\">\n<p>\n";
     foreach my $var (@stickyvars) {      foreach my $var (@stickyvars) {
       printf("<input type=\"hidden\" name=\"$var\" value=\"%s\" />\n",        printf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />\n",
              htmlquote($input{$var}))               $var, htmlquote($input{$var}))
         if (defined($input{$var})          if (defined($input{$var})
             && (!defined($DEFAULTVALUE{$var})              && (!defined($DEFAULTVALUE{$var})
                 || $input{$var} ne $DEFAULTVALUE{$var})                  || $input{$var} ne $DEFAULTVALUE{$var})
Line 1521  sub htmlify($;$)
Line 1499  sub htmlify($;$)
   
       do {        do {
         $prev = $_;          $prev = $_;
   
         $_ = htmlify_sub {          $_ = htmlify_sub {
           s{            s{
             (\b$re_prkeyword[:\#]?\s*              (\b$re_prkeyword[:\#]?\s*
Line 2314  sub doDiff($$$$$$)
Line 2291  sub doDiff($$$$$$)
   my @difftype       = @{$difftype->{opts}};    my @difftype       = @{$difftype->{opts}};
   my $human_readable = $difftype->{colored};    my $human_readable = $difftype->{colored};
   
   # Apply special diff options.  -p and -F are not available with side by side    # Apply special diff options.
   # diffs and may cause problems with older (< 2.8) versions of diffutils if    push @difftype, '-p' if $showfunc;
   # used with --side-by-side.  
   if ($showfunc && $f !~ /^s/) {  
     push(@difftype, '-p');  
     while (my ($re1, $re2) = each %funcline_regexp) {  
       if ($fullname =~ $re1) {  
         push(@difftype, '-F', $re2);  
         last;  
       }  
     }  
   }  
   
   if ($human_readable) {    if ($human_readable) {
     push(@difftype, '-w')  if $hr_ignwhite;      push(@difftype, '-w')  if $hr_ignwhite;
Line 2951  sub printLog($$$;$$)
Line 2918  sub printLog($$$;$$)
   print "<br />\n";    print "<br />\n";
   
   print '<i>';    print '<i>';
   if (defined @mytz) {    if (@mytz) {
     my ($est) = $mytz[(localtime($date{$_}))[8]];      my ($est) = $mytz[(localtime($date{$_}))[8]];
     print scalar localtime($date{$_}), " $est</i> (";      print scalar localtime($date{$_}), " $est</i> (";
   } else {    } else {
Line 3350  EOF
Line 3317  EOF
     next if ($_ eq "f");      next if ($_ eq "f");
     next if ($_ eq "only_with_tag");      next if ($_ eq "only_with_tag");
     next if ($_ eq "logsort");      next if ($_ eq "logsort");
     printf("<input type=\"hidden\" name=\"$_\" value=\"%s\" />\n",      printf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />\n",
            htmlquote($input{$_}))             $_, htmlquote($input{$_}))
       if (defined($input{$_})        if (defined($input{$_})
           && (!defined($DEFAULTVALUE{$_}) || $input{$_} ne $DEFAULTVALUE{$_}));            && (!defined($DEFAULTVALUE{$_}) || $input{$_} ne $DEFAULTVALUE{$_}));
   }    }
Line 3840  sub navigateHeader($$$$$;$)
Line 3807  sub navigateHeader($$$$$;$)
   my $qpath = htmlquote($path);    my $qpath = htmlquote($path);
   my $trev  = $rev ? " - " . htmlquote($rev) : '';    my $trev  = $rev ? " - " . htmlquote($rev) : '';
   
   http_header('', $moddate);    http_header('text/html', $moddate);
   
   print <<EOF;    print <<EOF;
 $HTML_DOCTYPE  $HTML_DOCTYPE
Line 4272  sub http_header(;$$)
Line 4239  sub http_header(;$$)
         || (defined($CMD{gzip}) && open(GZIP, "| $CMD{gzip} -1 -c")))          || (defined($CMD{gzip}) && open(GZIP, "| $CMD{gzip} -1 -c")))
     {      {
   
       push(@headers, 'Content-Encoding: x-gzip');        push(@headers, 'Content-Encoding: gzip');
       push(@headers, 'Vary: Accept-Encoding');     # RFC 2616, 14.44        push(@headers, 'Vary: Accept-Encoding');     # RFC 2616, 14.44
       print join("\r\n", @headers) . "\r\n\r\n";        print join("\r\n", @headers) . "\r\n\r\n";
   

Legend:
Removed from v.1.1.1.37  
changed lines
  Added in v.4.5

CVSweb