File:  [mozdev] / cdn / www / sources.html
Revision 1.96: download - view: text, annotated - select for diffs - revision graph
Sat Feb 22 11:56:31 2003 UTC (16 years, 9 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
orbits has branches everywhere

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

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