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.144 2003/02/28 13:44:52 cdn Exp $
23:
24: require("include/CVS_PATHS");
25:
26: define(MAX_READ_SIZE, 500000);
27: define(MAX_READ, 100000);
28:
29: $today = date("y/m/d"); if (ereg('local', HOST) ): $today = '03/02/21'; endif;
30: $day = (int)date('d');
31: --$day;
32: $yesterday = date("y/m/") . sprintf('%2u', $day);
33: $this_month = date("y/m/");
34:
35: // $today = $this_month; // limit of 500k makes this not quite work
36: // $today = $yesterday;
37:
38: $commit_log = "cvs@$project.mozdev.org";
39:
40: if(!$local_conf_commits)
41: print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
42:
43: //BEGIN BLOCK
44:
45: if(file_exists(COMMIT_PATH.$commit_log) &&
46: $local_conf_commits) {
47:
48: $size = filesize(COMMIT_PATH.$commit_log);
49:
50: $contents = array();
51: if ($size > MAX_READ_SIZE) {
52: // print "<!-- Log File is greater than 500K -->\n";
53:
54: $fp = fopen (COMMIT_PATH.$commit_log, "r");
55: fseek($fp, $size - MAX_READ);
56: if ($contents) {
57: print "$contents\n";
58: exit;
59: }
60: $tok = strtok(fread($fp, MAX_READ),"\n");
61: while ($tok) {
62: array_push($contents, $tok);
63: $tok = strtok("\n");
64: }
65: fclose($fp);
66: }
67:
68: if (!$contents)
69: $contents = file(COMMIT_PATH.$commit_log);
70:
71: // preprocess Tag: stuff would be here if it didn't mess
72: // things up completely
73:
74: $len=count($contents);
75: $r = -1;
76:
77: $_project = $project;
78:
79: if ( !isset($doNotCapitalise) )
80: $_project = PROJECT;
81:
82: print '<script type="text/javascript" src="http://www.' . HOST . '/js/styleswitcher.js"></script>' . "\n";
83:
84: print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
85: print '<div id="CVS-table">' . "\n";
86:
87: if($len) {
88:
89: print '<p id="CVS-style-switch"><a href="#" onclick="setActiveStyleSheet(\'Default Checkins\'); return false;">change style to default</a> |' . "\n";
90: print '<a href="#" onclick="setActiveStyleSheet(\'Bonsai-esque Checkins\'); return false;">change style to bonsai</a></p>' . "\n";
91:
92: print '<div class="CVS-block CVS-dft-hidden">' . "\n";
93: print '<div class="CVS-td-900 CVS-headers">Who</div>' . "\n";
94: print '<div class="CVS-td-f90 CVS-headers">When</div>' . "\n";
95: print '<div class="CVS-td-checkins">' . "\n" .
96: '<div class="CVS-checkins CVS-headers" style="margin-top: 1px;">';
97: print 'What</div>' . "\n";
98: print '<div class="CVS-log CVS-headers" style="margin-top: 1px;">Why</div>' . "\n";
99: print '</div></div>';
100: print '<div style="clear: left; float: none;"></div>' . "\n";
101:
102: for($i=0;$i<$len;$i++) {
103: if(ereg("Modified: www", $contents[$l]) &&
104: !$local_conf_commits)
105: break;
106:
107: //start of parse of commitlog for $today / $yesterday
108:
109: if(ereg(" Date: $today", $contents[$i])) {
110: $r++;
111:
112: $yy = substr(YEAR, 0, 2);
113:
114: $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
115: $_timestamp = str_replace("\n", '', $_timestamp);
116:
117: $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
118:
119: $_timestamp = '<a name="' . $_ts_link . '">';
120:
121: $result[$r] = '<div class="CVS-block';
122:
123: if ($r == 0)
124: $result[$r] .= ' CVS-last-block';
125:
126: $result[$r] .= '"><div class="CVS-td-900">' . "\n";
127:
128: //who
129: $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
130: "</div>\n" .
131: '<div class="CVS-td-f90">' . "\n";
132:
133: $_time = htmlspecialchars($contents[$i]);
134:
135: // when
136: $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
137:
138: $result[$r] = eregi_replace("(User|Date):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span> ", $result[$r]);
139:
140: $result[$r] .= "\n</div>\n" .
141: '<div class="CVS-td-checkins">' . "\n" .
142: '<div class="CVS-checkins">' . "\n";
143:
144: $webcvs = 'http://www.' . HOST . '/source/browse/' . $project;
145:
146: define (LOG_DIVS ,'</div>' . "\n" . '</div>' . "\n" . '<div class="CVS-log"><div class="CVS-bonsai-hidden">');
147:
148: for($l=$i+1;$l<$len;$l++) {
149: if(ereg(" Revision Changes Path", $contents[$l]))
150: break;
151:
152: if(ereg(" User:", $contents[$l]))
153: break;
154:
155: $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})",
156: "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
157:
158: // ' Added: www/img background.png'
159: // ' Modified: www cdn.css'
160: // ' Removed: www/protected sources.html'
161: // ' www/compact index.html'
162: // ' mozpos/downloads - New directory'
163:
164: if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) {
165: $idRemoved = false; $_log_section = true;
166: $checkins = LOG_DIVS . $checkins;
167: }
168:
169: if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
170: strstr($checkins, "New directory")
171: ) {
172:
173: if ( !strstr($checkins, "New directory") ) {
174: $identifier = trim(substr($checkins, 0, 15)); // may change to group
175:
176: $checkins = substr($checkins, 15);
177:
178: $_New_directory = false;
179: }
180: else {
181: $checkins = str_replace('- New directory', '-_New_directory', $checkins);
182:
183: $webcvs = 'http://www.' . HOST . '/source/browse';
184:
185: unset($identifier);
186:
187: $_New_directory = true;
188: }
189:
190: $_16 = strpos($checkins, ' ');
191:
192: $_path = substr( $checkins, 0, $_16);
193:
194: $checkins = ereg_replace('[[:space:]]{1,}', ' ',
195: trim( substr ( $checkins, $_16 ) ) );
196:
197: $checkinsA = explode(' ', $checkins);
198:
199: unset($checkins);
200:
201: for($z=0; $z < count($checkinsA); ++$z)
202: $checkinsA[$z] = trim($checkinsA[$z]);
203:
204: if ( !empty($identifier) )
205: $checkins = '<span class="CVS-bonsai-hidden">' . $identifier . '</span>';
206:
207: if ( !empty($_path)) {
208: // reset, important !
209: $webcvs = 'http://www.' . HOST . '/source/browse/' . $project;
210: $webcvs .= '/' . $_path;
211: $checkins .= ' <span class="CVS-bonsai-hidden"><a href="' . $webcvs;
212: $checkins .= '">' . $_path . '</a></span>';
213: }
214:
215: $Y = count($checkinsA);
216:
217: for($y=0; $y < $Y; ++$y) {
218:
219: if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
220: strstr($checkinsA[$y], '-_New_directory')
221: )
222: $TAG = true;
223: else
224: $TAG = false;
225:
226: $checkins .= ' <span';
227:
228: if ( !$_New_directory )
229: $checkins .= ' class="CVS-dft-inline"';
230:
231: if ( strstr($checkinsA[$y+1], '-_New_directory') )
232: $checkins .= ' class="CVS-dft-inline"';
233:
234: $checkins .= '>';
235:
236: if(!$TAG) {
237: $checkins .= '<a href="' . $webcvs . '/';
238:
239: if( $identifier == 'Removed:' || $idRemoved )
240: $checkins .= 'Attic/';
241:
242: $checkins .= $checkinsA[$y] . '">';
243: }
244:
245: if ( !$_New_directory && !$TAG ) {
246: $checkins .= '<span class="CVS-dft-hidden">'; // $project / $_path
247: $_webcvs = str_replace('http://www.' . HOST . '/source/browse/', '', $webcvs);
248:
249: if ( strlen($_webcvs) > 15 )
250: $checkins .= substr($_webcvs, 0, 12) . '...' . substr($_webcvs, strrpos($_webcvs, '/'));
251: else
252: $checkins .= $_webcvs;
253:
254: if( $identifier == 'Removed:' || $idRemoved )
255: $checkins .= '/Attic';
256:
257: $checkins .= '/</span>';
258: }
259:
260: $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
261:
262: $checkins .= $checkinsA[$y];
263:
264: if (ereg("Tag\:$", trim($checkinsA[$y])) &&
265: empty($checkinsA[$y+1]))
266: $_tag = true;
267: else
268: $_tag = false;
269:
270: if (!$TAG)
271: $checkins .= '</a>';
272:
273: $checkins .= '</span>';
274:
275: }
276:
277: if ($_New_directory)
278: $checkins .= LOG_DIVS;
279:
280: if ( $identifier == 'Removed:' || $idRemoved )
281: $idRemoved = true;
282: else
283: $idRemoved = false;
284:
285: }
286:
287: $checkins = trim( str_replace('</span> <span>', ' ', $checkins) );
288:
289: if ( !ereg('^<d', $checkins) )
290: $checkins = '<div class="CVS-div-checkins">' . $checkins;
291: // what
292: if ( !empty( $checkins ) )
293: $result[$r] .= $checkins . "</div>\n"; // what
294:
295:
296: }
297:
298: if ( $_log_section || $_New_directory ) {
299: $_log_section = false;
300: $result[$r] .= '</div>';
301: }
302:
303: $result[$r] = str_replace('<div class="CVS-bonsai-hidden"></div>',
304: '<div class="CVS-bonsai-hidden"></div> ', $result[$r]);
305: $result[$r] = str_replace('<div class="CVS-bonsai-hidden"> Log:</div>' . "\n" .
306: '<div class="CVS-div-checkins"></div>', '<div class="CVS-bonsai-hidden"> Log:</div> ' .
307: "\n" . '<div class="CVS-div-checkins"></div>', $result[$r]);
308:
309: $result[$r] .= "</div>\n";
310: $result[$r] .= "</div>\n";
311: $result[$r] .= '<div style="clear: left; float: none;"></div>' . "\n";
312: }
313:
314: // end of parse of commitlog for $today / $yesterday
315:
316: }
317: }
318:
319: if (!$result) {
320: print '<div id="CVS-no-commits">There are no new commits today</div>'."\n";
321: } else {
322: $reversed=array_reverse($result);
323: for ($i=0;$i<count($result);$i++)
324: print $reversed[$i];
325: }
326:
327: print "</div>\n\n";
328:
329: } // END BLOCK
330:
331: ini_set('include_path', '.:./themes/:/usr/local/sandbox/data/helm/htdoc/themes/www/themes/:/usr/local/sandbox/data/helm/htdoc/themes/www/');
332:
333: include('annotate_1_47');
334:
335: ?>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>