File:  [mozdev] / cdn / www / sources.html
Revision 1.56: download - view: text, annotated - select for diffs - revision graph
Fri Feb 21 14:33:59 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
# anchors pt3a

    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.56 2003/02/21 14:33:59 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:   $today = '03/02/14';
   37: 
   38:   if(!$local_conf_commits) 
   39:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   40: 
   41:   //BEGIN BLOCK
   42:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   43:  // if(file_exists('/tmp/commit_test') && $local_conf_commits) { 
   44: 
   45:     $size = filesize(COMMIT_PATH.$commit_log);
   46:    // $size = filesize('/tmp/commit_test');
   47:     $contents = array();
   48:     if ($size > MAX_READ_SIZE) {
   49:       // print "<!-- Log File is greater than 500K -->\n";
   50: 
   51:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   52:       fseek($fp, $size - MAX_READ);
   53:       if ($contents) {
   54:         print "$contents\n";
   55:         exit;
   56:       }
   57:       $tok = strtok(fread($fp, MAX_READ),"\n");
   58:       while ($tok) {
   59:         array_push($contents, $tok);
   60:         $tok = strtok("\n");
   61:       }
   62:       fclose($fp);
   63:     }
   64:     
   65:     if (!$contents)
   66:     {
   67:       $contents = file(COMMIT_PATH.$commit_log);
   68:      // $contents = file('/tmp/commit_test');
   69:     }
   70: 
   71:     echo '<pre>';
   72:     
   73:     for($i=0; $i < count($contents); ++$i)
   74:     {
   75:       echo htmlspecialchars($contents[$i]);
   76:     }
   77:     
   78:     echo '</pre>';
   79:         
   80:     $len=count($contents);
   81:     $r            = -1;
   82:   
   83:     
   84:     $_project = $project;
   85:     
   86:     if ( !isset($doNotCapitalise) )
   87:     {
   88:       $_project = PROJECT;
   89:     }
   90:    
   91:    // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   92:    // print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
   93:     print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n";
   94:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   95: 
   96:     if($len) {
   97:       for($i=0;$i<$len;$i++) {
   98:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   99:           break;
  100: 
  101:        // if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
  102:        // if(ereg("  Date: $yesterday", $contents[$i])) {
  103:         if(ereg("  Date: $today", $contents[$i])) {
  104:           $r++;
  105:           
  106:           $yy = substr(YEAR, 0, 2);
  107: 
  108:           $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
  109:           $_timestamp = str_replace("\n", '', $_timestamp);
  110:           $_timestamp = str_replace(':', '.', $_timestamp);
  111: 
  112:           $_ts_link = '#' . $yy . ereg_replace('[\ \/]', '_', $_timestamp);
  113: 
  114:           $_timestamp = '<a name="' . $_ts_link . '">'; 
  115: 
  116:           $result[$r] = 
  117:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
  118:           "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" . // who
  119:           "</td></tr>\n" .
  120:           '<tr class="CVS-tr-date">' .
  121:           '<td class="CVS-td-f90">' . "\n";
  122: 
  123:           $_time = htmlspecialchars($contents[$i]);
  124: 
  125:           $result[$r] .= '<a href="' . $_ts_link . '">' . $_time . '</a>'; // when
  126: 
  127:           $result[$r] .= "\n</td></tr>\n" .
  128:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
  129: 
  130:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
  131: 
  132:           for($l=$i+1;$l<$len;$l++) {
  133:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  134:               break;
  135: 
  136:             if(ereg("  User:", $contents[$l]))
  137:               break;
  138: 
  139:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
  140:             '<a href="\\1">\\1</a>', htmlspecialchars($contents[$l]));
  141: 
  142:             // '  Added:       www/img  background.png' 
  143:             // '  Modified:    www      cdn.css' 
  144:             // '  Removed:     www/protected sources.html'
  145:             // '               www/compact index.html' ?
  146: 
  147:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
  148:             {
  149: 
  150:               $identifier = trim(substr($checkins, 0, 15)); // echo $identifier . '<p />';
  151: 
  152:               $checkins = substr($checkins, 15); // echo $checkins . '<p />';
  153: 
  154:               // find first non-space character
  155:               // if > 16, chances are the files are in the directory defined in the previous line ?
  156: 
  157:               $_16 = strpos($checkins, ' '); // echo '$_16 ' . $_16 . '<p />';
  158: 
  159:               $_path = substr( $checkins, 0, $_16); // echo $_path . '<p />';
  160: 
  161:              // if ( $_16 > 16 ) // not going to happen frequently : )
  162:                 $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );
  163: 
  164:               $__path = trim($_path);
  165: 
  166:               if ( !empty( $__path ) )
  167:               {
  168:                 $chkA1 = $_path;
  169:               }
  170: 
  171:               $checkinsA = explode(' ', $checkins);
  172: 
  173:               unset($checkins);
  174: 
  175:               for($z=0; $z < count($checkinsA); ++$z)
  176:               {
  177:                 $checkinsA[$z] = trim($checkinsA[$z]);
  178:               }
  179: 
  180:               if ( !empty($identifier) )
  181:                 $checkins = $identifier;
  182: 
  183:               if ( !empty($_path))
  184:               {
  185:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
  186:                 $webcvs .= '/' . $_path;
  187:                 $_path_ = $_path;
  188:                 $checkins .= ' <a href="' . $webcvs;
  189:                 $checkins .= '">' . $_path . '</a>';
  190:               }
  191: 
  192:               for($y=0; $y < count($checkinsA); ++$y)
  193:               {
  194: 
  195:                 if(!$checkinsA[$y] == 'Tag:') // && !$checkinsA[$y-1] == 'Tag:')
  196:                 {
  197:                   $checkins .= ' <a href="' . $webcvs . '/' . $checkinsA[$y] . '">';
  198:                 }
  199:                 else
  200:                 {
  201:                   $checkins .= ' ';
  202:                 }
  203: 
  204:                 $checkins .= $checkinsA[$y];
  205: 
  206:                 if(!$checkinsA[$y] == 'Tag:'): $checkins .= '</a>'; endif;
  207: 
  208:               }
  209: 
  210:             }
  211: 
  212:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
  213:             "</div>\n"; // what
  214:           }
  215: 
  216:           $result[$r]     .= "</td></tr>\n";
  217:         }
  218:       }
  219:     }
  220: 
  221:   if(!$result) {  
  222:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
  223:   } else {
  224:     $reversed=array_reverse($result);
  225:     for($i=0;$i<count($result);$i++)
  226:       PRINT $reversed[$i];
  227:   }
  228: 
  229:     print "</table>\n\n";
  230: 
  231:   } //END BLOCK
  232: ?>

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