File:  [mozdev] / cdn / www / sources.html
Revision 1.37: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 00:43:24 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: current_mess, HEAD
quoth

    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: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp $
   23:   
   24:   require("include/CVS_PATHS");
   25: 
   26:   define(MAX_READ_SIZE, 500000);
   27:   define(MAX_READ, 100000);
   28: 
   29:   $today              = date("y/m/d");
   30:   $day = (int)date('d');
   31:   --$day;
   32:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   33:   $commit_log         = "cvs@$project.mozdev.org";
   34: 
   35: //  show_source(COMMIT_PATH.$commit_log);
   36: 
   37:   if(!$local_conf_commits) 
   38:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   39: 
   40:   //BEGIN BLOCK
   41:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   42: 
   43:     $size = filesize(COMMIT_PATH.$commit_log);
   44:     $contents = array();
   45:     if ($size > MAX_READ_SIZE) {
   46:       // print "<!-- Log File is greater than 500K -->\n";
   47: 
   48:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   49:       fseek($fp, $size - MAX_READ);
   50:       if ($contents) {
   51:         print "$contents\n";
   52:         exit;
   53:       }
   54:       $tok = strtok(fread($fp, MAX_READ),"\n");
   55:       while ($tok) {
   56:         array_push($contents, $tok);
   57:         $tok = strtok("\n");
   58:       }
   59:       fclose($fp);
   60:     } // echo '<pre>' . $contents[0] . '</pre>';
   61:     if (!$contents)
   62:       $contents = file(COMMIT_PATH.$commit_log);
   63:     $len=count($contents);
   64:     $r            = -1;
   65:   
   66:    // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
   67:     
   68:     $_project = $project;
   69:     
   70:     if ( !isset($doNotCapitalise) )
   71:     {
   72:       $_project = PROJECT;
   73:     }
   74:    
   75:    // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   76:     print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
   77:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   78: 
   79:     if($len) {
   80:       for($i=0;$i<$len;$i++) {
   81:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   82:           break;
   83: 
   84:         if(ereg("  Date: $yesterday", $contents[$i])) {
   85:        // if(ereg("  Date: $today", $contents[$i])) {
   86:           $r++;
   87:           $result[$r] = 
   88:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
   89:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
   90:           "</td></tr>\n" .
   91:           '<tr class="CVS-tr-date">' .
   92:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
   93:           "\n</td></tr>\n" .
   94:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
   95: 
   96:           for($l=$i+1;$l<$len;$l++) {
   97:             if(ereg("  Revision  Changes    Path", $contents[$l]))
   98:               break;
   99: 
  100:             if(ereg("  User:", $contents[$l]))
  101:               break;
  102: 
  103:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
  104:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l]));
  105: 
  106:             // '  Added:       www/img  background.png' 
  107:             // '  Modified:    www      cdn.css' 
  108:             // '  Removed:     www/protected sources.html'
  109:             // '               www/compact index.html' ?
  110: 
  111:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
  112: 
  113:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
  114:             {
  115:              // $checkins = trim($checkins);
  116: 
  117:               $identifier = trim(substr($checkins, 0, 14));
  118: 
  119:               $checkins = ereg_replace('[[:space:]]{1,}', ' ', substr($checkins, 14) );
  120: 
  121:               $checkinsA = explode(' ', $checkins);
  122: 
  123:               unset($checkins);
  124: 
  125:               for($z=0; $z < count($checkinsA); ++$z)
  126:               {
  127:                 $checkinsA[$z] = trim($checkinsA[$z]);
  128:               }
  129: 
  130:               $checkins = $identifier;
  131: 
  132:               $chkA1 = $checkinsA[0];
  133: 
  134:              // $webcvs .= '/' . $checkinsA[0];
  135: 
  136:               $webcvs = str_replace('//', '/', $webcvs);
  137:               $webcvs = str_replace(':/', '://', $webcvs);
  138: 
  139:              // $webcvs = ereg_replace('[^\:]+//', '/', $webcvs); // sillier : )
  140: 
  141:               if(!empty($chkA1))
  142:               {
  143:                 $checkins .= ' <a href="' . $webcvs;
  144:                 $checkins .= '">' . $chkA1 . '</a>';
  145:               }
  146: 
  147:              // reset($checkinsA);
  148: 
  149:               $webcvs .= array_shift($checkinsA);
  150: 
  151:               for($y=0; $y < count($checkinsA); ++$y)
  152:               {
  153:                 $checkins .= ' <a href="' . $webcvs . '/' . $chkA1 . $checkinsA[$y] . '">';
  154:                 $checkins .= $checkinsA[$y] . '</a>';
  155:               }
  156:             }
  157: 
  158:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
  159:             "</div>\n";
  160:           }
  161: 
  162:           $result[$r]     .= "</td></tr>\n";
  163:         }
  164:       }
  165:     }
  166: 
  167:   if(!$result) {  
  168:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  169:   } else {
  170:     $reversed=array_reverse($result);
  171:     for($i=0;$i<count($result);$i++)
  172:       PRINT $reversed[$i];
  173:   }
  174: 
  175:     print "</table>\n\n";
  176: 
  177:   } //END BLOCK
  178: ?>

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