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

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

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