File:  [mozdev] / cdn / www / sources.html
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Wed Feb 19 19:18:47 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
..o

    1: <?php 
    2: 
    3: // $Id: sources.html,v 1.5 2003/02/19 19:18:47 cdn Exp $
    4:   
    5:   require("include/CVS_PATHS");
    6: 
    7:   define(MAX_READ_SIZE, 500000);
    8:   define(MAX_READ, 100000);
    9: 
   10:   $today              = date("y/m/d"); 
   11:   $commit_log         = "cvs@$project.mozdev.org";
   12: 
   13:   if(!$local_conf_commits) 
   14:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   15: 
   16:   //BEGIN BLOCK
   17:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
   18: 
   19:     $size = filesize(COMMIT_PATH.$commit_log);
   20:     $contents = array();
   21:     if ($size > MAX_READ_SIZE) {
   22:       // print "<!-- Log File is greater than 500K -->\n";
   23: 
   24:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   25:       fseek($fp, $size - MAX_READ);
   26:       if ($contents) {
   27:         print "$contents\n";
   28:         exit;
   29:       }
   30:       $tok = strtok(fread($fp, MAX_READ),"\n");
   31:       while ($tok) {
   32:         array_push($contents, $tok);
   33:         $tok = strtok("\n");
   34:       }
   35:       fclose($fp);
   36:     } echo '<pre>' . $contents . '</pre>';
   37:     if (!$contents)
   38:       $contents = file(COMMIT_PATH.$commit_log);
   39:     $len=count($contents);
   40:     $r            = -1;
   41:   
   42:     echo '<pre style="color: red;">' . $contents . '</pre>';
   43:     
   44:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . ucwords($project) . " Project</h4>\n";
   45:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   46: 
   47:     if($len) {
   48:       for($i=0;$i<$len;$i++) {
   49:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   50:           break;
   51: 
   52:         if(ereg("  Date: $today", $contents[$i])) {
   53:           $r++;
   54:           $result[$r] = 
   55:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
   56:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
   57:           "</td></tr>\n" .
   58:           '<tr class="CVS-tr-checkins">' .
   59:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
   60:           "\n</td></tr>\n" .
   61:           "<tr><td>\n";
   62: 
   63:           for($l=$i+1;$l<$len;$l++) {
   64:             if(ereg("  Revision  Changes    Path", $contents[$l]))
   65:               break;
   66: 
   67:             if(ereg("  User:", $contents[$l]))
   68:               break;
   69: 
   70:             $result[$r] .= eregi_replace("((http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
   71:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l])) .
   72:             "<br>\n";
   73:           }
   74: 
   75:           $result[$r]     .= "</td></tr>\n";
   76:         }
   77:       }
   78:     }
   79: 
   80:   if(!$result) {  
   81:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
   82:   } else {
   83:     $reversed=array_reverse($result);
   84:     for($i=0;$i<count($result);$i++)
   85:       PRINT $reversed[$i];
   86:   }
   87: 
   88:     print "</table>\n\n";
   89: 
   90:   } //END BLOCK
   91: ?>

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