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

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

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