File:  [mozdev] / cdn / www / sources.html
Revision 1.120: download - view: text, annotated - select for diffs - revision graph
Wed Feb 26 08:31:13 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
inconsequential

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

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