File:  [mozdev] / cdn / www / sources2.html
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Sat Feb 22 20:53:42 2003 UTC (14 years, 9 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
alt approach

<!-- 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; ?>

<?php 

// $Id: sources2.html,v 1.16 2003/02/22 20:53:42 cdn Exp $

// $cvsId: sources2.html,v 1.10 2003/02/22 05:36:50 alanjstr Exp svc$
  
  require("include/CVS_PATHS");

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

  $today              = date("y/m/d"); 
  $commit_log         = "cvs@$project.mozdev.org";

//  show_source(COMMIT_PATH.$commit_log);

  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) { 

    $size = filesize(COMMIT_PATH.$commit_log);
    $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);
    } // echo '<pre>' . $contents[0] . '</pre>';
    if (!$contents)
      $contents = file(COMMIT_PATH.$commit_log);
    $len=count($contents);
    $r            = -1;
  
   // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
    
    $_project = $project;
    
    if ( !isset($doNotCapitalise) )
    {
      $_project = PROJECT;
    }
   
    print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
    print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table2">' . "\n";
    print '<tr><th>When</th><th>Who</th><th>File</th><th>Rev</th><th>+/-</th><th>Description</th></tr>' . "\n";

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

        if(ereg("Log:\n", $contents[$l]))
          break;

        if(ereg("  Date: $today", $contents[$i])) {
          $r++;
          $When = eregi_replace("Date: ",     "", trim(htmlspecialchars($contents[$i]  )));
          $Who  = eregi_replace("User: ",     "", trim(htmlspecialchars($contents[$i-1])));
          $What = eregi_replace("Modified: ", "", trim(htmlspecialchars($contents[$i+1])));
          $What = eregi_replace("Added: ",    "",     $What);
         // $What = eregi_replace("Log\:\n",    "",     $What);
          $What = eregi_replace("   www      ",  "www/", $What); //doesn't work for files outside www, or multiple checkins

         // $What = eregi_replace("[^[:space:]]      ",  "\\1/", $What); // doesn't work - but then whois surprised : )

          $Why  = trim(htmlspecialchars($contents[$i+3]));

          $result[$r] = '<tr>';
          $result[$r] .= '<td>' . $When . '</td>';
          $result[$r] .= '<td>' . $Who  . '</td>';
          $result[$r] .= '<td>' . $What . '</td>';
          $result[$r] .= '<td>' . '</td>'; // Rev
          $result[$r] .= '<td>' . '</td>'; // plus/minus
          $result[$r] .= '<td>' . $Why  . '</td>';
          $result[$r] .= '</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>