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; // $project='orbits'; // testing ?>
19:
20: <?php
21:
22: // $Id: sources.html,v 1.86 2003/02/21 20:55:45 cdn Exp $
23: // $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$
24:
25: require("include/CVS_PATHS");
26:
27: define(MAX_READ_SIZE, 500000);
28: define(MAX_READ, 100000);
29:
30: $today = date("y/m/d");
31: $day = (int)date('d');
32: --$day;
33: $yesterday = date("y/m/" . sprintf('%2u', $day));
34: $commit_log = "cvs@$project.mozdev.org";
35:
36: // $today = '03/02/14';
37:
38: if(!$local_conf_commits)
39: print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
40:
41: //BEGIN BLOCK
42: //
43: if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) {
44: // if(file_exists('/tmp/commit_test') && $local_conf_commits) {
45:
46: $size = filesize(COMMIT_PATH.$commit_log);
47: // $size = filesize('/tmp/commit_test');
48: $contents = array();
49: if ($size > MAX_READ_SIZE) {
50: // print "<!-- Log File is greater than 500K -->\n";
51:
52: $fp = fopen (COMMIT_PATH.$commit_log, "r");
53: fseek($fp, $size - MAX_READ);
54: if ($contents) {
55: print "$contents\n";
56: exit;
57: }
58: $tok = strtok(fread($fp, MAX_READ),"\n");
59: while ($tok) {
60: array_push($contents, $tok);
61: $tok = strtok("\n");
62: }
63: fclose($fp);
64: }
65:
66: if (!$contents)
67: {
68: //
69: $contents = file(COMMIT_PATH.$commit_log);
70: // $contents = file('/tmp/commit_test'); // echo 'boing '; echo $contents;
71: }
72:
73: // preprocess Tag: stuff
74:
75: //
76: $stnetnoc = implode('', $contents);
77:
78: //
79: $contents = ereg_replace('Tag\:[[:space:]]{1,}', 'Tag: ', $stnetnoc);
80:
81: //
82: // '_[_cdn_]_ Log:'
83: // '_[_cdn_]_ Tag: ...'
84:
85: // $contents = ereg_replace('Log\:[[:space:]]{1,}Tag', "Log\:\n Tg", $contents);
86: // $contents = str_replace("Log:\n Tag", "Log:\n Tg", $contents);
87:
88: //
89: // '_[_cdn_]_ Log:'
90: // '_[_cdn_]_ Tg: ...'
91:
92: //
93: $stnetnoc = ereg_replace("Tag\:\ [^[:space:]\.]{1,}\ ", "\\0\n ", $contents);
94: // needs to not process 'Tag:' if in a commemt, i.e. it follows 'Log:'
95:
96: // $stetnoc = ereg_replace("Log\:[[:space:]]{1,}Tg", "Log\:\n Tag", $stetnoc);
97: // $stetnoc = str_replace("Log:\n Tg", "Log\:\n Tag", $stetnoc);
98:
99: //
100: $contents = explode("\n", $stnetnoc);
101:
102: // /preprocess Tag: stuff
103:
104: $len=count($contents);
105: $r = -1;
106:
107:
108: $_project = $project;
109:
110: if ( !isset($doNotCapitalise) )
111: {
112: $_project = PROJECT;
113: }
114:
115: // print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
116: print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n";
117: // print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n";
118: print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n";
119:
120: if($len) {
121: for($i=0;$i<$len;$i++) {
122: if(ereg("Modified: www", $contents[$l]) && !$local_conf_commits)
123: break;
124:
125: // if(ereg(" Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) {
126: // if(ereg(" Date: $yesterday", $contents[$i])) {
127: if(ereg(" Date: $today", $contents[$i])) {
128: $r++;
129:
130: $_i = $i + 1;
131:
132: $yy = substr(YEAR, 0, 2);
133:
134: $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
135: $_timestamp = str_replace("\n", '', $_timestamp);
136:
137: $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
138:
139: $_timestamp = '<a name="' . $_ts_link . '">';
140:
141: $result[$r] =
142: '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n" .
143: "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" . // who
144: "</td></tr>\n" .
145: '<tr class="CVS-tr-date">' .
146: '<td class="CVS-td-f90">' . "\n";
147:
148: $_time = htmlspecialchars($contents[$i]);
149:
150: $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>'; // when
151:
152: $result[$r] .= "\n</td></tr>\n" .
153: '<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n";
154:
155: $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/';
156:
157: for($l=$i+1;$l<$len;$l++) {
158: if(ereg(" Revision Changes Path", $contents[$l]))
159: break;
160:
161: if(ereg(" User:", $contents[$l]))
162: break;
163:
164: $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})",
165: "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
166:
167: // ' Added: www/img background.png'
168: // ' Modified: www cdn.css'
169: // ' Removed: www/protected sources.html'
170: // ' www/compact index.html' ?
171:
172: if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) )
173: {
174:
175: $identifier = trim(substr($checkins, 0, 15)); // may change to group
176:
177: $checkins = substr($checkins, 15);
178:
179: // find first non-space character
180: // if > 16, chances are the files are in the directory defined in the previous line ?
181:
182: $_16 = strpos($checkins, ' ');
183:
184: $_path = substr( $checkins, 0, $_16);
185:
186: $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) );
187:
188: $checkinsA = explode(' ', $checkins);
189:
190: unset($checkins);
191:
192: for($z=0; $z < count($checkinsA); ++$z)
193: {
194: $checkinsA[$z] = trim($checkinsA[$z]);
195: }
196:
197: if ( !empty($identifier) )
198: $checkins = $identifier;
199:
200: if ( !empty($_path))
201: {
202: $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important !
203: $webcvs .= '/' . $_path;
204: $_path_ = $_path;
205: $checkins .= ' <a href="' . $webcvs;
206: $checkins .= '">' . $_path . '</a>';
207: }
208:
209: for($y=0; $y < count($checkinsA); ++$y)
210: {
211:
212: if (ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]))
213: {
214: $TAG = true;
215: }
216: else
217: {
218: $TAG = false;
219: }
220:
221: if(!$TAG)
222: {
223: $checkins .= ' <a href="' . $webcvs . '/';
224:
225: if($identifier == 'Removed:'): $checkins .= 'Attic/'; endif;
226:
227: $checkins .= $checkinsA[$y] . '">';
228: }
229: else
230: {
231: $checkins .= ' '; ++$_tagtracker;
232: }
233:
234: $checkins .= $checkinsA[$y];
235:
236: if(!$TAG): $checkins .= '</a>'; endif;
237:
238: }
239:
240: }
241:
242: $result[$r] .= '<div class="CVS-div-checkins">' . $checkins .
243: "</div>\n"; // what
244: }
245:
246: $result[$r] .= "</td></tr>\n";
247: }
248: }
249: }
250:
251: if(!$result) {
252: print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n";
253: } else {
254: $reversed=array_reverse($result);
255: for($i=0;$i<count($result);$i++)
256: PRINT $reversed[$i];
257: }
258:
259: print "</table>\n\n";
260:
261: } //END BLOCK
262: ?>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>