File:  [mozdev] / cdn / www / sources.html
Revision 1.116: download - view: text, annotated - select for diffs - revision graph
Mon Feb 24 17:32:24 2003 UTC (16 years, 8 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
Removed:

    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.116 2003/02/24 17:32:24 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");
   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 '<table border="0" cellpadding="0" cellspacing="2" 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] = '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n";
  101: 
  102: //who
  103:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
  104:           "</td></tr>\n" .
  105:           '<tr class="CVS-tr-date">' .
  106:           '<td class="CVS-td-f90">' . "\n";
  107: 
  108:           $_time = htmlspecialchars($contents[$i]);
  109: 
  110: // when
  111:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
  112: 
  113:           $result[$r] .= "\n</td></tr>\n" .
  114:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
  115: 
  116:           $webcvs = 'http://www.mozdev.org/source/browse/' . $project;
  117: 
  118:           for($l=$i+1;$l<$len;$l++) {
  119:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  120:               break;
  121: 
  122:             if(ereg("  User:", $contents[$l]))
  123:               break;
  124: 
  125:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
  126:             "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
  127: 
  128:             // '  Added:       www/img  background.png' 
  129:             // '  Modified:    www      cdn.css' 
  130:             // '  Removed:     www/protected sources.html'
  131:             // '               www/compact index.html'
  132:             // '  mozpos/downloads - New directory'
  133: 
  134:             if ( ereg("Log\:", $checkins) )
  135:               $idRemoved = false;
  136: 
  137:           if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
  138:                  strstr($checkins, "New directory")
  139:                ) {
  140: 
  141:               if ( !strstr($checkins, "New directory") ) {
  142:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  143: 
  144:                 $checkins = substr($checkins, 15);
  145:               }
  146:               else {
  147:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  148: 
  149:                 $webcvs = 'http://www.mozdev.org/source/browse';
  150: 
  151: 		unset($identifier);
  152:               }
  153: 
  154:               $_16 = strpos($checkins, ' ');
  155: 
  156:               $_path = substr( $checkins, 0, $_16);
  157: 
  158:               $checkins = ereg_replace('[[:space:]]{1,}', ' ',
  159:                           trim( substr ( $checkins, $_16 ) ) );
  160: 
  161:               $checkinsA = explode(' ', $checkins);
  162: 
  163:               unset($checkins);
  164: 
  165:               for($z=0; $z < count($checkinsA); ++$z)
  166:                 $checkinsA[$z] = trim($checkinsA[$z]);
  167: 
  168:               if ( !empty($identifier) )
  169:                 $checkins = $identifier;
  170: 
  171:               if ( !empty($_path)) {
  172:                 // reset, important !
  173:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; 
  174:                 $webcvs .= '/' . $_path;
  175:                 $_path_ = $_path;
  176:                 $checkins .= ' <a href="' . $webcvs;
  177:                 $checkins .= '">' . $_path . '</a>';
  178:               }
  179: 
  180:               $Y = count($checkinsA);
  181: 
  182:               for($y=0; $y < $Y; ++$y) {
  183: 
  184:                 if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  185:                      strstr($checkinsA[$y], '-_New_directory')
  186:                    )
  187:                   $TAG = true;
  188:                 else
  189:                   $TAG = false;
  190: 
  191:                 if(!$TAG) {
  192:                   $checkins .= ' <a href="' . $webcvs . '/';
  193: 
  194:                   if( $identifier == 'Removed:' || $idRemoved )
  195:                     $checkins .= 'Attic/'; // doesn't work for third row of deletions
  196: 
  197:                   $checkins .= $checkinsA[$y] . '">';
  198:                 }
  199:                 else {
  200:                   $checkins .= ' ';
  201:                 }
  202: 
  203:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  204: 
  205:                 $checkins .= $checkinsA[$y];
  206: 
  207:                 if (ereg("Tag\:$", trim($checkinsA[$y])) &&
  208:                     empty($checkinsA[$y+1]))
  209:                   $_tag = true; 
  210:                 else
  211:                   $_tag = false;
  212: 
  213:                 if (!$TAG)
  214:                   $checkins .= '</a>';
  215: 
  216:               }
  217: 
  218:               if ( $identifier == 'Removed:' || $idRemoved )
  219:                 $idRemoved = true;
  220:               else
  221:                 $idRemoved = false;
  222: 
  223:             }
  224: 
  225: // what
  226:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins . "</div>\n"; // what
  227:           }
  228: 
  229:           $result[$r] .= "</td></tr>\n";
  230:         }
  231: 
  232: // end  of parse of commitlog for $today / $yesterday
  233: 
  234:       }
  235:     }
  236: 
  237:     if (!$result) {  
  238:       print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>'."\n";
  239:     } else {
  240:       $reversed=array_reverse($result);
  241:       for ($i=0;$i<count($result);$i++)
  242:         print $reversed[$i];
  243:     }
  244: 
  245:     print "</table>\n\n";
  246: 
  247:   } // END BLOCK
  248: ?>

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