File:  [mozdev] / cdn / www / sources.html
Revision 1.33: download - view: text, annotated - select for diffs - revision graph
Thu Feb 20 22:00:24 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
.

    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; ?>
   19: 
   20: <?php 
   21: 
   22: // $Id: sources.html,v 1.33 2003/02/20 22:00: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:   $commit_log         = "cvs@$project.mozdev.org";
   31: 
   32: //  show_source(COMMIT_PATH.$commit_log);
   33: 
   34:   if(!$local_conf_commits) 
   35:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   36: 
   37:   //BEGIN BLOCK
   38:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   39: 
   40:     $size = filesize(COMMIT_PATH.$commit_log);
   41:     $contents = array();
   42:     if ($size > MAX_READ_SIZE) {
   43:       // print "<!-- Log File is greater than 500K -->\n";
   44: 
   45:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   46:       fseek($fp, $size - MAX_READ);
   47:       if ($contents) {
   48:         print "$contents\n";
   49:         exit;
   50:       }
   51:       $tok = strtok(fread($fp, MAX_READ),"\n");
   52:       while ($tok) {
   53:         array_push($contents, $tok);
   54:         $tok = strtok("\n");
   55:       }
   56:       fclose($fp);
   57:     } // echo '<pre>' . $contents[0] . '</pre>';
   58:     if (!$contents)
   59:       $contents = file(COMMIT_PATH.$commit_log);
   60:     $len=count($contents);
   61:     $r            = -1;
   62:   
   63:    // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
   64:     
   65:     $_project = $project;
   66:     
   67:     if ( !isset($doNotCapitalise) )
   68:     {
   69:       $_project = PROJECT;
   70:     }
   71:    
   72:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   73:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   74: 
   75:     if($len) {
   76:       for($i=0;$i<$len;$i++) {
   77:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   78:           break;
   79: 
   80:         if(ereg("  Date: $today", $contents[$i])) {
   81:           $r++;
   82:           $result[$r] = 
   83:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
   84:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
   85:           "</td></tr>\n" .
   86:           '<tr class="CVS-tr-date">' .
   87:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
   88:           "\n</td></tr>\n" .
   89:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
   90: 
   91:           for($l=$i+1;$l<$len;$l++) {
   92:             if(ereg("  Revision  Changes    Path", $contents[$l]))
   93:               break;
   94: 
   95:             if(ereg("  User:", $contents[$l]))
   96:               break;
   97: 
   98:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
   99:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l]));
  100: 
  101:             // '  Added:       www/img  background.png' 
  102:             // '  Modified:    www      cdn.css' 
  103:             // '  Removed:     www/protected sources.html'
  104:             // '               www/compact index.html' ?
  105: 
  106:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
  107: 
  108:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
  109:             {
  110:              // $checkins = trim($checkins);
  111: 
  112:               $identifier = trim(substr($checkins, 0, 14));
  113: 
  114:               $checkins = ereg_replace('[[:space:]]{1,}', ' ', substr($checkins, 14) );
  115: 
  116:               $checkinsA = explode(' ', $checkins);
  117: 
  118:               unset($checkins);
  119: 
  120:               for($z=0; $z < count($checkinsA); ++$z)
  121:               {
  122:                 $checkinsA[$z] = trim($checkinsA[$z]);
  123:               }
  124: 
  125:               $checkins = $identifier;
  126: 
  127:               $chkA1 = $checkinsA[0];
  128: 
  129:               $webcvs .= '/' . $chkA1;
  130: 
  131:              // $webcvs = str_replace('//', '/', $webcvs); // silly : )
  132: 
  133:               $webcvs = ereg_replace('[^\:]//', '/', $webcvs);
  134: 
  135:               if(!empty($chkA1))
  136:               {
  137:                 $checkins .= ' <a href="' . $webcvs;
  138:                 $checkins .= '">' . $chkA1 . '</a>';
  139:               }
  140: 
  141:              // reset($checkinsA);
  142:               for($y=1; $y < count($checkinsA); ++$y)
  143:               {
  144:                 $checkins .= ' <a href="' . $webcvs . '/' . $chkA1 . $checkinsA[$y] . '">';
  145:                 $checkins .= $checkinsA[$y] . '</a>';
  146:               }
  147:             }
  148: 
  149:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
  150:             "</div>\n";
  151:           }
  152: 
  153:           $result[$r]     .= "</td></tr>\n";
  154:         }
  155:       }
  156:     }
  157: 
  158:   if(!$result) {  
  159:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  160:   } else {
  161:     $reversed=array_reverse($result);
  162:     for($i=0;$i<count($result);$i++)
  163:       PRINT $reversed[$i];
  164:   }
  165: 
  166:     print "</table>\n\n";
  167: 
  168:   } //END BLOCK
  169: ?>

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