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

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

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