File:  [mozdev] / cdn / www / sources.html
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Feb 19 18:16:17 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
improving mozdev for all project owners ...

    1: <?php 
    2: 
    3: // $Id: sources.html,v 1.2 2003/02/19 18:16:17 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:     } 
   37:     if (!$contents)
   38:       $contents = file(COMMIT_PATH.$commit_log);
   39:     $len=count($contents);
   40:     $r            = -1;
   41:   
   42:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . ucwords($project) . " Project</h4>\n";
   43:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
   44: 
   45:     if($len) {
   46:       for($i=0;$i<$len;$i++) {
   47:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
   48:           break;
   49: 
   50:         if(ereg("  Date: $today", $contents[$i])) {
   51:           $r++;
   52:           $result[$r] = 
   53:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
   54:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
   55:           "</td></tr>\n" .
   56:           '<tr class="CVS-tr-checkins">' .
   57:           '<td class="CVS-td-f90\">' . "\n" . htmlspecialchars($contents[$i]) .
   58:           "\n</td></tr>\n" .
   59:           "<tr><td>\n";
   60: 
   61:           for($l=$i+1;$l<$len;$l++) {
   62:             if(ereg("  Revision  Changes    Path", $contents[$l]))
   63:               break;
   64: 
   65:             if(ereg("  User:", $contents[$l]))
   66:               break;
   67: 
   68:             $result[$r] .= eregi_replace("((http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
   69:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l])) .
   70:             "<br>\n";
   71:           }
   72: 
   73:           $result[$r]     .= "</td></tr>\n";
   74:         }
   75:       }
   76:     }
   77: 
   78:   if(!$result) {  
   79:     print "<tr><td id="CVS-no-commits">There are no new commits today</td></tr>\n";
   80:   } else {
   81:     $reversed=array_reverse($result);
   82:     for($i=0;$i<count($result);$i++)
   83:       PRINT $reversed[$i];
   84:   }
   85: 
   86:     print "</table>\n\n";
   87: 
   88:   } //END BLOCK
   89: ?>

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