File:  [mozdev] / cdn / www / sources.html
Revision 1.38: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 00:45:58 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
1.27

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

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