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

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

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