File:  [mozdev] / cdn / www / sources.html
Revision 1.88: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 20:59:17 2003 UTC (14 years, 9 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
tag/tg

<!-- MAIN CONTENT -->
<h5 class="page-header">Source Code</h5>

<p>
  The cdn source code can be accessed in either of the following ways:
</p>

<ul>
<li>View the source using the CVS <a href="http://www.mozdev.org/source/browse/cdn/">web interface</a></li>
<li>Check out the source using anonymous CVS with the following commands (password is guest):

<pre>
cvs -d :pserver:guest@mozdev.org:/cvs login
cvs -d :pserver:guest@mozdev.org:/cvs co cdn
</pre>

</li>
</ul><?php $doNotCapitalise = 1; // $project='orbits'; // testing ?>

<?php 

// $Id: sources.html,v 1.88 2003/02/21 20:59:17 cdn Exp $
// $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$
  
  require("include/CVS_PATHS");

  define(MAX_READ_SIZE, 500000);
  define(MAX_READ, 100000);

  $today              = date("y/m/d");
  $day = (int)date('d');
  --$day;
  $yesterday          = date("y/m/" . sprintf('%2u', $day));
  $commit_log         = "cvs@$project.mozdev.org";

 //  $today = '03/02/14';

  if(!$local_conf_commits) 
    print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";

  //BEGIN BLOCK
 //
   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
 //  if(file_exists('/tmp/commit_test') && $local_conf_commits) { 

    $size = filesize(COMMIT_PATH.$commit_log);
   // $size = filesize('/tmp/commit_test');
    $contents = array();
    if ($size > MAX_READ_SIZE) {
      // print "<!-- Log File is greater than 500K -->\n";

      $fp = fopen (COMMIT_PATH.$commit_log, "r");
      fseek($fp, $size - MAX_READ);
      if ($contents) {
        print "$contents\n";
        exit;
      }
      $tok = strtok(fread($fp, MAX_READ),"\n");
      while ($tok) {
        array_push($contents, $tok);
        $tok = strtok("\n");
      }
      fclose($fp);
    }
    
    if (!$contents)
    {
     //
      $contents = file(COMMIT_PATH.$commit_log);
     //      $contents = file('/tmp/commit_test'); // echo 'boing '; echo $contents;
    }

    // preprocess Tag: stuff
    
   //
    $stnetnoc = implode('', $contents);
    
   //       $contents = ereg_replace('Tag\:[[:space:]]{1,}', 'Tag: ', $stnetnoc);

    //
    // '_[_cdn_]_  Log:'
    // '_[_cdn_]_  Tag: ...'
    
   //    $contents = ereg_replace('Log\:[[:space:]]{1,}Tag', "Log\:\n  Tg", $contents);
   //
          $contents = str_replace("Log:\n  Tag", "Log:\n  Tg", $contents);

    //
    // '_[_cdn_]_  Log:'
    // '_[_cdn_]_  Tg: ...'
    
   //       $stnetnoc = ereg_replace("Tag\:\ [^[:space:]\.]{1,}\ ", "\\0\n                        ", $contents);
    // needs to not process 'Tag:' if in a commemt, i.e. it follows 'Log:'
    
   //    $stetnoc = ereg_replace("Log\:[[:space:]]{1,}Tg", "Log\:\n  Tag", $stetnoc);
   //     $stetnoc = str_replace("Log:\n  Tg", "Log\:\n  Tag", $stetnoc);
        $stetnoc = str_replace("Log:\n  Tg", "Log\:\n  Tag", $contents);

   //
       $contents = explode("\n", $stnetnoc);
    
    // /preprocess Tag: stuff
    
    $len=count($contents);
    $r            = -1;
  
    
    $_project = $project;
    
    if ( !isset($doNotCapitalise) )
    {
      $_project = PROJECT;
    }
   
   // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
    print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
   // print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n";
    print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";

    if($len) {
      for($i=0;$i<$len;$i++) {
        if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
          break;

       // if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
       // if(ereg("  Date: $yesterday", $contents[$i])) {
        if(ereg("  Date: $today", $contents[$i])) {
          $r++;

          $_i = $i + 1;

          $yy = substr(YEAR, 0, 2);

          $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
          $_timestamp = str_replace("\n", '', $_timestamp);

          $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);

          $_timestamp = '<a name="' . $_ts_link . '">'; 

          $result[$r] = 
          '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
          "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" . // who
          "</td></tr>\n" .
          '<tr class="CVS-tr-date">' .
          '<td class="CVS-td-f90">' . "\n";

          $_time = htmlspecialchars($contents[$i]);

          $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>'; // when

          $result[$r] .= "\n</td></tr>\n" .
          '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";

            $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';

          for($l=$i+1;$l<$len;$l++) {
            if(ereg("  Revision  Changes    Path", $contents[$l]))
              break;

            if(ereg("  User:", $contents[$l]))
              break;

            $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
            "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));

            // '  Added:       www/img  background.png' 
            // '  Modified:    www      cdn.css' 
            // '  Removed:     www/protected sources.html'
            // '               www/compact index.html' ?

            if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) )
            {

              $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group

              $checkins = substr($checkins, 15);

              // find first non-space character
              // if > 16, chances are the files are in the directory defined in the previous line ?

              $_16 = strpos($checkins, ' ');

              $_path = substr( $checkins, 0, $_16);

              $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );

              $checkinsA = explode(' ', $checkins);

              unset($checkins);

              for($z=0; $z < count($checkinsA); ++$z)
              {
                $checkinsA[$z] = trim($checkinsA[$z]);
              }

              if ( !empty($identifier) )
                $checkins = $identifier;

              if ( !empty($_path))
              {
                $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
                $webcvs .= '/' . $_path;
                $_path_ = $_path;
                $checkins .= ' <a href="' . $webcvs;
                $checkins .= '">' . $_path . '</a>';
              }

              for($y=0; $y < count($checkinsA); ++$y)
              {

                if (ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]))
                {
                  $TAG = true;
                }
                else
                {
                  $TAG = false;
                }

                if(!$TAG)
                {
                  $checkins .= ' <a href="' . $webcvs . '/';

                  if($identifier == 'Removed:'): $checkins .= 'Attic/'; endif;

                  $checkins .= $checkinsA[$y] . '">';
                }
                else
                {
                  $checkins .= ' ';  ++$_tagtracker;
                }

                $checkins .= $checkinsA[$y];

                if(!$TAG): $checkins .= '</a>'; endif;

              }

            }

            $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
            "</div>\n"; // what
          }

          $result[$r]     .= "</td></tr>\n";
        }
      }
    }

  if(!$result) {  
    print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  } else {
    $reversed=array_reverse($result);
    for($i=0;$i<count($result);$i++)
      PRINT $reversed[$i];
  }

    print "</table>\n\n";

  } //END BLOCK
?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>