File:  [mozdev] / cdn / www / sources.html
Revision 1.138: download - view: text, annotated - select for diffs - revision graph
Thu Feb 27 14:11:01 2003 UTC (16 years, 4 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
yesterday instead

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

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