File:  [mozdev] / cdn / www / sources.html
Revision 1.125: download - view: text, annotated - select for diffs - revision graph
Thu Feb 27 00:16:07 2003 UTC (16 years, 5 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
headers for Bonsai

    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.125 2003/02/27 00:16:07 cdn Exp $
   23: 
   24:   require("include/CVS_PATHS");
   25: 
   26:   define(MAX_READ_SIZE, 500000);
   27:   define(MAX_READ, 100000);
   28: 
   29:   $today              = date("y/m/d"); $today = '03/02/21';
   30:   $day = (int)date('d');
   31:   --$day;
   32:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   33:   $commit_log         = "cvs@$project.mozdev.org";
   34: 
   35:   if(!$local_conf_commits)
   36:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   37: 
   38:   //BEGIN BLOCK
   39:  
   40:    if(file_exists(COMMIT_PATH.$commit_log) && 
   41:       $local_conf_commits) {
   42: 
   43:      $size = filesize(COMMIT_PATH.$commit_log);
   44: 
   45:     $contents = array();
   46:     if ($size > MAX_READ_SIZE) {
   47:       // print "<!-- Log File is greater than 500K -->\n";
   48: 
   49:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   50:       fseek($fp, $size - MAX_READ);
   51:       if ($contents) {
   52:         print "$contents\n";
   53:         exit;
   54:       }
   55:       $tok = strtok(fread($fp, MAX_READ),"\n");
   56:       while ($tok) {
   57:         array_push($contents, $tok);
   58:         $tok = strtok("\n");
   59:       }
   60:       fclose($fp);
   61:     }
   62:     
   63:     if (!$contents)
   64:       $contents = file(COMMIT_PATH.$commit_log);
   65: 
   66:     // preprocess Tag: stuff would be here if it didn't mess
   67:     // things up completely
   68: 
   69:     $len=count($contents);
   70:     $r            = -1;
   71:     
   72:     $_project = $project;
   73:     
   74:     if ( !isset($doNotCapitalise) )
   75:       $_project = PROJECT;
   76:    
   77:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   78:     print '<div id="CVS-table">' . "\n";
   79: 
   80:     if($len) {
   81:       
   82:       print '<div class="CVS-block CVS-dft-hidden">' . "\n";
   83:       print '<div class="CVS-td-900">Who</div>' . "\n";
   84:       print '<div class="CVS-td-f90">When</div>' . "\n";
   85:       print '<div class="CVS-td-checkins">' . "\n" .
   86:             '<div class="CVS-checkins">' . "\n";
   87:       print 'What</div>';
   88:       print '<div class="CVS-log">';
   89:       print 'Why</div></div></div>';
   90:       print '<div style="clear: left; float: none;"></div>' . "\n";
   91: 
   92:       for($i=0;$i<$len;$i++) {
   93:         if(ereg("Modified:    www", $contents[$l]) &&
   94:            !$local_conf_commits)
   95:           break;
   96: 
   97: //start of parse of commitlog for $today / $yesterday
   98: 
   99:         if(ereg("  Date: $today", $contents[$i])) {
  100:           $r++;
  101: 
  102:           $yy = substr(YEAR, 0, 2);
  103: 
  104:           $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
  105:           $_timestamp = str_replace("\n", '', $_timestamp);
  106: 
  107:           $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
  108: 
  109:           $_timestamp = '<a name="' . $_ts_link . '">'; 
  110: 
  111:           $result[$r] = '<div class="CVS-block';
  112: 
  113:           if ($r == 0) 
  114:             $result[$r] .= ' CVS-last-block';
  115: 
  116:           $result[$r] .= '"><div class="CVS-td-900">' . "\n";
  117: 
  118: //who
  119:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
  120:           "</div>\n" .
  121:           '<div class="CVS-td-f90">' . "\n";
  122: 
  123:           $_time = htmlspecialchars($contents[$i]);
  124: 
  125: // when
  126:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
  127: 
  128:           $result[$r] = eregi_replace("(User|Date):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span> ", $result[$r]);
  129: 
  130:           $result[$r] .= "\n</div>\n" .
  131:           '<div class="CVS-td-checkins">' . "\n" .
  132:           '<div class="CVS-checkins">' . "\n";
  133: 
  134:           $webcvs = 'http://www.' . HOST . '/source/browse/' . $project;
  135: 
  136:           for($l=$i+1;$l<$len;$l++) {
  137:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  138:               break;
  139: 
  140:             if(ereg("  User:", $contents[$l]))
  141:               break;
  142: 
  143:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})",
  144:                         "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
  145: 
  146:             // '  Added:       www/img  background.png' 
  147:             // '  Modified:    www      cdn.css' 
  148:             // '  Removed:     www/protected sources.html'
  149:             // '               www/compact index.html'
  150:             // '  mozpos/downloads - New directory'
  151: 
  152:             if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) {
  153:               $idRemoved = false; $_log_section = true;
  154:              // $checkins = eregi_replace("(Log):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span>", $checkins);
  155:               $checkins = '</div>' . "\n" . '</div>' . "\n" .
  156:                           '<div class="CVS-log"><div class="CVS-bonsai-hidden">' . $checkins;
  157:             }
  158: 
  159:             if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
  160:                  strstr($checkins, "New directory")
  161:                ) {
  162: 
  163:               if ( !strstr($checkins, "New directory") ) {
  164:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  165: 
  166:                 $checkins = substr($checkins, 15);
  167: 
  168:                 $_New_directory = false;
  169:               }
  170:               else {
  171:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  172: 
  173:                 $webcvs = 'http://www.' . HOST . '/source/browse';
  174: 
  175:                 unset($identifier);
  176: 
  177:                 $_New_directory = true;
  178:               }
  179: 
  180:               $_16 = strpos($checkins, ' ');
  181: 
  182:               $_path = substr( $checkins, 0, $_16);
  183: 
  184:               $checkins = ereg_replace('[[:space:]]{1,}', ' ',
  185:                           trim( substr ( $checkins, $_16 ) ) );
  186: 
  187:               $checkinsA = explode(' ', $checkins);
  188: 
  189:               unset($checkins);
  190: 
  191:               for($z=0; $z < count($checkinsA); ++$z)
  192:                 $checkinsA[$z] = trim($checkinsA[$z]);
  193: 
  194:               if ( !empty($identifier) )
  195:                 $checkins = '<span class="CVS-bonsai-hidden">' . $identifier . '</span>';
  196: 
  197:               if ( !empty($_path)) {
  198:                 // reset, important !
  199:                 $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; 
  200:                 $webcvs .= '/' . $_path;
  201:                 $checkins .= ' <span class="CVS-bonsai-hidden"><a href="' . $webcvs;
  202:                 $checkins .= '">' . $_path . '</a></span>';
  203:               }
  204: 
  205:               $Y = count($checkinsA);
  206: 
  207:               for($y=0; $y < $Y; ++$y) {
  208: 
  209:                 if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  210:                      strstr($checkinsA[$y], '-_New_directory')
  211:                    )
  212:                   $TAG = true;
  213:                 else
  214:                   $TAG = false;
  215: 
  216:                 $checkins .= ' <span';
  217: 
  218:                 if ( !$_New_directory )
  219:                   $checkins .= ' class="CVS-dft-inline"';
  220: 
  221:                 if ( strstr($checkinsA[$y+1], '-_New_directory') )
  222:                   $checkins .= ' class="CVS-dft-inline"';
  223: 
  224:                 $checkins .= '>';
  225: 
  226:                 if(!$TAG) {
  227:                   $checkins .= '<a href="' . $webcvs . '/';
  228: 
  229:                   if( $identifier == 'Removed:' || $idRemoved )
  230:                     $checkins .= 'Attic/';
  231: 
  232:                   $checkins .= $checkinsA[$y] . '">';
  233:                 }
  234: 
  235:                 if ( !$_New_directory ) {
  236:                   $checkins .= '<span class="CVS-dft-hidden">'; // $project / $_path
  237:                   $_webcvs = str_replace('http://www.' . HOST . '/source/browse/', '', $webcvs);
  238: 
  239:                   if ( strlen($_webcvs) > 15 )
  240:                     $checkins .= substr($_webcvs, 0, 12) . '...' . substr($_webcvs, strrpos($_webcvs, '/'));
  241:                   else
  242:                     $checkins .= $_webcvs;
  243: 
  244:                   if( $identifier == 'Removed:' || $idRemoved )
  245:                     $checkins .= '/Attic';
  246: 
  247:                   $checkins .= '/</span>';
  248:                 }
  249: 
  250:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  251: 
  252:                 $checkins .= $checkinsA[$y];
  253: 
  254:                 if (ereg("Tag\:$", trim($checkinsA[$y])) &&
  255:                     empty($checkinsA[$y+1]))
  256:                   $_tag = true; 
  257:                 else
  258:                   $_tag = false;
  259: 
  260:                 if (!$TAG)
  261:                   $checkins .= '</a>';
  262: 
  263:                   $checkins .= '</span>';
  264: 
  265:               }
  266: 
  267:               if ( $identifier == 'Removed:' || $idRemoved )
  268:                 $idRemoved = true;
  269:               else
  270:                 $idRemoved = false;
  271: 
  272:             }
  273: 
  274:             $checkins = trim( str_replace('</span> <span>', ' ', $checkins) );
  275: 
  276:             if ( !ereg('^<d', $checkins) )
  277:               $checkins = '<div class="CVS-div-checkins">' . $checkins;
  278: // what
  279:             if ( !empty( $checkins ) )
  280:               $result[$r] .= $checkins . "</div>\n"; // what
  281:   
  282: 
  283:           }
  284: 
  285:             if ( $_log_section ) {
  286:               $_log_section = false;
  287:               $result[$r] .= '</div>';
  288:             }
  289: 
  290:           $result[$r] .= "</div>\n";
  291:           $result[$r] .= "</div>\n";
  292:           $result[$r] .= '<div style="clear: left; float: none;"></div>' . "\n";
  293:         }
  294: 
  295: // end  of parse of commitlog for $today / $yesterday
  296: 
  297:       }
  298:     }
  299: 
  300:     if (!$result) {  
  301:       print '<div id="CVS-no-commits">There are no new commits today</div>'."\n";
  302:     } else {
  303:       $reversed=array_reverse($result);
  304:       for ($i=0;$i<count($result);$i++)
  305:         print $reversed[$i];
  306: //        print $reversed[0];
  307:     }
  308: 
  309:     print "</div>\n\n";
  310: 
  311:   } // END BLOCK
  312: ?>

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