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 (16 years, 2 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
alt approach

    1: <!-- MAIN CONTENT -->
    2: <h5 class="page-header">Source Code</h5>
    3: 
    4: <p>
    5:   The cdn source code can be accessed in either of the following ways:
    6: </p>
    7: 
    8: <ul>
    9: <li>View the source using the CVS <a href="http://www.mozdev.org/source/browse/cdn/">web interface</a></li>
   10: <li>Check out the source using anonymous CVS with the following commands (password is guest):
   11: 
   12: <pre>
   13: cvs -d :pserver:guest@mozdev.org:/cvs login
   14: cvs -d :pserver:guest@mozdev.org:/cvs co cdn
   15: </pre>
   16: 
   17: </li>
   18: </ul><?php $doNotCapitalise = 1; ?>
   19: 
   20: <?php 
   21: 
   22: // $Id: sources2.html,v 1.16 2003/02/22 20:53:42 cdn Exp $
   23: 
   24: // $cvsId: sources2.html,v 1.10 2003/02/22 05:36:50 alanjstr Exp svc$
   25:   
   26:   require("include/CVS_PATHS");
   27: 
   28:   define(MAX_READ_SIZE, 500000);
   29:   define(MAX_READ, 100000);
   30: 
   31:   $today              = date("y/m/d"); 
   32:   $commit_log         = "cvs@$project.mozdev.org";
   33: 
   34: //  show_source(COMMIT_PATH.$commit_log);
   35: 
   36:   if(!$local_conf_commits) 
   37:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   38: 
   39:   //BEGIN BLOCK
   40:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   41: 
   42:     $size = filesize(COMMIT_PATH.$commit_log);
   43:     $contents = array();
   44:     if ($size > MAX_READ_SIZE) {
   45:       // print "<!-- Log File is greater than 500K -->\n";
   46: 
   47:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   48:       fseek($fp, $size - MAX_READ);
   49:       if ($contents) {
   50:         print "$contents\n";
   51:         exit;
   52:       }
   53:       $tok = strtok(fread($fp, MAX_READ),"\n");
   54:       while ($tok) {
   55:         array_push($contents, $tok);
   56:         $tok = strtok("\n");
   57:       }
   58:       fclose($fp);
   59:     } // echo '<pre>' . $contents[0] . '</pre>';
   60:     if (!$contents)
   61:       $contents = file(COMMIT_PATH.$commit_log);
   62:     $len=count($contents);
   63:     $r            = -1;
   64:   
   65:    // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
   66:     
   67:     $_project = $project;
   68:     
   69:     if ( !isset($doNotCapitalise) )
   70:     {
   71:       $_project = PROJECT;
   72:     }
   73:    
   74:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   75:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table2">' . "\n";
   76:     print '<tr><th>When</th><th>Who</th><th>File</th><th>Rev</th><th>+/-</th><th>Description</th></tr>' . "\n";
   77: 
   78:     if($len) {
   79:       for($i=0;$i<$len;$i++) {
   80:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   81:           break;
   82: 
   83:         if(ereg("Log:\n", $contents[$l]))
   84:           break;
   85: 
   86:         if(ereg("  Date: $today", $contents[$i])) {
   87:           $r++;
   88:           $When = eregi_replace("Date: ",     "", trim(htmlspecialchars($contents[$i]  )));
   89:           $Who  = eregi_replace("User: ",     "", trim(htmlspecialchars($contents[$i-1])));
   90:           $What = eregi_replace("Modified: ", "", trim(htmlspecialchars($contents[$i+1])));
   91:           $What = eregi_replace("Added: ",    "",     $What);
   92:          // $What = eregi_replace("Log\:\n",    "",     $What);
   93:           $What = eregi_replace("   www      ",  "www/", $What); //doesn't work for files outside www, or multiple checkins
   94: 
   95:          // $What = eregi_replace("[^[:space:]]      ",  "\\1/", $What); // doesn't work - but then whois surprised : )
   96: 
   97:           $Why  = trim(htmlspecialchars($contents[$i+3]));
   98: 
   99:           $result[$r] = '<tr>';
  100:           $result[$r] .= '<td>' . $When . '</td>';
  101:           $result[$r] .= '<td>' . $Who  . '</td>';
  102:           $result[$r] .= '<td>' . $What . '</td>';
  103:           $result[$r] .= '<td>' . '</td>'; // Rev
  104:           $result[$r] .= '<td>' . '</td>'; // plus/minus
  105:           $result[$r] .= '<td>' . $Why  . '</td>';
  106:           $result[$r] .= '</tr>' . "\n";
  107:         }
  108:       }
  109:     }
  110: 
  111:   if(!$result) {  
  112:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  113:   } else {
  114:     $reversed=array_reverse($result);
  115:     for($i=0;$i<count($result);$i++)
  116:       PRINT $reversed[$i];
  117:   }
  118: 
  119:     print "</table>\n\n";
  120: 
  121:   } //END BLOCK
  122: ?>

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