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

    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.124 2003/02/27 00:00: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:       for($i=0;$i<$len;$i++) {
   82:         if(ereg("Modified:    www", $contents[$l]) &&
   83:            !$local_conf_commits)
   84:           break;
   85: 
   86: //start of parse of commitlog for $today / $yesterday
   87: 
   88:         if(ereg("  Date: $today", $contents[$i])) {
   89:           $r++;
   90: 
   91:           $yy = substr(YEAR, 0, 2);
   92: 
   93:           $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
   94:           $_timestamp = str_replace("\n", '', $_timestamp);
   95: 
   96:           $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
   97: 
   98:           $_timestamp = '<a name="' . $_ts_link . '">'; 
   99: 
  100:           $result[$r] = '<div class="CVS-block"><div class="CVS-td-900">' . "\n";
  101: 
  102: //who
  103:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
  104:           "</div>\n" .
  105:           '<div class="CVS-td-f90">' . "\n";
  106: 
  107:           $_time = htmlspecialchars($contents[$i]);
  108: 
  109: // when
  110:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
  111: 
  112:           $result[$r] = eregi_replace("(User|Date):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span> ", $result[$r]);
  113: 
  114:           $result[$r] .= "\n</div>\n" .
  115:           '<div class="CVS-td-checkins">' . "\n" .
  116:           '<div class="CVS-checkins">' . "\n";
  117: 
  118:           $webcvs = 'http://www.' . HOST . '/source/browse/' . $project;
  119: 
  120:           for($l=$i+1;$l<$len;$l++) {
  121:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  122:               break;
  123: 
  124:             if(ereg("  User:", $contents[$l]))
  125:               break;
  126: 
  127:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})",
  128:                         "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
  129: 
  130:             // '  Added:       www/img  background.png' 
  131:             // '  Modified:    www      cdn.css' 
  132:             // '  Removed:     www/protected sources.html'
  133:             // '               www/compact index.html'
  134:             // '  mozpos/downloads - New directory'
  135: 
  136:             if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) {
  137:               $idRemoved = false; $_log_section = true;
  138:              // $checkins = eregi_replace("(Log):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span>", $checkins);
  139:               $checkins = '</div>' . "\n" . '</div>' . "\n" .
  140:                           '<div class="CVS-log"><div class="CVS-bonsai-hidden">' . $checkins;
  141:             }
  142: 
  143:             if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
  144:                  strstr($checkins, "New directory")
  145:                ) {
  146: 
  147:               if ( !strstr($checkins, "New directory") ) {
  148:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  149: 
  150:                 $checkins = substr($checkins, 15);
  151: 
  152:                 $_New_directory = false;
  153:               }
  154:               else {
  155:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  156: 
  157:                 $webcvs = 'http://www.' . HOST . '/source/browse';
  158: 
  159:                 unset($identifier);
  160: 
  161:                 $_New_directory = true;
  162:               }
  163: 
  164:               $_16 = strpos($checkins, ' ');
  165: 
  166:               $_path = substr( $checkins, 0, $_16);
  167: 
  168:               $checkins = ereg_replace('[[:space:]]{1,}', ' ',
  169:                           trim( substr ( $checkins, $_16 ) ) );
  170: 
  171:               $checkinsA = explode(' ', $checkins);
  172: 
  173:               unset($checkins);
  174: 
  175:               for($z=0; $z < count($checkinsA); ++$z)
  176:                 $checkinsA[$z] = trim($checkinsA[$z]);
  177: 
  178:               if ( !empty($identifier) )
  179:                 $checkins = '<span class="CVS-bonsai-hidden">' . $identifier . '</span>';
  180: 
  181:               if ( !empty($_path)) {
  182:                 // reset, important !
  183:                 $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; 
  184:                 $webcvs .= '/' . $_path;
  185:                 $checkins .= ' <span class="CVS-bonsai-hidden"><a href="' . $webcvs;
  186:                 $checkins .= '">' . $_path . '</a></span>';
  187:               }
  188: 
  189:               $Y = count($checkinsA);
  190: 
  191:               for($y=0; $y < $Y; ++$y) {
  192: 
  193:                 if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  194:                      strstr($checkinsA[$y], '-_New_directory')
  195:                    )
  196:                   $TAG = true;
  197:                 else
  198:                   $TAG = false;
  199: 
  200:                 $checkins .= ' <span';
  201: 
  202:                 if ( !$_New_directory )
  203:                   $checkins .= ' class="CVS-dft-inline"';
  204: 
  205:                 if ( strstr($checkinsA[$y+1], '-_New_directory') )
  206:                   $checkins .= ' class="CVS-dft-inline"';
  207: 
  208:                 $checkins .= '>';
  209: 
  210:                 if(!$TAG) {
  211:                   $checkins .= '<a href="' . $webcvs . '/';
  212: 
  213:                   if( $identifier == 'Removed:' || $idRemoved )
  214:                     $checkins .= 'Attic/';
  215: 
  216:                   $checkins .= $checkinsA[$y] . '">';
  217:                 }
  218: 
  219:                 if ( !$_New_directory ) {
  220:                   $checkins .= '<span class="CVS-dft-hidden">'; // $project / $_path
  221:                   $_webcvs = str_replace('http://www.' . HOST . '/source/browse/', '', $webcvs);
  222: 
  223:                   if ( strlen($_webcvs) > 15 )
  224:                     $checkins .= substr($_webcvs, 0, 12) . '...' . substr($_webcvs, strrpos($_webcvs, '/'));
  225:                   else
  226:                     $checkins .= $_webcvs;
  227: 
  228:                   if( $identifier == 'Removed:' || $idRemoved )
  229:                     $checkins .= '/Attic';
  230: 
  231:                   $checkins .= '/</span>';
  232:                 }
  233: 
  234:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  235: 
  236:                 $checkins .= $checkinsA[$y];
  237: 
  238:                 if (ereg("Tag\:$", trim($checkinsA[$y])) &&
  239:                     empty($checkinsA[$y+1]))
  240:                   $_tag = true; 
  241:                 else
  242:                   $_tag = false;
  243: 
  244:                 if (!$TAG)
  245:                   $checkins .= '</a>';
  246: 
  247:                   $checkins .= '</span>';
  248: 
  249:               }
  250: 
  251:               if ( $identifier == 'Removed:' || $idRemoved )
  252:                 $idRemoved = true;
  253:               else
  254:                 $idRemoved = false;
  255: 
  256:             }
  257: 
  258:             $checkins = trim( str_replace('</span> <span>', ' ', $checkins) );
  259: 
  260:             if ( !ereg('^<d', $checkins) )
  261:               $checkins = '<div class="CVS-div-checkins">' . $checkins;
  262: // what
  263:             if ( !empty( $checkins ) )
  264:               $result[$r] .= $checkins . "</div>\n"; // what
  265:   
  266: 
  267:           }
  268: 
  269:             if ( $_log_section ) {
  270:               $_log_section = false;
  271:               $result[$r] .= '</div>';
  272:             }
  273: 
  274:           $result[$r] .= "</div>\n";
  275:           $result[$r] .= "</div>\n";
  276:           $result[$r] .= '<div style="clear: left; float: none;"></div>' . "\n";
  277:         }
  278: 
  279: // end  of parse of commitlog for $today / $yesterday
  280: 
  281:       }
  282:     }
  283: 
  284:     if (!$result) {  
  285:       print '<div id="CVS-no-commits">There are no new commits today</div>'."\n";
  286:     } else {
  287:       $reversed=array_reverse($result);
  288:       for ($i=0;$i<count($result);$i++)
  289:         print $reversed[$i];
  290: //        print $reversed[0];
  291:     }
  292: 
  293:     print "</div>\n\n";
  294: 
  295:   } // END BLOCK
  296: ?>

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