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

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

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