--- /dev/null
+<?php
+$buildlogs_server = "buildlogs.pld.org.pl";
+$url = "index.php";
+$addr = array(
+ "/nest/athlon",
+ "/nest/i386",
+ "/nest/i586",
+ "/nest/i686",
+ "/nest/ppc",
+ "/ra/i386",
+ "/ra/i586",
+ "/ra/i686",
+ "/ra/alpha",
+ "/ra/sparc",
+ "/ra/ppc"
+);
+$qa_base = "http://ftp.pld.org.pl/.stat/builder";
+$qa_addr = array(
+ "",
+ "/kenny/rpmqa-nest-i386.txt",
+ "/kenny/rpmqa-nest-i586.txt",
+ "/kenny/rpmqa-nest-i686.txt",
+ "",
+ "/ep/rpmqa-ra-i386.txt",
+ "/ep/rpmqa-ra-i586.txt",
+ "/ep/rpmqa-ra-i686.txt",
+ "/mifgate/rpmqa-ra-alpha.txt",
+ "",
+ ""
+);
+$local = 1; /* $local=0 for FTP */
+$root_directory = "/home/services/ftp/pub/logs";
+/* It should be set */
+
+
+function myheader()
+{
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Logi budowania PLD</title>
+ <style TYPE="text/css"><!--
+A { text-decoration: none; }
+A:hover { text-decoration: underline; }
+H1 { font-family: arial,helvetica,sans-serif;
+ font-size: 20pt;
+ font-weight: bold;}
+H2 { font-family: arial,helvetica,sans-serif;
+ font-size: 18pt;
+ font-weight: bold;}
+BODY,TD { font-family: arial,helvetica,sans-serif;
+ font-size: 13pt; }
+TH { font-family: arial,helvetica,sans-serif;
+ font-size: 13pt;
+ font-weight: bold; }
+//-->
+</style>
+ </head>
+ <!-- Diffrent color for visited link doesn't make much sense here...
+ this page is autogenerated and it might be misleading after some
+ build log changes. -->
+ <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
+<?php
+}
+
+function start_pre()
+{
+ echo "<table cellpadding=10><tr><td bgcolor=\"#000000\">".
+ "<font color=\"#cccccc\"><pre>";
+}
+
+function end_pre()
+{
+ echo "</pre></font></td></tr></table>\n";
+}
+
+function trailer()
+{
+ echo "</body></html>";
+}
+
+
+function mydie($msg)
+{
+ echo "B³±d krytyczny: $msg";
+}
+
+function open_ftp()
+{
+ global $idx, $addr, $buildlogs_server, $ok;
+ global $ftp_conn, $big_url, $url, $ns;
+ global $off, $cnt;
+
+ if (!isset($idx) || !isset($addr[$idx]))
+ return false;
+
+ if ($ok != 1)
+ $ok = 0;
+ if ($ns != 1)
+ $ns = 0;
+
+ if ($ok == 1) {
+ $a = "$addr[$idx]/OK";
+ } else {
+ $a = "$addr[$idx]/FAIL";
+ }
+
+ if (!isset($off))
+ $off = 0;
+ if (!isset($cnt))
+ $cnt = 16;
+
+ $big_url = "$url?idx=$idx&ok=$ok&ns=$ns";
+
+ $ftp = ftp_connect($buildlogs_server);
+
+ if ($ftp == false) {
+ mydie("nie mo¿na po³±czyæ siê z $buildlogs_server");
+ return false;
+ }
+
+ if (ftp_login($ftp, "anonymous",
+ "buildlogs-iface@pld.org.pl") == false) {
+ ftp_quit($ftp);
+ mydie("nie mo¿na zalogowaæ siê do serwera FTP $buildlogs_server");
+ return false;
+ }
+
+ $list = ftp_nlist($ftp, $a);
+ if ($list == false) {
+ ftp_quit($ftp);
+ mydie("nie mo¿na wy¶wietliæ $a");
+ return false;
+ }
+
+ $ftp_conn = $ftp;
+
+ return $list;
+}
+
+function directory_list()
+{
+ global $idx, $addr, $buildlogs_server, $ok;
+ global $root_directory, $big_url, $url, $ns;
+ global $off, $cnt;
+
+ if (!isset($idx) || !isset($addr[$idx]))
+ return false;
+
+ if ($ok != 1)
+ $ok = 0;
+ if ($ns != 1)
+ $ns = 0;
+
+ if ($ok == 1) {
+ $a = "$addr[$idx]/OK";
+ } else {
+ $a = "$addr[$idx]/FAIL";
+ }
+
+ if (!isset($off))
+ $off = 0;
+ if (!isset($cnt))
+ $cnt = 16;
+
+ $big_url = "$url?idx=$idx&ok=$ok&ns=$ns";
+
+ $dir = opendir("$root_directory$a");
+ $i = 0;
+ while ($file = readdir($dir)) {
+ if (($file != ".") && ($file != "..")) {
+ $list[$i] = "$a/$file";
+ $i++;
+ }
+ }
+ closedir($dir);
+ return $list;
+}
+
+function list_logs()
+{
+ global $idx, $addr, $ok;
+ global $ftp_conn, $big_url, $ns;
+ global $off, $cnt;
+
+ $list = open_ftp();
+
+ if ($list == false)
+ return;
+
+ if ($ok == 1) {
+ echo "<h1>Zawarto¶æ $addr[$idx]/OK "
+ ."(<a href=\"$big_url&ok=0\">b³êdy</a>)</h1>";
+ } else {
+ echo "<h1>Zawarto¶æ $addr[$idx]/FAIL "
+ ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
+ }
+
+ echo "<div align=center><table border=0 cellspacing=1 ".
+ "cellpadding=3 bgcolor=#000000 width=90%>\n";
+ echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Plik logu ".
+ "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
+ "<th bgcolor=#CCCCFF align=right width=15%>Rozmiar</th> ".
+ "<th bgcolor=#CCCCFF align=left>Wiek ".
+ "[<a href=\"$big_url&ns=0\">porz±dek</a>]</th>".
+ "</th></tr>";
+
+ function cmp($f1, $f2) {
+ global $ftp_conn;
+
+ return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
+ }
+
+ if ($ns != 1) {
+ $ns = 0;
+ usort($list, cmp);
+ } else {
+ sort($list);
+ }
+
+ $now = time();
+ for ($i = $off; $i < $cnt + $off; $i++) {
+ if (!isset($list[$i]))
+ continue;
+ $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
+ $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
+ $f = preg_replace("/\.(bz2|gz)$/", "", $f);
+ $s = ftp_size($ftp_conn, $list[$i]);
+ $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
+ $t /= 60;
+ if ($t >= 60) {
+ $t /= 60;
+ if ($t >= 24) {
+ $t /= 24;
+ $t = round($t);
+ if ($t > 1) {
+ $t = $t . " dni";
+ } else {
+ $t = $t . " dzieñ";
+ }
+ } else {
+ $t = round($t);
+ if ($t > 1) {
+ $t = $t . " godzin";
+ } else {
+ $t = $t . " godzina";
+ }
+ }
+ } else {
+ $t = round($t);
+ if ($t != 1 && ) {
+ $t = $t . " minut";
+ } else {
+ $t = $t . " minuta";
+ }
+ }
+ $u = "$big_url&cnt=$cnt&off=$off&id=$h";
+ echo "<tr><td bgcolor=#CCCCCC><a ".
+ "href=\"$u\">".
+ "$f</a> ".
+ "[<a href=\"$u&action=text\">tekst</a> | ".
+ "<a href=\"$u&action=tail\">koñcówka</a>]".
+ "</td><td bgcolor=#CCCCCC align=right>".
+ "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
+ }
+ echo "</table></div>\n";
+
+ $back = "<<< Poprzednia strona";
+ $forward = "Nastêpna strona >>>";
+
+ echo "<p align=center><table width=90%><tr><td align=left width=25%>";
+
+ if ($off > 0) {
+ $noff = $off - $cnt;
+ if ($noff < 0)
+ $noff = 0;
+ echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$back</a>\n";
+ } else {
+ echo "$back\n";
+ }
+
+ echo "</td><td width=50% align=center>";
+
+ echo "[<a href=\"$big_url&action=qa\">Wynik rpm -qa na ".
+ "builderze</a>]\n";
+
+ echo "</td><td align=right width=25%>";
+ if ($off + $cnt < count($list)) {
+ $noff = $off + $cnt;
+ if ($noff < 0)
+ $noff = 0;
+ echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$forward</a>\n";
+ } else {
+ echo "$forward\n";
+ }
+ echo "</td></tr></table></p>";
+
+ ftp_quit($ftp_conn);
+ $ftp_conn = 0;
+}
+
+function local_list_logs()
+{
+ global $idx, $addr, $ok;
+ global $root_directory, $big_url, $ns;
+ global $off, $cnt;
+
+ $list = directory_list();
+
+ if ($list == false)
+ return;
+
+ if ($ok == 1) {
+ echo "<h1>Listing of $addr[$idx]/OK "
+ ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>";
+ } else {
+ echo "<h1>Listing of $addr[$idx]/FAIL "
+ ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
+ }
+
+ echo "<div align=center><table border=0 cellspacing=1 ".
+ "cellpadding=3 bgcolor=#000000 width=90%>\n";
+ echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ".
+ "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
+ "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ".
+ "<th bgcolor=#CCCCFF align=left>Age ".
+ "[<a href=\"$big_url&ns=0\">sort</a>]</th>".
+ "</th></tr>";
+
+ function cmp($f1, $f2) {
+ global $root_directory;
+
+ return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
+ }
+
+ if ($ns != 1) {
+ $ns = 0;
+ usort($list, cmp);
+ } else {
+ sort($list);
+ }
+
+ $now = time();
+ for ($i = $off; $i < $cnt + $off; $i++) {
+ if (!isset($list[$i]))
+ continue;
+ $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
+ $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
+ $f = preg_replace("/\.(bz2|gz)$/", "", $f);
+ $s = filesize("$root_directory$list[$i]");
+ $t = $now - filemtime("$root_directory$list[$i]");
+ $t /= 60;
+ if ($t >= 60) {
+ $t /= 60;
+ if ($t >= 24) {
+ $t /= 24;
+ $t = round($t);
+ if ($t = 1) {
+ $t = $t . " dzieñ";
+ } else {
+ $t = $t . " dni";
+ }
+ } else {
+ $t = round($t);
+ $t0 = $t % 10;
+ $t1 = $t % 100 - $t0;
+ if ($t = 1) {
+ $t = $t . " godzina";
+ elseif ($t1 != 1 && $t0 >= 2 && $t0 <= 4)) {
+ $t = $t . " godziny";
+ } else {
+ $t = $t . " godzin";
+ }
+ }
+ } else {
+ $t = round($t);
+ $t0 = $t % 10;
+ $t1 = $t % 100 - $t0;
+ if ($t = 1) {
+ $t = $t . " minuta";
+ elseif ($t1 != 1 && $t0 >= 2 && $t0 <= 4)) {
+ $t = $t . " minuty";
+ } else {
+ $t = $t . " minut";
+ }
+ }
+ $u = "$big_url&cnt=$cnt&off=$off&id=$h";
+ echo "<tr><td bgcolor=#CCCCCC><a ".
+ "href=\"$u\">".
+ "$f</a> ".
+ "[<a href=\"$u&action=text\">tekst</a> | ".
+ "<a href=\"$u&action=tail\">koñcówka</a>]".
+ "</td><td bgcolor=#CCCCCC align=right>".
+ "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
+ }
+ echo "</table></div>\n";
+
+ $back = "<<< Poprzednia strona";
+ $forward = "Nastêpna strona >>>";
+
+ echo "<p align=center><table width=90%><tr><td align=left width=25%>";
+
+ if ($off > 0) {
+ $noff = $off - $cnt;
+ if ($noff < 0)
+ $noff = 0;
+ echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$back</a>\n";
+ } else {
+ echo "$back\n";
+ }
+
+ echo "</td><td width=50% align=center>";
+
+ echo "[<a href=\"$big_url&action=qa\">Wynik rpm -qa na ".
+ "builderze</a>]\n";
+
+ echo "</td><td align=right width=25%>";
+ if ($off + $cnt < count($list)) {
+ $noff = $off + $cnt;
+ if ($noff < 0)
+ $noff = 0;
+ echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$forward</a>\n";
+ } else {
+ echo "$forward\n";
+ }
+ echo "</td></tr></table></p>";
+}
+
+function file_name()
+{
+ global $idx, $addr, $ok;
+ global $ftp_conn, $big_url, $ns, $id;
+ global $buildlogs_server;
+
+ if (!isset($id))
+ return false;
+
+ $list = open_ftp();
+
+ if ($list == false)
+ return false;
+
+ $f = false;
+ for ($i = 0; $i < count($list); $i++) {
+ $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
+ if ($h == $id) {
+ $f = $list[$i];
+ }
+ }
+
+ if ($f == false) {
+ mydie("nie mo¿na znale¼æ podanego pliku: $id");
+ ftp_quit($ftp_conn);
+ return false;
+ }
+
+ return $f;
+}
+
+
+function local_file_name()
+{
+ global $idx, $addr, $ok;
+ global $root_directory, $big_url, $ns, $id;
+ global $buildlogs_server;
+
+ if (!isset($id))
+ return false;
+
+ $list = directory_list();
+
+ if ($list == false)
+ return false;
+
+ $f = false;
+ for ($i = 0; $i < count($list); $i++) {
+ $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
+ if ($h == $id) {
+ $f = $list[$i];
+ }
+ }
+
+ if ($f == false) {
+ mydie("nie mo¿na znale¼æ podanego pliku: $id");
+ return false;
+ }
+
+ return $f;
+}
+
+
+function dump_log($tail)
+{
+ global $idx, $addr, $ok, $url;
+ global $ftp_conn, $big_url, $ns, $id, $cnt, $off;
+ global $buildlogs_server;
+
+ $f = file_name();
+
+ if ($f == false)
+ return;
+
+ $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
+ $df = preg_replace("/\.(bz2|gz)$/", "", $df);
+
+ echo "<h1>$df</h1>";
+
+ echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
+
+ function one_item($h, $t) {
+ echo "<tr><td bgcolor=#ccccff>$h:</td>".
+ "<td bgcolor=#cccccc>$t</td></tr>";
+ }
+
+ function href($h, $c) {
+ return "<a href=\"$h\">$c</a>";
+ }
+
+ one_item("Status", ($ok == 1 ?
+ "<font color=green><b>OK</b></font>" :
+ "<font color=red><b>B³±d</b></a>"));
+ one_item("URL do pliku",
+ href("ftp://$buildlogs_server$f",
+ "ftp://$buildlogs_server$f"));
+
+ $bu = "$big_url&cnt=$cnt&off=$off";
+
+ one_item("URL do wersji tekstowej",
+ href("$bu&id=$id&action=text",
+ "Zobacz!"));
+ if ($tail) {
+ one_item("pe³na wersja",
+ href("$bu&&id=$id",
+ "Zobacz!"));
+ }
+
+ one_item("rpm -qa na builderze", href("$bu&action=qa", "Zobacz!"));
+ one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
+ /*
+ echo "<tr><td>Tutaj:</td><td>" .
+ "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
+ "http://" . getenv("SERVER_NAME") .
+ getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
+ "</td></tr>"; */
+
+ echo "</table><h2>Zawarto¶æ:</h2>";
+
+ ftp_quit($ftp_conn);
+ $ftp_conn = 0;
+
+
+ # what can I say beside PHP suxx? how the fuck should I create
+ # bidirectional pipe? gotta use wget
+
+ if (preg_match("/\.bz2$/", $f)) {
+ $filter = "| bzcat 2>&1";
+ } elseif (preg_match("/\.gz$/", $f)) {
+ $filter = "| zcat 2>&1";
+ } else {
+ $filter = "";
+ }
+
+ $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 $filter";
+ if ($tail)
+ $cmd = "$cmd | tail -n 100";
+ $fd = popen($cmd, "r");
+ start_pre();
+ while (($s = fgets($fd, 1000)) != false) {
+ $s = htmlspecialchars($s);
+ echo $s;
+ }
+ end_pre();
+ pclose($fd);
+
+?>
+ <table width=100%>
+ <tr>
+ <td align=left>
+ [<a href="<?php echo $bu; ?>">Powrót do listy logów</a>]
+ </td>
+ <td align=right>
+ [<a href="<?php echo "$bu&action=qa"
+ ?>">Wynik rpm -qa na builderze</a>]
+ </td>
+ </tr>
+ </table>
+<?php
+
+}
+
+
+function local_dump_log($tail)
+{
+ global $idx, $addr, $ok, $url;
+ global $root_directory, $big_url, $ns, $id, $cnt, $off;
+ global $buildlogs_server;
+
+ $f = local_file_name();
+
+ if ($f == false)
+ return;
+
+ $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
+ $df = preg_replace("/\.(bz2|gz)$/", "", $df);
+
+ echo "<h1>$df</h1>";
+
+ echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
+
+ function one_item($h, $t) {
+ echo "<tr><td bgcolor=#ccccff>$h:</td>".
+ "<td bgcolor=#cccccc>$t</td></tr>";
+ }
+
+ function href($h, $c) {
+ return "<a href=\"$h\">$c</a>";
+ }
+
+ one_item("Status", ($ok == 1 ?
+ "<font color=green><b>OK</b></font>" :
+ "<font color=red><b>B³±d</b></a>"));
+ one_item("URL do pliku",
+ href("ftp://$buildlogs_server$f",
+ "ftp://$buildlogs_server$f"));
+
+ $bu = "$big_url&cnt=$cnt&off=$off";
+
+ one_item("URL do wersji tekstowej",
+ href("$bu&id=$id&action=text",
+ "Zobacz!"));
+ if ($tail) {
+ one_item("pe³na wersja",
+ href("$bu&&id=$id",
+ "Zobacz!"));
+ }
+
+ one_item("rpm -qa na builderze", href("$bu&action=qa", "Zobacz!"));
+ one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
+ /*
+ echo "<tr><td>Tutaj:</td><td>" .
+ "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
+ "http://" . getenv("SERVER_NAME") .
+ getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
+ "</td></tr>"; */
+
+ echo "</table><h2>Zawarto¶æ:</h2>";
+
+ # what can I say beside PHP suxx? how the fuck should I create
+ # bidirectional pipe? gotta use wget
+
+ if (preg_match("/\.bz2$/", $f)) {
+ $cmd = "bzcat $root_directory$f";
+ } elseif (preg_match("/\.gz$/", $f)) {
+ $cmd = "zcat $root_directory$f";
+ } else {
+ $cmd = "cat $root_directory$f";
+ }
+
+ if ($tail)
+ $cmd = "$cmd | tail -n 100";
+ $fd = popen($cmd, "r");
+ start_pre();
+ while (($s = fgets($fd, 1000)) != false) {
+ $s = htmlspecialchars($s);
+ echo $s;
+ }
+ end_pre();
+ pclose($fd);
+
+?>
+ <table width=100%>
+ <tr>
+ <td align=left>
+ [<a href="<?php echo $bu; ?>">Powrót do listy logów</a>]
+ </td>
+ <td align=right>
+ [<a href="<?php echo "$bu&action=qa"
+ ?>">Wynik rpm -qa na builderze</a>]
+ </td>
+ </tr>
+ </table>
+<?php
+
+}
+
+function dump_text()
+{
+ global $ftp_conn;
+ global $buildlogs_server;
+
+ header("Content-type: text/plain");
+
+ $f = file_name();
+
+ if ($f == false)
+ return;
+
+ echo "# ¼ród³o : ftp://$buildlogs_server$f\n";
+ echo "# czas : " .
+ date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
+
+ ftp_quit($ftp_conn);
+ $ftp_conn = 0;
+
+ if (preg_match("/\.bz2$/", $f)) {
+ $filter = "| bzcat 2>&1";
+ } elseif (preg_match("/\.gz$/", $f)) {
+ $filter = "| zcat 2>&1";
+ } else {
+ $filter = "";
+ }
+
+ $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 $filter";
+ $fd = popen($cmd, "r");
+ while (($s = fgets($fd, 1000)) != false) {
+ echo $s;
+ }
+ pclose($fd);
+}
+
+
+function local_dump_text()
+{
+ global $root_directory;
+ global $buildlogs_server;
+
+ header("Content-type: text/plain");
+
+ $f = local_file_name();
+
+ if ($f == false)
+ return;
+
+ echo "# ¼ród³o : ftp://$buildlogs_server$f\n";
+ echo "# czas : " .
+ date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
+
+ if (preg_match("/\.bz2$/", $f)) {
+ $cmd = "bzcat";
+ } elseif (preg_match("/\.gz$/", $f)) {
+ $cmd = "zcat";
+ } else {
+ $cmd = "cat";
+ }
+
+ $fd = popen("$cmd $root_directory$f", "r");
+ while (($s = fgets($fd, 1000)) != false) {
+ echo $s;
+ }
+ pclose($fd);
+}
+
+
+function list_archs()
+{
+ global $addr, $url, $idx;
+
+ echo "<table width=100% border=0>\n";
+ echo "<tr><td bgcolor=#cccccc nowrap=1>B³êdy</td><td bgcolor=#cccccc>Ok</td></tr>\n";
+ for ($i = 0; $i < count($addr); $i++)
+ echo "<tr><td nowrap=1>".
+ "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>".
+ "[<a href=\"$url?idx=$i&ok=1\">OK</a>]</td>".
+ #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
+ "</tr>\n";
+ echo "</table><hr />\n";
+ echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n";
+ echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ".
+ "alt=\"Wspierany przez PLD Linux\" border=0></a><br />\n" .
+ "<small>(c) 2002 ".
+ "<a href=\"mailto:feedback@pld.org.pl\">Zespó³ PLD</a>\n".
+ "</small></div>\n";
+
+ # smile ;)
+ echo "<div align=center><small>";
+ $pow = array("vim-a", "php", "mózg", "moc", "elektryczno¶æ",
+ "kawê", "UFO", "pingwina", "GNOME'a", "ELF", "DWARF",
+ "voodoo magic", "Linuksa", "x-files", "X", "foobar",
+ "/dev/null", "/dev/zero", "/dev/drzewo",
+ "Leppe'", "matrix", "Neo", "PDP-11",
+ "Ken", "antylopê GNU", "PDP-7", "ITS", "Multics",
+ "foobarbaz", "ed", "Joe'a", "konspiracjê Unix",
+ "przetaktowanie", "The Right Thing",
+ "The Bad Thing", "Star Treck", "NSA", "NASA",
+ "achelon", "VAX-a", "prawdziwego programistê",
+ "prawdziwy system operacyjny", "prawdziwy komputer",
+ "computron", "bogon", "bogodynamikê kwantow±",
+ "BOFH-a", "/dev/ill", "nasi tu byli",
+ "paranoicznego androida", "Lunatic Corp"
+ # feel free to add sth if you change this file ;)
+ );
+ echo "Wspierany przez ";
+ $max = 1;
+ for ($i = 0; $i < $max; $i++) {
+ $x = rand(0, count($pow) - 1);
+ if ($pow[$x] == "") $i--;
+ else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
+ $pow[$x] = "";
+ }
+
+ echo "</small></div>";
+
+ global $qa_addr;
+
+ if ($qa_addr[$idx] != "") {
+ echo "<form action=\"index.php\" method=\"post\">";
+ echo "<input type=hidden name=idx value=$idx />";
+ echo "<input type=hidden name=action value=sqa />";
+ echo "<input type=text size=14 name=str /><br/>";
+ echo "<input type=submit name=submit value=\"Szukaj w rpmqa!\" />";
+ echo "</form>";
+ }
+
+}
+
+function get_qa()
+{
+ global $idx, $qa_addr, $qa_base;
+
+ if (!isset($idx) || !isset($qa_addr[$idx]))
+ return false;
+
+ $a = $qa_addr[$idx];
+
+ if ($qa_addr[$idx] == "")
+ return false;
+ else
+ return fopen("$qa_base$qa_addr[$idx]", "r");
+}
+
+function search_qa()
+{
+ global $url, $idx, $qa_addr, $str;
+
+ $f = get_qa();
+ echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>";
+
+ start_pre();
+
+ if ($f == 0) {
+ echo "Niestety, nie mo¿na otworzyæ.";
+ } else {
+ while (($s = fgets($f, 1000)) != false) {
+ if (stristr($s, $str))
+ echo $s;
+ }
+ echo "/* EOF */";
+ }
+ end_pre();
+}
+
+function dump_qa($plain)
+{
+ global $url, $idx, $qa_addr;
+
+ $a = $qa_addr[$idx];
+
+ $f = get_qa();
+
+ if ($plain) {
+ header("Content-type: text/plain");
+ echo "# wynik rpm -qa $a\n";
+ } else {
+ echo "<h1>rpm -qa of $a</h1>";
+ echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain "
+ ."version</a>";
+ start_pre();
+ }
+
+ if ($f == 0) {
+ echo "Niestety, nie mo¿na otworzyæ.";
+ } else {
+ while (($s = fgets($f, 1000)) != false) {
+ echo $s;
+ }
+ }
+
+ if (!$plain)
+ end_pre();
+}
+
+function welcome()
+{
+?>
+<table border=0 width=100%><tr><td width=20%> </td><td>
+<h1>Zdrastwuj!</h1>
+<p>Witamy w interfejsie WWW logów budowania PLD.</p><p>
+Mo¿esz
+<a href="mailto:malekith /at/ pld-linux org">do nas</a>
+swobodnie przysy³aæ informacje o b³êdach, za¿alenia i ¿yczenia odno¶nie
+nowych funkcji. Pozytywne opinie s± równie¿
+<a href="mailto:malekith /at/ pld-linux org">mile widziane</a> ;)</p>
+<p>Version: $Id: index.php,v 1.14 2002/07/01 14:18:31 ankry Exp $</p>
+</td><td width=20%> </td></tr>
+</table>
+<?php
+}
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+//phpinfo();
+if ($local) {
+ if ($action == "text") {
+ local_dump_text();
+ } else if ($action == "qatxt") {
+ dump_qa(1);
+ } else {
+ myheader();
+ echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
+ list_archs();
+ echo "</td><td valign=top>";
+ flush();
+ if ($action == "qa")
+ dump_qa(0);
+ else if ($action == "sqa")
+ search_qa();
+ else if (isset($id))
+ local_dump_log($action == "tail");
+ else if (isset($idx))
+ local_list_logs();
+ else
+ welcome();
+ echo "</td></tr></table>";
+ trailer();
+ }
+}
+else {
+
+ if ($action == "text") {
+ dump_text();
+ } else if ($action == "qatxt") {
+ dump_qa(1);
+ } else {
+ myheader();
+ echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
+ list_archs();
+ echo "</td><td valign=top>";
+ flush();
+ if ($action == "qa")
+ dump_qa(0);
+ else if (isset($id))
+ dump_log($action == "tail");
+ else if (isset($idx))
+ list_logs();
+ else
+ welcome();
+ echo "</td></tr></table>";
+ trailer();
+ }
+}
+?>