File:  [mozdev] / cdn / www / sources.html
Revision 1.46: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 13:18:10 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
8-X .debug. echos

    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.46 2003/02/21 13:18:10 cdn Exp $
   23: // $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$
   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:   $day = (int)date('d');
   32:   --$day;
   33:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   34:   $commit_log         = "cvs@$project.mozdev.org";
   35: 
   36:   if(!$local_conf_commits) 
   37:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   38: 
   39:   //BEGIN BLOCK
   40:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   41:  // if(file_exists('/tmp/commit_test') && $local_conf_commits) { 
   42: 
   43:     $size = filesize(COMMIT_PATH.$commit_log);
   44:    // $size = filesize('/tmp/commit_test');
   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:     {
   65:       $contents = file(COMMIT_PATH.$commit_log);
   66:      // $contents = file('/tmp/commit_test');
   67:     }
   68:     
   69:     $len=count($contents);
   70:     $r            = -1;
   71:   
   72:     
   73:     $_project = $project;
   74:     
   75:     if ( !isset($doNotCapitalise) )
   76:     {
   77:       $_project = PROJECT;
   78:     }
   79:    
   80:    // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   81:     print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
   82:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   83: 
   84:     if($len) {
   85:       for($i=0;$i<$len;$i++) {
   86:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   87:           break;
   88: 
   89:        // if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
   90:         if(ereg("  Date: $yesterday", $contents[$i])) {
   91:        // if(ereg("  Date: $today", $contents[$i])) {
   92:           $r++;
   93:           $result[$r] = 
   94:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
   95:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
   96:           "</td></tr>\n" .
   97:           '<tr class="CVS-tr-date">' .
   98:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
   99:           "\n</td></tr>\n" .
  100:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
  101: 
  102:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
  103: 
  104:           for($l=$i+1;$l<$len;$l++) {
  105:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  106:               break;
  107: 
  108:             if(ereg("  User:", $contents[$l]))
  109:               break;
  110: 
  111:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
  112:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l]));
  113: 
  114:             // '  Added:       www/img  background.png' 
  115:             // '  Modified:    www      cdn.css' 
  116:             // '  Removed:     www/protected sources.html'
  117:             // '               www/compact index.html' ?
  118: 
  119:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
  120:             {
  121: 
  122:               $identifier = trim(substr($checkins, 0, 15)); // echo $identifier . '<p />';
  123: 
  124:               $checkins = substr($checkins, 15); // echo $checkins . '<p />';
  125: 
  126:               // find first non-space character
  127:               // if > 16, chances are the files are in the directory defined in the previous line ?
  128: 
  129:               $_16 = strpos($checkins, ' '); // echo '$_16 ' . $_16 . '<p />';
  130: 
  131:               $_path = substr( $checkins, 0, $_16); // echo $_path . '<p />';
  132: 
  133:              // if ( $_16 > 16 ) // not going to happen frequently : )
  134:                 $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );
  135: 
  136:               $__path = trim($_path);
  137: 
  138:               if ( !empty( $__path ) )
  139:               {
  140:                 $chkA1 = $_path;
  141:               }
  142: 
  143:               $checkinsA = explode(' ', $checkins);
  144:              // $checkinsA = spliti('[\ ]{1}', $checkins);
  145:              // $dummy = eregi('[^[:space:]]{1,}', $checkins, $checkinsA);
  146: 
  147:               unset($checkins);
  148: 
  149:               for($z=0; $z < count($checkinsA); ++$z)
  150:               {
  151:                 $checkinsA[$z] = trim($checkinsA[$z]);
  152:               }
  153: 
  154:               if ( !empty($identifier) )
  155:                 $checkins = $identifier;
  156: 
  157:               if ( !empty($_path))
  158:               {
  159:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
  160:                 $webcvs .= '/' . $_path;
  161:                 $_path_ = $_path;
  162:                 $checkins .= ' <a href="' . $webcvs;
  163:                 $checkins .= '">' . $_path . '</a>';
  164:               }
  165: 
  166:               for($y=0; $y < count($checkinsA); ++$y)
  167:               {
  168: /*
  169:                 if($y == 0 && !empty($_path))
  170:                 {
  171:                   $checkins .= ' <a href="' . $webcvs . '">';
  172:                   $checkins .= $_path_ . '</a>';
  173:                 }
  174: */
  175:                 $checkins .= ' <a href="' . $webcvs . '/' . $checkinsA[$y] . '">';
  176:                 $checkins .= $checkinsA[$y] . '</a>';
  177:               }
  178: 
  179:             }
  180: 
  181:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
  182:             "</div>\n";
  183:           }
  184: 
  185:           $result[$r]     .= "</td></tr>\n";
  186:         }
  187:       }
  188:     }
  189: 
  190:   if(!$result) {  
  191:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  192:   } else {
  193:     $reversed=array_reverse($result);
  194:     for($i=0;$i<count($result);$i++)
  195:       PRINT $reversed[$i];
  196:   }
  197: 
  198:     print "</table>\n\n";
  199: 
  200:   } //END BLOCK
  201: ?>

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