File:  [mozdev] / cdn / www / sources.html
Revision 1.79: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 20:38:14 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
Tag: gremlins

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

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