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