File:  [mozdev] / cdn / www / sources.html
Revision 1.21: download - view: text, annotated - select for diffs - revision graph
Thu Feb 20 20:36:44 2003 UTC (16 years, 7 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.21 2003/02/20 20:36:44 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) )
  109:             {
  110:               $checkins = trim($checkins);
  111: 
  112:               $checkinsA = explode(' ', $checkins);
  113: 
  114:               unset($checkins);
  115: 
  116:               for($z=0; $z < count($checkinsA); ++$z)
  117:               {
  118:                 $checkinsA[$z] = trim($checkinsA[$z]);
  119:               }
  120: 
  121:               $chkA1 = $checkinsA[1];
  122: 	      
  123: 	      $webcvs .= $chkA1;
  124: 
  125:               $checkins = $checkinsA[0] . ' <a href="' . $webcvs;
  126:               $checkins .= '">' . $chkA1 . '</a>';
  127: 
  128:              // reset($checkinsA);
  129:               for($y=0; $y < count($checkinsA); ++$y)
  130:               {
  131: 	      // how can $webcvs not have $chkA1 as part of it ?
  132: 
  133:                 if($y >= 2)
  134: 		{
  135: 		  $checkins .= ' <a href="' . $webcvs . '/' . $checkinsA[$y] . '">';
  136:                   $checkins .= $checkinsA[$y] . '</a>';
  137: 		}
  138:               }
  139:             }
  140: 
  141:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
  142:             "</div>\n";
  143:           }
  144: 
  145:           $result[$r]     .= "</td></tr>\n";
  146:         }
  147:       }
  148:     }
  149: 
  150:   if(!$result) {  
  151:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  152:   } else {
  153:     $reversed=array_reverse($result);
  154:     for($i=0;$i<count($result);$i++)
  155:       PRINT $reversed[$i];
  156:   }
  157: 
  158:     print "</table>\n\n";
  159: 
  160:   } //END BLOCK
  161: ?>

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