File:  [mozdev] / cdn / www / sources.html
Revision 1.90: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 21:03:00 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
expect breakage

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

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