File:  [mozdev] / cdn / www / sources.html
Revision 1.87: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 20:58:02 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
tag/tg on

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

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