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

1.9       cdn         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>
1.11      cdn        18: </ul><?php $doNotCapitalise = 1; ?>
1.9       cdn        19: 
1.2       cdn        20: <?php 
1.1       cdn        21: 
1.38      cdn        22: // $cvsId: sources.html,v 1.27 2003/02/20 21:07:08 cdn Exp svc$
1.41    ! cdn        23: // $Id: sources.html,v 1.40 2003/02/21 01:03:07 cdn Exp $
1.38      cdn        24: 
1.2       cdn        25:   require("include/CVS_PATHS");
1.1       cdn        26: 
1.2       cdn        27:   define(MAX_READ_SIZE, 500000);
                     28:   define(MAX_READ, 100000);
                     29: 
1.38      cdn        30:   $today              = date("y/m/d"); 
1.40      cdn        31:   $day = (int)date('d');
                     32:   --$day;
                     33:   $yesterday          = date("y/m/" . sprintf('%02u', $day));
1.2       cdn        34:   $commit_log         = "cvs@$project.mozdev.org";
                     35: 
1.8       cdn        36: //  show_source(COMMIT_PATH.$commit_log);
1.7       cdn        37: 
1.2       cdn        38:   if(!$local_conf_commits) 
                     39:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
                     40: 
                     41:   //BEGIN BLOCK
1.41    ! cdn        42:  // if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { 
        !            43:   if(file_exists('/tmp/commit_test') && $local_conf_commits) { 
1.2       cdn        44: 
1.41    ! cdn        45:    // $size = filesize(COMMIT_PATH.$commit_log);
        !            46:     $size = filesize('/tmp/commit_test');
1.2       cdn        47:     $contents = array();
                     48:     if ($size > MAX_READ_SIZE) {
                     49:       // print "<!-- Log File is greater than 500K -->\n";
                     50: 
                     51:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
                     52:       fseek($fp, $size - MAX_READ);
                     53:       if ($contents) {
                     54:         print "$contents\n";
                     55:         exit;
                     56:       }
                     57:       $tok = strtok(fread($fp, MAX_READ),"\n");
                     58:       while ($tok) {
                     59:         array_push($contents, $tok);
                     60:         $tok = strtok("\n");
                     61:       }
                     62:       fclose($fp);
1.7       cdn        63:     } // echo '<pre>' . $contents[0] . '</pre>';
1.41    ! cdn        64:     
1.2       cdn        65:     if (!$contents)
1.41    ! cdn        66:     {
        !            67:      // $contents = file(COMMIT_PATH.$commit_log);
        !            68:       $contents = file('/tmp/commit_test');
        !            69:     }
        !            70:     
1.2       cdn        71:     $len=count($contents);
                     72:     $r            = -1;
                     73:   
1.9       cdn        74:    // echo '<pre style="color: red;">' . $contents[0] . '</pre>';
1.5       cdn        75:     
1.11      cdn        76:     $_project = $project;
                     77:     
                     78:     if ( !isset($doNotCapitalise) )
                     79:     {
                     80:       $_project = PROJECT;
                     81:     }
                     82:    
1.41    ! cdn        83:    // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
        !            84:     print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n";
1.2       cdn        85:     print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
                     86: 
                     87:     if($len) {
                     88:       for($i=0;$i<$len;$i++) {
                     89:         if(ereg("Modified:    www", $contents[$l]) && !$local_conf_commits)
                     90:           break;
                     91: 
1.41    ! cdn        92:         if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
1.2       cdn        93:           $r++;
                     94:           $result[$r] = 
                     95:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
                     96:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
                     97:           "</td></tr>\n" .
1.9       cdn        98:           '<tr class="CVS-tr-date">' .
1.4       cdn        99:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
1.2       cdn       100:           "\n</td></tr>\n" .
1.10      cdn       101:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
1.2       cdn       102: 
                    103:           for($l=$i+1;$l<$len;$l++) {
                    104:             if(ereg("  Revision  Changes    Path", $contents[$l]))
                    105:               break;
                    106: 
                    107:             if(ereg("  User:", $contents[$l]))
                    108:               break;
                    109: 
1.12      cdn       110:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
1.18      cdn       111:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l]));
1.14      cdn       112: 
                    113:             // '  Added:       www/img  background.png' 
                    114:             // '  Modified:    www      cdn.css' 
                    115:             // '  Removed:     www/protected sources.html'
1.18      cdn       116:             // '               www/compact index.html' ?
1.14      cdn       117: 
1.15      cdn       118:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
1.40      cdn       119: 
                    120:             // Removed should probably point to Attic
1.14      cdn       121: 
1.39      cdn       122:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
1.15      cdn       123:             {
1.38      cdn       124:               $checkins = trim($checkins);
1.31      cdn       125: 
1.38      cdn       126:               $checkins = ereg_replace('[[:space:]]{1,}', ' ', $checkins);
1.23      cdn       127: 
1.15      cdn       128:               $checkinsA = explode(' ', $checkins);
1.14      cdn       129: 
1.15      cdn       130:               unset($checkins);
1.14      cdn       131: 
1.15      cdn       132:               for($z=0; $z < count($checkinsA); ++$z)
                    133:               {
                    134:                 $checkinsA[$z] = trim($checkinsA[$z]);
                    135:               }
1.12      cdn       136: 
1.38      cdn       137:               $chkA1 = $checkinsA[1];
1.31      cdn       138: 
1.38      cdn       139:              $webcvs .= '/' . $chkA1;
1.28      cdn       140: 
1.38      cdn       141:               $checkins = $checkinsA[0];
                    142:              
                    143:              if(eregi("[^[:space:]<>]+/+[^[:space:]<>]", $checkinsA[0]))
                    144:              {
                    145:                $checkins = '<a href="' . $webcvs . $checkinsA[0] . '">' . $checkinsA[0] . '</a>';
                    146:              }
                    147:              
                    148:              $checkins .= ' <a href="' . $webcvs;
                    149:               $checkins .= '">' . $chkA1 . '</a>';
1.25      cdn       150: 
1.20      cdn       151:              // reset($checkinsA);
1.34      cdn       152:               for($y=0; $y < count($checkinsA); ++$y)
1.15      cdn       153:               {
1.38      cdn       154:               // how can $webcvs not have $chkA1 as part of it ?
                    155: 
                    156:                 if($y >= 2)
                    157:                 {
                    158:                   $checkins .= ' <a href="' . $webcvs . '/' . $checkinsA[$y] . '">';
                    159:                   $checkins .= $checkinsA[$y] . '</a>';
                    160:                 }
1.15      cdn       161:               }
1.14      cdn       162:             }
1.12      cdn       163: 
                    164:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
1.11      cdn       165:             "</div>\n";
1.2       cdn       166:           }
                    167: 
                    168:           $result[$r]     .= "</td></tr>\n";
                    169:         }
                    170:       }
                    171:     }
                    172: 
                    173:   if(!$result) {  
1.3       cdn       174:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
1.2       cdn       175:   } else {
                    176:     $reversed=array_reverse($result);
                    177:     for($i=0;$i<count($result);$i++)
                    178:       PRINT $reversed[$i];
                    179:   }
                    180: 
                    181:     print "</table>\n\n";
                    182: 
                    183:   } //END BLOCK
1.1       cdn       184: ?>

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