File:  [mozdev] / cdn / www / sources.html
Revision 1.111: download - view: text, annotated - select for diffs - revision graph
Sun Feb 23 11:42:01 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

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

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