File:  [mozdev] / cdn / www / sources.html
Revision 1.77: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 20:30:28 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
Tag: monkeys

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

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