]>
Commit | Line | Data |
---|---|---|
8627558a | 1 | <?php |
2 | $buildlogs_server = "buildlogs.pld.org.pl"; | |
3 | $url = "index.php"; | |
4 | $addr = array( | |
5 | "/nest/athlon", | |
6 | "/nest/i386", | |
7 | "/nest/i586", | |
8 | "/nest/i686", | |
9 | "/nest/ppc", | |
10 | "/ra/i386", | |
11 | "/ra/i586", | |
12 | "/ra/i686", | |
13 | "/ra/alpha", | |
14 | "/ra/sparc", | |
15 | "/ra/ppc" | |
16 | ); | |
17 | $qa_base = "http://ftp.pld.org.pl/.stat/builder"; | |
18 | $qa_addr = array( | |
19 | "", | |
20 | "/kenny/rpmqa-nest-i386.txt", | |
21 | "/kenny/rpmqa-nest-i586.txt", | |
22 | "/kenny/rpmqa-nest-i686.txt", | |
23 | "", | |
24 | "/ep/rpmqa-ra-i386.txt", | |
25 | "/ep/rpmqa-ra-i586.txt", | |
26 | "/ep/rpmqa-ra-i686.txt", | |
27 | "/mifgate/rpmqa-ra-alpha.txt", | |
28 | "/team/rpmqa-ra-sparc.txt", | |
29 | "" | |
30 | ); | |
31 | $local = 1; /* $local=0 for FTP */ | |
32 | $root_directory = "/home/services/ftp/pub/logs"; | |
33 | $ftp_conn = 0; | |
34 | /* It should be set */ | |
35 | ||
36 | ||
37 | function myheader() | |
38 | { | |
39 | ?> | |
40 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
41 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
42 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
43 | <head> | |
44 | <title>PLD Build Logs</title> | |
45 | <style TYPE="text/css"><!-- | |
46 | A { text-decoration: none; } | |
47 | A:hover { text-decoration: underline; } | |
48 | H1 { font-family: arial,helvetica,sans-serif; | |
49 | font-size: 20pt; | |
50 | font-weight: bold;} | |
51 | H2 { font-family: arial,helvetica,sans-serif; | |
52 | font-size: 18pt; | |
53 | font-weight: bold;} | |
54 | BODY,TD { font-family: arial,helvetica,sans-serif; | |
55 | font-size: 13pt; } | |
56 | TH { font-family: arial,helvetica,sans-serif; | |
57 | font-size: 13pt; | |
58 | font-weight: bold; } | |
59 | //--> | |
60 | </style> | |
61 | </head> | |
62 | <!-- Diffrent color for visited link doesn't make much sense here... | |
63 | this page is autogenerated and it might be misleading after some | |
64 | build log changes. --> | |
65 | <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd"> | |
66 | <?php | |
67 | } | |
68 | ||
69 | function start_pre() | |
70 | { | |
71 | echo "<table cellpadding=10><tr><td bgcolor=\"#000000\">". | |
72 | "<font color=\"#cccccc\"><pre>"; | |
73 | } | |
74 | ||
75 | function end_pre() | |
76 | { | |
77 | echo "</pre></font></td></tr></table>\n"; | |
78 | } | |
79 | ||
80 | function trailer() | |
81 | { | |
82 | echo "</body></html>"; | |
83 | } | |
84 | ||
85 | ||
86 | function mydie($msg) | |
87 | { | |
88 | echo "Fatal error: $msg"; | |
89 | } | |
90 | ||
91 | function open_ftp() | |
92 | { | |
93 | global $idx, $addr, $buildlogs_server, $ok; | |
94 | global $ftp_conn, $big_url, $url, $ns; | |
95 | global $off, $cnt; | |
96 | ||
97 | if (!isset($idx) || !isset($addr[$idx])) | |
98 | return false; | |
99 | ||
100 | if ($ok != 1) | |
101 | $ok = 0; | |
102 | if ($ns != 1) | |
103 | $ns = 0; | |
104 | ||
105 | if ($ok == 1) { | |
106 | $a = "$addr[$idx]/OK"; | |
107 | } else { | |
108 | $a = "$addr[$idx]/FAIL"; | |
109 | } | |
110 | ||
111 | if (!isset($off)) | |
112 | $off = 0; | |
113 | if (!isset($cnt)) | |
114 | $cnt = 16; | |
115 | ||
116 | $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt"; | |
117 | ||
118 | $ftp = ftp_connect($buildlogs_server); | |
119 | ||
120 | if ($ftp == false) { | |
121 | mydie("cannot connect to $buildlogs_server"); | |
122 | return false; | |
123 | } | |
124 | ||
125 | if (ftp_login($ftp, "anonymous", | |
126 | "buildlogs-iface@pld.org.pl") == false) { | |
127 | ftp_quit($ftp); | |
128 | mydie("cannot ftp login to $buildlogs_server"); | |
129 | return false; | |
130 | } | |
131 | ||
132 | $list = ftp_nlist($ftp, $a); | |
133 | if ($list == false) { | |
134 | ftp_quit($ftp); | |
135 | mydie("cannot list $a"); | |
136 | return false; | |
137 | } | |
138 | ||
139 | $ftp_conn = $ftp; | |
140 | ||
141 | return $list; | |
142 | } | |
143 | ||
144 | function directory_list() | |
145 | { | |
146 | global $idx, $addr, $buildlogs_server, $ok; | |
147 | global $root_directory, $big_url, $url, $ns; | |
148 | global $off, $cnt; | |
149 | ||
150 | if (!isset($idx) || !isset($addr[$idx])) | |
151 | return false; | |
152 | ||
153 | if ($ok != 1) | |
154 | $ok = 0; | |
155 | if ($ns != 1) | |
156 | $ns = 0; | |
157 | ||
158 | if ($ok == 1) { | |
159 | $a = "$addr[$idx]/OK"; | |
160 | } else { | |
161 | $a = "$addr[$idx]/FAIL"; | |
162 | } | |
163 | ||
164 | if (!isset($off)) | |
165 | $off = 0; | |
166 | if (!isset($cnt)) | |
167 | $cnt = 16; | |
168 | ||
169 | $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt"; | |
170 | ||
171 | $dir = opendir("$root_directory$a"); | |
172 | $i = 0; | |
173 | while ($file = readdir($dir)) { | |
174 | if (($file != ".") && ($file != "..")) { | |
175 | $list[$i] = "$a/$file"; | |
176 | $i++; | |
177 | } | |
178 | } | |
179 | closedir($dir); | |
180 | return $list; | |
181 | } | |
182 | ||
183 | function list_logs() | |
184 | { | |
185 | global $idx, $addr, $ok; | |
186 | global $ftp_conn, $big_url, $ns, $qa_addr; | |
187 | global $off, $cnt, $local, $root_directory; | |
188 | ||
189 | if ($local) { | |
190 | $list = directory_list(); | |
191 | } else { | |
192 | $list = open_ftp(); | |
193 | } | |
194 | if ($list == false) | |
195 | return; | |
196 | ||
197 | if ($ok == 1) { | |
198 | echo "<h1>Listing of $addr[$idx]/OK " | |
199 | ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>"; | |
200 | } else { | |
201 | echo "<h1>Listing of $addr[$idx]/FAIL " | |
202 | ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>"; | |
203 | } | |
204 | ||
205 | echo "<div align=center><table border=0 cellspacing=1 ". | |
206 | "cellpadding=3 bgcolor=#000000 width=90%>\n"; | |
207 | echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ". | |
208 | "[<a href=\"$big_url&ns=1\">sort</a>]</th>". | |
209 | "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ". | |
210 | "<th bgcolor=#CCCCFF align=left>Age ". | |
211 | "[<a href=\"$big_url&ns=0\">sort</a>]</th>". | |
212 | "</th></tr>"; | |
213 | ||
214 | function cmp($f1, $f2) { | |
215 | global $ftp_conn, $root_directory, $local; | |
216 | if ($local) | |
217 | return filemtime("$root_directory$f2") - filemtime("$root_directory$f1"); | |
218 | return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1); | |
219 | } | |
220 | ||
221 | if ($ns != 1) { | |
222 | $ns = 0; | |
223 | usort($list, cmp); | |
224 | } else { | |
225 | sort($list); | |
226 | } | |
227 | ||
228 | $now = time(); | |
229 | for ($i = $off; $i < $cnt + $off; $i++) { | |
230 | if (!isset($list[$i])) | |
231 | continue; | |
232 | $h = bin2hex(mhash(MHASH_MD5, $list[$i])); | |
233 | $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]); | |
234 | $f = preg_replace("/\.(bz2|gz)$/", "", $f); | |
235 | if ($local) { | |
236 | $s = filesize("$root_directory$list[$i]"); | |
237 | $t = $now - filemtime("$root_directory$list[$i]"); | |
238 | } else { | |
239 | $s = ftp_size($ftp_conn, $list[$i]); | |
240 | $t = $now - ftp_mdtm($ftp_conn, $list[$i]); | |
241 | } | |
242 | $t /= 60; | |
243 | if ($t >= 60) { | |
244 | $t /= 60; | |
245 | if ($t >= 24) { | |
246 | $t /= 24; | |
247 | $t = round($t); | |
248 | if ($t > 1) { | |
249 | $t = $t . " days"; | |
250 | } else { | |
251 | $t = $t . " day"; | |
252 | } | |
253 | } else { | |
254 | $t = round($t); | |
255 | if ($t > 1) { | |
256 | $t = $t . " hours"; | |
257 | } else { | |
258 | $t = $t . " hour"; | |
259 | } | |
260 | } | |
261 | } else { | |
262 | $t = round($t); | |
263 | if ($t != 1) { | |
264 | $t = $t . " minutes"; | |
265 | } else { | |
266 | $t = $t . " minute"; | |
267 | } | |
268 | } | |
269 | $u = "$big_url&off=$off&id=$h"; | |
270 | echo "<tr><td bgcolor=#CCCCCC><a ". | |
271 | "href=\"$u\">". | |
272 | "$f</a> ". | |
273 | "[<a href=\"$u&action=text\">text</a> | ". | |
274 | "<a href=\"$u&action=tail\">tail</a>]". | |
275 | "</td><td bgcolor=#CCCCCC align=right>". | |
276 | "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n"; | |
277 | } | |
278 | echo "</table></div>\n"; | |
279 | ||
f5ca8484 | 280 | $backarr = "<<< "; |
281 | $back = "Page back"; | |
282 | $forward = "Page forward"; | |
283 | $forwardarr = " >>>"; | |
8627558a | 284 | |
f5ca8484 | 285 | echo "<p><table align=center width=90%><tr><td align=left width=1%>"; |
8627558a | 286 | |
287 | if ($off > 0) { | |
288 | $noff = $off - $cnt; | |
289 | if ($noff < 0) | |
290 | $noff = 0; | |
291 | $hrefurl = "<a href=\"$big_url&off=$noff\">"; | |
292 | echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>"; | |
293 | } else { | |
294 | echo "$backarr</td><td align=left>$back"; | |
295 | } | |
296 | ||
297 | echo "</td>\n<td align=center>"; | |
298 | ||
299 | if ($qa_addr[$idx] != "") { | |
300 | echo "[<a href=\"$big_url&action=qa\">View <quot>rpm -qa</quot> of ". | |
301 | "builder</a>]"; | |
302 | } else { | |
303 | echo " "; | |
304 | } | |
305 | ||
306 | echo "</td>\n<td align=right>"; | |
307 | if ($off + $cnt < count($list)) { | |
308 | $noff = $off + $cnt; | |
309 | if ($noff < 0) | |
310 | $noff = 0; | |
311 | $hrefurl = "<a href=\"$big_url&off=$noff\">"; | |
f5ca8484 | 312 | echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>"; |
8627558a | 313 | } else { |
f5ca8484 | 314 | echo "$forward</td><td align=right width=1%>$forwardarr"; |
8627558a | 315 | } |
316 | echo "</td>\n</tr></table></p>"; | |
317 | if ($local == 0) { | |
318 | ftp_quit($ftp_conn); | |
319 | $ftp_conn = 0; | |
320 | } | |
321 | } | |
322 | ||
323 | function file_name() | |
324 | { | |
325 | global $idx, $addr, $ok; | |
326 | global $ftp_conn, $root_directory, $big_url, $ns, $id; | |
327 | global $buildlogs_server, $local; | |
328 | ||
329 | if (!isset($id)) | |
330 | return false; | |
331 | if ($local) { | |
332 | $list = directory_list(); | |
333 | } else { | |
334 | $list = open_ftp(); | |
335 | } | |
336 | if ($list == false) | |
337 | return false; | |
338 | ||
339 | $f = false; | |
340 | for ($i = 0; $i < count($list); $i++) { | |
341 | $h = bin2hex(mhash(MHASH_MD5, $list[$i])); | |
342 | if ($h == $id) { | |
343 | $f = $list[$i]; | |
344 | } | |
345 | } | |
346 | ||
347 | if ($f == false) { | |
348 | mydie("cannot find specified file: $id"); | |
349 | if ($local == 0) | |
350 | ftp_quit($ftp_conn); | |
351 | return false; | |
352 | } | |
353 | ||
354 | return $f; | |
355 | } | |
356 | ||
357 | function dump_log($tail) | |
358 | { | |
359 | global $idx, $addr, $ok, $url; | |
360 | global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off; | |
361 | global $buildlogs_server, $local, $qa_addr; | |
362 | ||
363 | $f = file_name(); | |
364 | ||
365 | if ($f == false) | |
366 | return; | |
367 | ||
368 | $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f); | |
369 | $df = preg_replace("/\.(bz2|gz)$/", "", $df); | |
370 | ||
371 | echo "<h1>$df</h1>"; | |
372 | ||
373 | echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>"; | |
374 | ||
375 | function one_item($h, $t) { | |
376 | echo "<tr><td bgcolor=#ccccff>$h:</td>". | |
377 | "<td bgcolor=#cccccc>$t</td></tr>"; | |
378 | } | |
379 | ||
380 | function href($h, $c) { | |
381 | return "<a href=\"$h\">$c</a>"; | |
382 | } | |
383 | ||
384 | one_item("Status", ($ok == 1 ? | |
385 | "<font color=green><b>OK</b></font>" : | |
386 | "<font color=red><b>Failed</b></a>")); | |
387 | one_item("Source URL", | |
388 | href("ftp://$buildlogs_server$f", | |
389 | "ftp://$buildlogs_server$f")); | |
390 | ||
391 | $bu = "$big_url&off=$off"; | |
392 | ||
393 | one_item("text/plain URL", | |
394 | href("$bu&id=$id&action=text", | |
395 | "View!")); | |
396 | if ($tail) { | |
397 | one_item("full text", | |
398 | href("$bu&&id=$id", | |
399 | "View!")); | |
400 | } | |
401 | ||
402 | if ($qa_addr[$idx] != "") { | |
403 | one_item("rpm -qa of builder", href("$bu&action=qa", "View!")); | |
404 | } else { | |
405 | one_item("rpm -qa of builder", "Not available"); | |
406 | } | |
407 | if ($local) { | |
408 | one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f"))); | |
409 | } else { | |
410 | one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f))); | |
411 | } | |
412 | /* | |
413 | echo "<tr><td>Here:</td><td>" . | |
414 | "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">". | |
415 | "http://" . getenv("SERVER_NAME") . | |
416 | getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" . | |
417 | "</td></tr>"; */ | |
418 | ||
419 | echo "</table><h2>Content:</h2>"; | |
420 | ||
421 | if ($local == 0) { | |
422 | ftp_quit($ftp_conn); | |
423 | $ftp_conn = 0; | |
424 | } | |
425 | ||
426 | ||
427 | # what can I say beside PHP suxx? how the fuck should I create | |
428 | # bidirectional pipe? gotta use wget | |
429 | ||
430 | if (preg_match("/\.bz2$/", $f)) { | |
431 | $filter = "bzcat"; | |
432 | } elseif (preg_match("/\.gz$/", $f)) { | |
433 | $filter = "zcat"; | |
434 | } else { | |
435 | $filter = "cat"; | |
436 | } | |
437 | ||
438 | if ($local) { | |
439 | $cmd = "$filter $root_directory$f"; | |
440 | } else { | |
441 | $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1"; | |
442 | } | |
443 | if ($tail) | |
444 | $cmd = "$cmd | tail -n 100"; | |
445 | $fd = popen($cmd, "r"); | |
446 | start_pre(); | |
447 | while (($s = fgets($fd, 1000)) != false) { | |
448 | $s = htmlspecialchars($s); | |
449 | echo $s; | |
450 | } | |
451 | end_pre(); | |
452 | pclose($fd); | |
453 | ||
454 | ?> | |
455 | <table width=100%> | |
456 | <tr> | |
457 | <td align=left> | |
458 | [<a href="<?php echo $bu; ?>">Back to list of logs</a>] | |
459 | </td> | |
460 | <td align=right> | |
461 | [<a href="<?php echo "$bu&action=qa" | |
462 | ?>">View rpm -qa of builder</a>] | |
463 | </td> | |
464 | </tr> | |
465 | </table> | |
466 | <?php | |
467 | ||
468 | } | |
469 | ||
470 | function dump_text() | |
471 | { | |
472 | global $ftp_conn, $root_directory; | |
473 | global $buildlogs_server, $local; | |
474 | ||
475 | header("Content-type: text/plain"); | |
476 | ||
477 | $f = file_name(); | |
478 | ||
479 | if ($f == false) | |
480 | return; | |
481 | ||
482 | echo "# src : ftp://$buildlogs_server$f\n"; | |
483 | if ($local) { | |
484 | echo "# date : " . | |
485 | date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n"; | |
486 | } else { | |
487 | echo "# date : " . | |
488 | date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n"; | |
489 | ftp_quit($ftp_conn); | |
490 | $ftp_conn = 0; | |
491 | } | |
492 | ||
493 | if (preg_match("/\.bz2$/", $f)) { | |
494 | $filter = "bzcat"; | |
495 | } elseif (preg_match("/\.gz$/", $f)) { | |
496 | $filter = "zcat"; | |
497 | } else { | |
498 | $filter = "cat"; | |
499 | } | |
500 | ||
501 | if ($local) { | |
502 | $cmd = "$filter $root_directory$f"; | |
503 | } else { | |
504 | $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1"; | |
505 | } | |
506 | $fd = popen($cmd, "r"); | |
507 | while (($s = fgets($fd, 1000)) != false) { | |
508 | echo $s; | |
509 | } | |
510 | pclose($fd); | |
511 | } | |
512 | ||
513 | function list_archs() | |
514 | { | |
515 | global $addr, $url, $idx; | |
516 | ||
517 | echo "<table width=100% border=0>\n"; | |
518 | echo "<tr><td bgcolor=#cccccc nowrap=1>Failed</td><td bgcolor=#cccccc>Ok</td></tr>\n"; | |
519 | for ($i = 0; $i < count($addr); $i++) | |
520 | echo "<tr><td nowrap=1>". | |
521 | "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>". | |
522 | "[<a href=\"$url?idx=$i&ok=1\">OK</a>]</td>". | |
523 | #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>". | |
524 | "</tr>\n"; | |
525 | echo "</table><hr />\n"; | |
526 | echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n"; | |
527 | echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ". | |
528 | "alt=\"Powered by PLD Linux\" border=0></a><br />\n" . | |
529 | "<small>(c) 2002 ". | |
530 | "<a href=\"mailto:feedback@pld.org.pl\">PLD Team</a>\n". | |
531 | "</small></div>\n"; | |
532 | ||
533 | # smile ;) | |
534 | echo "<div align=center><small>"; | |
535 | $pow = array("vim", "php", "brain", "power", "electricity", | |
536 | "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF", | |
537 | "voodoo magic", "Linux", "x-files", "X", "foobar", | |
538 | "/dev/null", "/dev/zero", "/dev/drzewo", | |
539 | "Leppe'", "matrix", "Neo", "PDP-11", | |
540 | "Ken", "GNU antilope", "PDP-7", "ITS", "Multics", | |
541 | "foobarbaz", "ed", "Joe", "Unix conspiracy", | |
542 | "overclock", "The Right Thing", | |
543 | "The Bad Thing", "Star Treck", "NSA", "NASA", | |
544 | "achelon", "VAX", "Real Programmer", | |
545 | "Real Operating System", "Real Computer", | |
546 | "computron", "bogon", "quantum bogodynamics", | |
547 | "BOFH", "/dev/ill", "nasi tu byli", | |
548 | "Paranoid Android", "Lunatic Corp" | |
549 | # feel free to add sth if you change this file ;) | |
550 | ); | |
551 | echo "Powered by "; | |
552 | $max = 1; | |
553 | for ($i = 0; $i < $max; $i++) { | |
554 | $x = rand(0, count($pow) - 1); | |
555 | if ($pow[$x] == "") $i--; | |
556 | else echo $pow[$x] . ($i == $max - 1 ? "." : ", "); | |
557 | $pow[$x] = ""; | |
558 | } | |
559 | ||
560 | echo "</small></div>"; | |
561 | ||
562 | global $qa_addr; | |
563 | ||
564 | if ($qa_addr[$idx] != "") { | |
565 | echo "<form action=\"index.php\" method=\"post\">"; | |
566 | echo "<input type=hidden name=idx value=$idx />"; | |
567 | echo "<input type=hidden name=action value=sqa />"; | |
568 | echo "<input type=text size=14 name=str /><br/>"; | |
569 | echo "<input type=submit name=submit value=\"Search rpmqa!\" />"; | |
570 | echo "</form>"; | |
571 | } | |
572 | ||
573 | } | |
574 | ||
575 | function get_qa() | |
576 | { | |
577 | global $idx, $qa_addr, $qa_base; | |
578 | ||
579 | if (!isset($idx) || !isset($qa_addr[$idx])) | |
580 | return false; | |
581 | ||
582 | $a = $qa_addr[$idx]; | |
583 | ||
584 | if ($qa_addr[$idx] == "") | |
585 | return false; | |
586 | else | |
587 | return fopen("$qa_base$qa_addr[$idx]", "r"); | |
588 | } | |
589 | ||
590 | function search_qa() | |
591 | { | |
592 | global $url, $idx, $qa_addr, $str; | |
593 | ||
594 | $f = get_qa(); | |
595 | echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>"; | |
596 | ||
597 | start_pre(); | |
598 | ||
599 | if ($f == 0) { | |
600 | echo "Sorry, cannot open."; | |
601 | } else { | |
602 | while (($s = fgets($f, 1000)) != false) { | |
603 | if (stristr($s, $str)) | |
604 | echo $s; | |
605 | } | |
606 | echo "/* EOF */"; | |
607 | } | |
608 | end_pre(); | |
609 | } | |
610 | ||
611 | function dump_qa($plain) | |
612 | { | |
613 | global $url, $idx, $qa_addr; | |
614 | ||
615 | $a = $qa_addr[$idx]; | |
616 | ||
617 | $f = get_qa(); | |
618 | ||
619 | if ($plain) { | |
620 | header("Content-type: text/plain"); | |
621 | echo "# rpm -qa of $a\n"; | |
622 | } else { | |
623 | echo "<h1>rpm -qa of $a</h1>"; | |
624 | echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain " | |
625 | ."version</a>"; | |
626 | start_pre(); | |
627 | } | |
628 | ||
629 | if ($f == 0) { | |
630 | echo "Sorry, cannot open."; | |
631 | } else { | |
632 | while (($s = fgets($f, 1000)) != false) { | |
633 | echo $s; | |
634 | } | |
635 | } | |
636 | ||
637 | if (!$plain) | |
638 | end_pre(); | |
639 | } | |
640 | ||
641 | function welcome() | |
642 | { | |
643 | ?> | |
644 | <table border=0 width=100%><tr><td width=20%> </td><td> | |
645 | <h1>Zdrastwuj!</h1> | |
646 | <p>Welcome to PLD Build Logs WWW interface.</p><p> | |
647 | Feel free to email bug reports, complaints and feature requests | |
648 | <!-- ech... niech strace... --> | |
649 | <a href="mailto:malekith /at/ pld-linux org">to us</a>. Positive opinions are also | |
650 | <a href="mailto:malekith /at/ pld-linux org">welcome</a> ;)</p> | |
f5ca8484 | 651 | <p>Version: $Id: index.php.en,v 1.2 2002/09/25 12:36:07 ankry Exp $</p> |
8627558a | 652 | </td><td width=20%> </td></tr> |
653 | </table> | |
654 | <?php | |
655 | } | |
656 | ||
657 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | |
658 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
659 | header("Cache-Control: no-cache, must-revalidate"); | |
660 | header("Pragma: no-cache"); | |
661 | ||
662 | //phpinfo(); | |
663 | if ($local) { | |
664 | if ($action == "text") { | |
665 | dump_text(); | |
666 | } else if ($action == "qatxt") { | |
667 | dump_qa(1); | |
668 | } else { | |
669 | myheader(); | |
670 | echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>"; | |
671 | list_archs(); | |
672 | echo "</td><td valign=top>"; | |
673 | flush(); | |
674 | if ($action == "qa") | |
675 | dump_qa(0); | |
676 | else if ($action == "sqa") | |
677 | search_qa(); | |
678 | else if (isset($id)) | |
679 | dump_log($action == "tail"); | |
680 | else if (isset($idx)) | |
681 | list_logs(); | |
682 | else | |
683 | welcome(); | |
684 | echo "</td></tr></table>"; | |
685 | trailer(); | |
686 | } | |
687 | } | |
688 | else { | |
689 | ||
690 | if ($action == "text") { | |
691 | dump_text(); | |
692 | } else if ($action == "qatxt") { | |
693 | dump_qa(1); | |
694 | } else { | |
695 | myheader(); | |
696 | echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>"; | |
697 | list_archs(); | |
698 | echo "</td><td valign=top>"; | |
699 | flush(); | |
700 | if ($action == "qa") | |
701 | dump_qa(0); | |
702 | else if (isset($id)) | |
703 | dump_log($action == "tail"); | |
704 | else if (isset($idx)) | |
705 | list_logs(); | |
706 | else | |
707 | welcome(); | |
708 | echo "</td></tr></table>"; | |
709 | trailer(); | |
710 | } | |
711 | } | |
712 | ?> |