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

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.15      cdn        22: // $Id: sources2.html,v 1.14 2003/02/22 16:23:23 alanjstr Exp $
1.11      cdn        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";
1.13      cdn        75:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table2">' . "\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: 
1.16    ! cdn        83:         if(ereg("Log:\n", $contents[$l]))
        !            84:           break;
        !            85: 
1.1       alanjstr   86:         if(ereg("  Date: $today", $contents[$i])) {
                     87:           $r++;
1.10      alanjstr   88:           $When = eregi_replace("Date: ",     "", trim(htmlspecialchars($contents[$i]  )));
                     89:           $Who  = eregi_replace("User: ",     "", trim(htmlspecialchars($contents[$i-1])));
1.9       alanjstr   90:           $What = eregi_replace("Modified: ", "", trim(htmlspecialchars($contents[$i+1])));
1.10      alanjstr   91:           $What = eregi_replace("Added: ",    "",     $What);
1.16    ! cdn        92:          // $What = eregi_replace("Log\:\n",    "",     $What);
1.14      alanjstr   93:           $What = eregi_replace("   www      ",  "www/", $What); //doesn't work for files outside www, or multiple checkins
1.12      cdn        94: 
                     95:          // $What = eregi_replace("[^[:space:]]      ",  "\\1/", $What); // doesn't work - but then whois surprised : )
                     96: 
1.9       alanjstr   97:           $Why  = trim(htmlspecialchars($contents[$i+3]));
1.12      cdn        98: 
1.7       alanjstr   99:           $result[$r] = '<tr>';
1.9       alanjstr  100:           $result[$r] .= '<td>' . $When . '</td>';
                    101:           $result[$r] .= '<td>' . $Who  . '</td>';
                    102:           $result[$r] .= '<td>' . $What . '</td>';
                    103:           $result[$r] .= '<td>' . '</td>'; // Rev
                    104:           $result[$r] .= '<td>' . '</td>'; // plus/minus
                    105:           $result[$r] .= '<td>' . $Why  . '</td>';
                    106:           $result[$r] .= '</tr>' . "\n";
1.1       alanjstr  107:         }
                    108:       }
                    109:     }
                    110: 
                    111:   if(!$result) {  
                    112:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
                    113:   } else {
                    114:     $reversed=array_reverse($result);
                    115:     for($i=0;$i<count($result);$i++)
                    116:       PRINT $reversed[$i];
                    117:   }
                    118: 
                    119:     print "</table>\n\n";
                    120: 
                    121:   } //END BLOCK
                    122: ?>

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