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

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