File:  [mozdev] / cdn / www / sources.html
Revision 1.108: download - view: text, annotated - select for diffs - revision graph
Sat Feb 22 22:36:49 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
ab

    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; // $project='orbits'; // testing ?>
   19: 
   20: <?php 
   21: 
   22: // $Id: sources.html,v 1.108 2003/02/22 22:36:49 cdn Exp $
   23: // $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$
   24:   
   25:   require("include/CVS_PATHS");
   26: 
   27:   define(MAX_READ_SIZE, 500000);
   28:   define(MAX_READ, 100000);
   29: 
   30:   $today              = date("y/m/d");
   31:   $day = (int)date('d');
   32:   --$day; // --$day;
   33:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   34:   $commit_log         = "cvs@$project.mozdev.org";
   35: 
   36: function cvs_parse ($content, $ii, $day, $len) {
   37: 
   38:   $result[0] = 'cvs_parse($contents, ' . $day . ', ' . $len . ')' . $content[0];
   39: 
   40:     $r            = -1;
   41: 
   42:        // if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
   43:        // if(ereg("  Date: $yesterday", $contents[$i])) {
   44:        // if(ereg("  Date: $today", $contents[$i])) {
   45: 
   46:        if (ereg("  Date: $day", $content[$ii])) {
   47:           $r++;
   48: 
   49:   $result[1] = 'cvs_parse(); : ';
   50: 
   51:           $yy = substr(YEAR, 0, 2);
   52: 
   53:           $_timestamp = str_replace('Date: ', '', ltrim($content[$ii]));
   54:           $_timestamp = str_replace("\n", '', $_timestamp);
   55: 
   56:           $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
   57: 
   58:           $_timestamp = '<a name="' . $_ts_link . '">'; 
   59: 
   60:           $result[$r] = '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n";
   61: 
   62: // who
   63:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($content[$ii-1]) . "</a></strong>\n" . // who
   64:           "</td></tr>\n" .
   65:           '<tr class="CVS-tr-date">' .
   66:           '<td class="CVS-td-f90">' . "\n";
   67: 
   68:           $_time = htmlspecialchars($content[$ii]);
   69: 
   70: // when
   71:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>'; // when
   72: 
   73:           $result[$r] .= "\n</td></tr>\n" .
   74:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
   75: 
   76:           $webcvs = 'http://www.mozdev.org/source/browse/' . $project;
   77: 
   78:           for($l=$i+1;$l<$len;$l++) {
   79:             if(ereg("  Revision  Changes    Path", $content[$l]))
   80:               break;
   81: 
   82:             if(ereg("  User:", $content[$l]))
   83:               break;
   84: 
   85:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
   86:             "<a href=\"\\1\">\\1</a>", htmlspecialchars($content[$l]));
   87: 
   88:             // '  Added:       www/img  background.png' 
   89:             // '  Modified:    www      cdn.css' 
   90:             // '  Removed:     www/protected sources.html'
   91:             // '               www/compact index.html'
   92:             // '  mozpos/downloads - New directory'
   93: 
   94:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
   95:                  strstr($checkins, "New directory")
   96:                ) {
   97: 
   98:               if ( !strstr($checkins, "New directory") ) {
   99:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  100: 
  101:                 $checkins = substr($checkins, 15);
  102:               }
  103:               else {
  104:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  105: 
  106:                 $webcvs = 'http://www.mozdev.org/source/browse';
  107: 
  108:                 unset($identifier);
  109:               }
  110: 
  111:               $_16 = strpos($checkins, ' ');
  112: 
  113:               $_path = substr( $checkins, 0, $_16);
  114: 
  115:               $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );
  116: 
  117:               $checkinsA = explode(' ', $checkins);
  118: 
  119:               unset($checkins);
  120: 
  121:               for($z=0; $z < count($checkinsA); ++$z) {
  122:                 $checkinsA[$z] = trim($checkinsA[$z]);
  123:               }
  124: 
  125:               if ( !empty($identifier) ) {
  126:                 $checkins = $identifier;
  127:               }
  128: 
  129:               if ( !empty($_path)) {
  130:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
  131:                 $webcvs .= '/' . $_path;
  132:                 $_path_ = $_path;
  133:                 $checkins .= ' <a href="' . $webcvs;
  134:                 $checkins .= '">' . $_path . '</a>';
  135:               }
  136: 
  137:               for($y=0; $y < count($checkinsA); ++$y) {
  138: 
  139:                 if (ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  140:                      strstr($checkinsA[$y], '-_New_directory')
  141:                    ) {
  142:                   $TAG = true;
  143:                 }
  144:                 else {
  145:                   $TAG = false;
  146:                 }
  147: 
  148:                 if (!$TAG) {
  149:                   $checkins .= ' <a href="' . $webcvs . '/';
  150: 
  151:                   if ( $identifier == 'Removed:' || $idRemoved ) {
  152:                     $checkins .= 'Attic/';
  153:                   }
  154: 
  155:                   $checkins .= $checkinsA[$y] . '">';
  156:                 }
  157:                 else {
  158:                   $checkins .= ' ';
  159:                 }
  160: 
  161:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  162: 
  163:                 $checkins .= $checkinsA[$y];
  164: 
  165:                 if ( ereg("Tag\:$", trim($checkinsA[$y])) && empty($checkinsA[$y+1])) {
  166:                   $_tag = true;
  167:                 }
  168:                 else {
  169:                   $_tag = false;
  170:                 }
  171: 
  172:                 if(!$TAG) {
  173:                  $checkins .= '</a>';
  174:                 }
  175: 
  176:               }
  177: 
  178:               if ( $identifier == 'Removed:' ) {
  179:                 $idRemoved = true;
  180:               }
  181:               else {
  182:                 $idRemoved = false;
  183:               }
  184: 
  185:             }
  186: 
  187: // what
  188:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins . "</div>\n"; // what
  189:           }
  190: 
  191:           $result[$r]     .= "</td></tr>\n";
  192:         }
  193: 
  194:   return $result;
  195: }
  196:   
  197:  //   $today = '03/02/14';
  198: 
  199:   if(!$local_conf_commits) {
  200:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
  201:   }
  202: 
  203:   //BEGIN BLOCK
  204:  //
  205:    if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
  206:  //  if(file_exists('/tmp/commit_test') && $local_conf_commits) { 
  207: 
  208:     $size = filesize(COMMIT_PATH.$commit_log);
  209:    // $size = filesize('/tmp/commit_test');
  210:     $contents = array();
  211:     if ($size > MAX_READ_SIZE) {
  212:       // print "<!-- Log File is greater than 500K -->\n";
  213: 
  214:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
  215:       fseek($fp, $size - MAX_READ);
  216:       if ($contents) {
  217:         print "$contents\n";
  218:         exit;
  219:       }
  220:       $tok = strtok(fread($fp, MAX_READ),"\n");
  221:       while ($tok) {
  222:         array_push($contents, $tok);
  223:         $tok = strtok("\n");
  224:       }
  225:       fclose($fp);
  226:     }
  227:     
  228:     if (!$contents) {
  229:      //
  230:       $contents = file(COMMIT_PATH.$commit_log);
  231:      //      $contents = file('/tmp/commit_test'); // echo 'boing '; echo $contents;
  232:     }
  233: 
  234:     // preprocess Tag: stuff
  235:     
  236:     // /preprocess Tag: stuff
  237:     
  238:     $len=count($contents);
  239:     
  240:     $_project = $project;
  241:     
  242:     if ( !isset($doNotCapitalise) ) {
  243:       $_project = PROJECT;
  244:     }
  245:    
  246:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
  247:    // print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
  248:    // print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n";
  249:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
  250: 
  251:     if($len) {
  252:       for($i=0;$i<$len;$i++) {
  253:         if(ereg("Modified:    www", $contents[$i]) && !$local_conf_commits)
  254:           break;
  255: 
  256: //start of parse of commitlog for $today / $yesterday
  257: 
  258:         $result = cvs_parse($contents, $i, $today, $len);
  259: 
  260: // end  of parse of commitlog for $today / $yesterday
  261: 
  262:       }
  263:     }
  264: 
  265:   if(!$result) {  
  266:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  267:   } else {
  268:     $reversed=array_reverse($result);
  269:     for($i=0;$i<count($result);$i++)
  270:       PRINT $reversed[$i];
  271:   }
  272: 
  273:     print "</table>\n\n";
  274: 
  275:   } //END BLOCK
  276: ?>

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