Annotation of cdn/www/sources2.html, revision 1.12

1.1       alanjstr    1: <!-- MAIN CONTENT -->
                      2: <h5 class="page-header">Source Code</h5>
                      3: 
                      4: <p>
                      5:   The cdn source code can be accessed in either of the following ways:
                      6: </p>
                      7: 
                      8: <ul>
                      9: <li>View the source using the CVS <a href="http://www.mozdev.org/source/browse/cdn/">web interface</a></li>
                     10: <li>Check out the source using anonymous CVS with the following commands (password is guest):
                     11: 
                     12: <pre>
                     13: cvs -d :pserver:guest@mozdev.org:/cvs login
                     14: cvs -d :pserver:guest@mozdev.org:/cvs co cdn
                     15: </pre>
                     16: 
                     17: </li>
                     18: </ul><?php $doNotCapitalise = 1; ?>
                     19: 
                     20: <?php 
                     21: 
1.11      cdn        22: // $Id$
                     23: 
                     24: // $cvsId: sources2.html,v 1.10 2003/02/22 05:36:50 alanjstr Exp svc$
1.1       alanjstr   25:   
                     26:   require("include/CVS_PATHS");
                     27: 
                     28:   define(MAX_READ_SIZE, 500000);
                     29:   define(MAX_READ, 100000);
                     30: 
                     31:   $today              = date("y/m/d"); 
                     32:   $commit_log         = "cvs@$project.mozdev.org";
                     33: 
                     34: //  show_source(COMMIT_PATH.$commit_log);
                     35: 
                     36:   if(!$local_conf_commits) 
                     37:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
                     38: 
                     39:   //BEGIN BLOCK
                     40:   if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
                     41: 
                     42:     $size = filesize(COMMIT_PATH.$commit_log);
                     43:     $contents = array();
                     44:     if ($size > MAX_READ_SIZE) {
                     45:       // print "<!-- Log File is greater than 500K -->\n";
                     46: 
                     47:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
                     48:       fseek($fp, $size - MAX_READ);
                     49:       if ($contents) {
                     50:         print "$contents\n";
                     51:         exit;
                     52:       }
                     53:       $tok = strtok(fread($fp, MAX_READ),"\n");
                     54:       while ($tok) {
                     55:         array_push($contents, $tok);
                     56:         $tok = strtok("\n");
                     57:       }
                     58:       fclose($fp);
                     59:     } // echo '<pre>' . $contents[0] . '</pre>';
                     60:     if (!$contents)
                     61:       $contents = file(COMMIT_PATH.$commit_log);
                     62:     $len=count($contents);
                     63:     $r            = -1;
                     64:   
                     65:    // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
                     66:     
                     67:     $_project = $project;
                     68:     
                     69:     if ( !isset($doNotCapitalise) )
                     70:     {
                     71:       $_project = PROJECT;
                     72:     }
                     73:    
                     74:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
                     75:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
1.7       alanjstr   76:     print '<tr><th>When</th><th>Who</th><th>File</th><th>Rev</th><th>+/-</th><th>Description</th></tr>' . "\n";
1.2       alanjstr   77: 
1.1       alanjstr   78:     if($len) {
                     79:       for($i=0;$i<$len;$i++) {
                     80:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
                     81:           break;
                     82: 
                     83:         if(ereg("  Date: $today", $contents[$i])) {
                     84:           $r++;
1.10      alanjstr   85:           $When = eregi_replace("Date: ",     "", trim(htmlspecialchars($contents[$i]  )));
                     86:           $Who  = eregi_replace("User: ",     "", trim(htmlspecialchars($contents[$i-1])));
1.9       alanjstr   87:           $What = eregi_replace("Modified: ", "", trim(htmlspecialchars($contents[$i+1])));
1.10      alanjstr   88:           $What = eregi_replace("Added: ",    "",     $What);
1.12    ! cdn        89:           $What = eregi_replace("www      ",  "www/", $What); // doesn't work for files outside www, or multiple checkins
        !            90: 
        !            91:          // $What = eregi_replace("[^[:space:]]      ",  "\\1/", $What); // doesn't work - but then whois surprised : )
        !            92: 
1.9       alanjstr   93:           $Why  = trim(htmlspecialchars($contents[$i+3]));
1.12    ! cdn        94: 
1.7       alanjstr   95:           $result[$r] = '<tr>';
1.9       alanjstr   96:           $result[$r] .= '<td>' . $When . '</td>';
                     97:           $result[$r] .= '<td>' . $Who  . '</td>';
                     98:           $result[$r] .= '<td>' . $What . '</td>';
                     99:           $result[$r] .= '<td>' . '</td>'; // Rev
                    100:           $result[$r] .= '<td>' . '</td>'; // plus/minus
                    101:           $result[$r] .= '<td>' . $Why  . '</td>';
                    102:           $result[$r] .= '</tr>' . "\n";
1.1       alanjstr  103:         }
                    104:       }
                    105:     }
                    106: 
                    107:   if(!$result) {  
                    108:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
                    109:   } else {
                    110:     $reversed=array_reverse($result);
                    111:     for($i=0;$i<count($result);$i++)
                    112:       PRINT $reversed[$i];
                    113:   }
                    114: 
                    115:     print "</table>\n\n";
                    116: 
                    117:   } //END BLOCK
                    118: ?>

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