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

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

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