File:  [mozdev] / cdn / www / sources.html
Revision 1.112: download - view: text, annotated - select for diffs - revision graph
Sun Feb 23 11:43:45 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
r 1.100

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

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