Annotation of cdn/www/sources.html, revision 1.8

1.2       cdn         1: <?php 
1.1       cdn         2: 
1.5       cdn         3: // $Id: sources.html,v 1.4 2003/02/19 18:19:49 cdn Exp $
1.2       cdn         4:   
                      5:   require("include/CVS_PATHS");
1.1       cdn         6: 
1.2       cdn         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: 
1.8     ! cdn        13: //  show_source(COMMIT_PATH.$commit_log);
1.7       cdn        14: 
1.2       cdn        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);
1.7       cdn        38:     } // echo '<pre>' . $contents[0] . '</pre>';
1.2       cdn        39:     if (!$contents)
                     40:       $contents = file(COMMIT_PATH.$commit_log);
                     41:     $len=count($contents);
                     42:     $r            = -1;
                     43:   
1.7       cdn        44:     echo '<pre style="color: red;">' . $contents[0] . '</pre>';
1.5       cdn        45:     
1.2       cdn        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">' .
1.4       cdn        61:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
1.2       cdn        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) {  
1.3       cdn        83:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
1.2       cdn        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
1.1       cdn        93: ?>

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