File:  [mozdev] / cdn / www / sources.html
Revision 1.121: download - view: text, annotated - select for diffs - revision graph
Wed Feb 26 08:41:15 2003 UTC (16 years, 9 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
remove some confusion

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

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