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

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