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

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.47      cdn        18: </ul><?php $doNotCapitalise = 1; $project='orbits'; // testing ?>
1.9       cdn        19: 
1.2       cdn        20: <?php 
1.1       cdn        21: 
1.47      cdn        22: // $Id: sources.html,v 1.46 2003/02/21 13:18:10 cdn Exp $
1.42      cdn        23: // $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$
                     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.42      cdn        30:   $today              = date("y/m/d");
1.40      cdn        31:   $day = (int)date('d');
                     32:   --$day;
1.42      cdn        33:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
1.2       cdn        34:   $commit_log         = "cvs@$project.mozdev.org";
                     35: 
1.48    ! cdn        36:   $today = '03/02/14';
1.47      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.42      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.42      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.42      cdn        63:     }
1.41      cdn        64:     
1.2       cdn        65:     if (!$contents)
1.41      cdn        66:     {
1.42      cdn        67:       $contents = file(COMMIT_PATH.$commit_log);
                     68:      // $contents = file('/tmp/commit_test');
1.41      cdn        69:     }
                     70:     
1.2       cdn        71:     $len=count($contents);
                     72:     $r            = -1;
                     73:   
1.5       cdn        74:     
1.11      cdn        75:     $_project = $project;
                     76:     
                     77:     if ( !isset($doNotCapitalise) )
                     78:     {
                     79:       $_project = PROJECT;
                     80:     }
                     81:    
1.43      cdn        82:    // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
1.47      cdn        83:    // print '<h4 id="CVS-h4">' . "Yesterday'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.42      cdn        92:        // if(ereg("  Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
1.47      cdn        93:        // if(ereg("  Date: $yesterday", $contents[$i])) {
                     94:         if(ereg("  Date: $today", $contents[$i])) {
1.2       cdn        95:           $r++;
                     96:           $result[$r] = 
                     97:           '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
                     98:           "<strong>" . htmlspecialchars($contents[$i-1]) . "</strong>\n" .
                     99:           "</td></tr>\n" .
1.9       cdn       100:           '<tr class="CVS-tr-date">' .
1.4       cdn       101:           '<td class="CVS-td-f90">' . "\n" . htmlspecialchars($contents[$i]) .
1.2       cdn       102:           "\n</td></tr>\n" .
1.10      cdn       103:           '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
1.2       cdn       104: 
1.42      cdn       105:             $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
                    106: 
1.2       cdn       107:           for($l=$i+1;$l<$len;$l++) {
                    108:             if(ereg("  Revision  Changes    Path", $contents[$l]))
                    109:               break;
                    110: 
                    111:             if(ereg("  User:", $contents[$l]))
                    112:               break;
                    113: 
1.12      cdn       114:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", 
1.18      cdn       115:             "<a href='\\1'>\\1</a>", htmlspecialchars($contents[$l]));
1.14      cdn       116: 
                    117:             // '  Added:       www/img  background.png' 
                    118:             // '  Modified:    www      cdn.css' 
                    119:             // '  Removed:     www/protected sources.html'
1.18      cdn       120:             // '               www/compact index.html' ?
1.14      cdn       121: 
1.42      cdn       122:             if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) )
                    123:             {
                    124: 
1.46      cdn       125:               $identifier = trim(substr($checkins, 0, 15)); // echo $identifier . '<p />';
1.42      cdn       126: 
1.46      cdn       127:               $checkins = substr($checkins, 15); // echo $checkins . '<p />';
1.42      cdn       128: 
                    129:               // find first non-space character
                    130:               // if > 16, chances are the files are in the directory defined in the previous line ?
                    131: 
1.46      cdn       132:               $_16 = strpos($checkins, ' '); // echo '$_16 ' . $_16 . '<p />';
1.42      cdn       133: 
1.46      cdn       134:               $_path = substr( $checkins, 0, $_16); // echo $_path . '<p />';
1.40      cdn       135: 
1.46      cdn       136:              // if ( $_16 > 16 ) // not going to happen frequently : )
1.42      cdn       137:                 $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );
1.14      cdn       138: 
1.46      cdn       139:               $__path = trim($_path);
1.31      cdn       140: 
1.42      cdn       141:               if ( !empty( $__path ) )
                    142:               {
                    143:                 $chkA1 = $_path;
                    144:               }
1.23      cdn       145: 
1.15      cdn       146:               $checkinsA = explode(' ', $checkins);
1.14      cdn       147: 
1.15      cdn       148:               unset($checkins);
1.14      cdn       149: 
1.15      cdn       150:               for($z=0; $z < count($checkinsA); ++$z)
                    151:               {
                    152:                 $checkinsA[$z] = trim($checkinsA[$z]);
                    153:               }
1.12      cdn       154: 
1.42      cdn       155:               if ( !empty($identifier) )
                    156:                 $checkins = $identifier;
1.31      cdn       157: 
1.42      cdn       158:               if ( !empty($_path))
                    159:               {
1.46      cdn       160:                 $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
1.42      cdn       161:                 $webcvs .= '/' . $_path;
                    162:                 $_path_ = $_path;
                    163:                 $checkins .= ' <a href="' . $webcvs;
                    164:                 $checkins .= '">' . $_path . '</a>';
                    165:               }
1.25      cdn       166: 
1.34      cdn       167:               for($y=0; $y < count($checkinsA); ++$y)
1.15      cdn       168:               {
1.42      cdn       169:                 $checkins .= ' <a href="' . $webcvs . '/' . $checkinsA[$y] . '">';
                    170:                 $checkins .= $checkinsA[$y] . '</a>';
1.15      cdn       171:               }
1.42      cdn       172: 
1.14      cdn       173:             }
1.12      cdn       174: 
                    175:             $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
1.11      cdn       176:             "</div>\n";
1.2       cdn       177:           }
                    178: 
                    179:           $result[$r]     .= "</td></tr>\n";
                    180:         }
                    181:       }
                    182:     }
                    183: 
                    184:   if(!$result) {  
1.3       cdn       185:     print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
1.2       cdn       186:   } else {
                    187:     $reversed=array_reverse($result);
                    188:     for($i=0;$i<count($result);$i++)
                    189:       PRINT $reversed[$i];
                    190:   }
                    191: 
                    192:     print "</table>\n\n";
                    193: 
                    194:   } //END BLOCK
1.1       cdn       195: ?>

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