File:  [mozdev] / cdn / www / sources.html
Revision 1.119: download - view: text, annotated - select for diffs - revision graph
Tue Feb 25 22:52:56 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
flibble tres

    1: <!-- MAIN CONTENT -->
    2: <h5 class="page-header">Source Code</h5>
    3: 
    4: <?php
    5: 
    6: //show_source(PHP_INC.TODAYS_CVS);
    7: 
    8: $project = 'www';
    9: 
   10: ?>
   11: 
   12: <p>
   13:   The cdn source code can be accessed in either of the following ways:
   14: </p>
   15: 
   16: <ul>
   17: <li>View the source using the CVS <a href="http://www.mozdev.org/source/browse/cdn/">web interface</a></li>
   18: <li>Check out the source using anonymous CVS with the following commands (password is guest):
   19: 
   20: <pre>
   21: cvs -d :pserver:guest@mozdev.org:/cvs login
   22: cvs -d :pserver:guest@mozdev.org:/cvs co cdn
   23: </pre>
   24: 
   25: </li>
   26: </ul><?php $doNotCapitalise = 1; // $project='orbits'; // testing ?>
   27: 
   28: <?php
   29: 
   30: // $Id: sources.html,v 1.119 2003/02/25 22:52:56 cdn Exp $
   31: 
   32:   require("include/CVS_PATHS");
   33: 
   34:   define(MAX_READ_SIZE, 500000);
   35:   define(MAX_READ, 100000);
   36: 
   37:   $today              = date("y/m/d");
   38:   $day = (int)date('d');
   39:   --$day;
   40:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   41:   $commit_log         = "cvs@$project.mozdev.org";
   42: 
   43:   if(!$local_conf_commits)
   44:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   45: 
   46:   //BEGIN BLOCK
   47:  
   48:    if(file_exists(COMMIT_PATH.$commit_log) && 
   49:       $local_conf_commits) {
   50: 
   51:      $size = filesize(COMMIT_PATH.$commit_log);
   52: 
   53:     $contents = array();
   54:     if ($size > MAX_READ_SIZE) {
   55:       // print "<!-- Log File is greater than 500K -->\n";
   56: 
   57:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   58:       fseek($fp, $size - MAX_READ);
   59:       if ($contents) {
   60:         print "$contents\n";
   61:         exit;
   62:       }
   63:       $tok = strtok(fread($fp, MAX_READ),"\n");
   64:       while ($tok) {
   65:         array_push($contents, $tok);
   66:         $tok = strtok("\n");
   67:       }
   68:       fclose($fp);
   69:     }
   70:     
   71:     if (!$contents)
   72:       $contents = file(COMMIT_PATH.$commit_log);
   73: 
   74:     // preprocess Tag: stuff would be here if it didn't mess
   75:     // things up completely
   76: 
   77:     $len=count($contents);
   78:     $r            = -1;
   79:     
   80:     $_project = $project;
   81:     
   82:     if ( !isset($doNotCapitalise) )
   83:       $_project = PROJECT;
   84:    
   85:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   86:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   87: 
   88:     if($len) {
   89:       for($i=0;$i<$len;$i++) {
   90:         if(ereg("Modified:    www", $contents[$l]) &&
   91:            !$local_conf_commits)
   92:           break;
   93: 
   94: //start of parse of commitlog for $today / $yesterday
   95: 
   96:         if(ereg("  Date: $today", $contents[$i])) {
   97:           $r++;
   98: 
   99:           $yy = substr(YEAR, 0, 2);
  100: 
  101:           $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
  102:           $_timestamp = str_replace("\n", '', $_timestamp);
  103: 
  104:           $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
  105: 
  106:           $_timestamp = '<a name="' . $_ts_link . '">'; 
  107: 
  108:           $result[$r] = '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n";
  109: 
  110: //who
  111:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
  112:           "</td></tr>\n" .
  113:           '<tr class="CVS-tr-date">' .
  114:           '<td class="CVS-td-f90">' . "\n";
  115: 
  116:           $_time = htmlspecialchars($contents[$i]);
  117: 
  118: // when
  119:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
  120: 
  121:           $result[$r] .= "\n</td></tr>\n" .
  122:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
  123: 
  124:           $webcvs = 'http://www.mozdev.org/source/browse/' . $project;
  125: 
  126:           for($l=$i+1;$l<$len;$l++) {
  127:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  128:               break;
  129: 
  130:             if(ereg("  User:", $contents[$l]))
  131:               break;
  132: 
  133:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
  134:             "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
  135: 
  136:             // '  Added:       www/img  background.png' 
  137:             // '  Modified:    www      cdn.css' 
  138:             // '  Removed:     www/protected sources.html'
  139:             // '               www/compact index.html'
  140:             // '  mozpos/downloads - New directory'
  141: 
  142:             if ( ereg("Log\:", $checkins) )
  143:               $idRemoved = false;
  144: 
  145:           if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
  146:                  strstr($checkins, "New directory")
  147:                ) {
  148: 
  149:               if ( !strstr($checkins, "New directory") ) {
  150:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  151: 
  152:                 $checkins = substr($checkins, 15);
  153:               }
  154:               else {
  155:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  156: 
  157:                 $webcvs = 'http://www.mozdev.org/source/browse';
  158: 
  159: 		unset($identifier);
  160:               }
  161: 
  162:               $_16 = strpos($checkins, ' ');
  163: 
  164:               $_path = substr( $checkins, 0, $_16);
  165: 
  166:               $checkins = ereg_replace('[[:space:]]{1,}', ' ',
  167:                           trim( substr ( $checkins, $_16 ) ) );
  168: 
  169:               $checkinsA = explode(' ', $checkins);
  170: 
  171:               unset($checkins);
  172: 
  173:               for($z=0; $z < count($checkinsA); ++$z)
  174:                 $checkinsA[$z] = trim($checkinsA[$z]);
  175: 
  176:               if ( !empty($identifier) )
  177:                 $checkins = $identifier;
  178: 
  179:               if ( !empty($_path)) {
  180:                 // reset, important !
  181:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; 
  182:                 $webcvs .= '/' . $_path;
  183:                 $_path_ = $_path;
  184:                 $checkins .= ' <a href="' . $webcvs;
  185:                 $checkins .= '">' . $_path . '</a>';
  186:               }
  187: 
  188:               $Y = count($checkinsA);
  189: 
  190:               for($y=0; $y < $Y; ++$y) {
  191: 
  192:                 if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  193:                      strstr($checkinsA[$y], '-_New_directory')
  194:                    )
  195:                   $TAG = true;
  196:                 else
  197:                   $TAG = false;
  198: 
  199:                 if(!$TAG) {
  200:                   $checkins .= ' <a href="' . $webcvs . '/';
  201: 
  202:                   if( $identifier == 'Removed:' || $idRemoved )
  203:                     $checkins .= 'Attic/'; // doesn't work for third row of deletions
  204: 
  205:                   $checkins .= $checkinsA[$y] . '">';
  206:                 }
  207:                 else {
  208:                   $checkins .= ' ';
  209:                 }
  210: 
  211:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  212: 
  213:                 $checkins .= $checkinsA[$y];
  214: 
  215:                 if (ereg("Tag\:$", trim($checkinsA[$y])) &&
  216:                     empty($checkinsA[$y+1]))
  217:                   $_tag = true; 
  218:                 else
  219:                   $_tag = false;
  220: 
  221:                 if (!$TAG)
  222:                   $checkins .= '</a>';
  223: 
  224:               }
  225: 
  226:               if ( $identifier == 'Removed:' || $idRemoved )
  227:                 $idRemoved = true;
  228:               else
  229:                 $idRemoved = false;
  230: 
  231:             }
  232: 
  233: // what
  234:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins . "</div>\n"; // what
  235:           }
  236: 
  237:           $result[$r] .= "</td></tr>\n";
  238:         }
  239: 
  240: // end  of parse of commitlog for $today / $yesterday
  241: 
  242:       }
  243:     }
  244: 
  245:     if (!$result) {  
  246:       print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>'."\n";
  247:     } else {
  248:       $reversed=array_reverse($result);
  249:       for ($i=0;$i<count($result);$i++)
  250:         print $reversed[$i];
  251:     }
  252: 
  253:     print "</table>\n\n";
  254: 
  255:   } // END BLOCK
  256: ?>

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