2 $buildlogs_server = "buildlogs.pld-linux.org";
36 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
37 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i486.txt",
38 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i686.txt",
39 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-athlon.txt",
40 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-amd64.txt",
41 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ia64.txt",
42 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-alpha.txt",
43 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ppc.txt",
44 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-sparc.txt",
45 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-SRPMS.txt",
46 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i386.txt",
47 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i586.txt",
48 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i686.txt",
49 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-athlon.txt",
50 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-amd64.txt",
51 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-alpha.txt",
52 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-ppc.txt",
53 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc.txt",
54 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc64.txt",
55 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i386.txt",
56 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i586.txt",
57 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i686.txt",
58 "http://ftp.pld-linux.org/dists/ra/.stat/builder/fly/rpmqa-ra-alpha.txt",
59 "http://ftp.pld-linux.org/dists/ra/.stat/builder/an2/rpmqa-ra-ppc.txt",
60 "http://ftp.pld-linux.org/dists/ra/.stat/builder/ares/rpmqa-ra-sparc.txt",
61 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i486.txt",
62 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i686.txt",
63 "http://ftp.nest.pld-linux.org/.stat/builder/alpha/rpmqa-nest-alpha.txt",
64 "http://ftp.nest.pld-linux.org/.stat/builder/an2/rpmqa-nest-ppc.txt"
66 $local = 1; /* $local=0 for FTP */
67 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
69 /* It should be set */
71 $langs["en_US"]["charset"]="ISO-8859-1";
72 $langs["pl_PL"]["charset"]="ISO-8859-2";
75 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
77 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
78 $rows=explode(",",$rows[0]);
79 $lang_detected=rtrim($rows[0]);
80 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
82 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
86 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
88 if (isset($lang_detected) && isset($langs[$lang_detected]))
93 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
94 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
97 setlocale(LC_ALL,$lang);
98 bindtextdomain("messages","locale");
99 textdomain("messages");
101 if (isset($_GET["idx"]))$idx=$_GET["idx"];
102 if (isset($_GET["dist"]))
105 if (isset($_GET["arch"]))
108 for ($i = 0; $i < count($addr); $i++)
110 if ($addr[$i]=="/".$dist."/".$arch)
115 if (isset($_GET["ok"]))$ok=$_GET["ok"];
117 if (isset($_GET["ns"]))$ns=$_GET["ns"];
119 if (isset($_GET["cnt"]))$cnt=$_GET["cnt"];
120 if (isset($_GET["action"]))$action=$_GET["action"];
122 if (isset($_GET["off"]))$off=$_GET["off"];
123 if (isset($_GET["id"]))$id=$_GET["id"];
125 if (isset($_POST["str"]))$str=$_POST["str"];
126 if (isset($_POST["idx"]))$idx=$_POST["idx"];
127 if (isset($_POST["action"]))$action=$_POST["action"];
131 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
132 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
134 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
135 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
136 <html xmlns="http://www.w3.org/1999/xhtml">
138 <title>PLD Build Logs</title>
139 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
140 <style type="text/css"><!--
141 A { text-decoration: none; }
142 A:hover { text-decoration: underline; }
143 H1 { font-family: arial,helvetica,sans-serif;
146 H2 { font-family: arial,helvetica,sans-serif;
149 BODY,TD { font-family: arial,helvetica,sans-serif;
151 TH { font-family: arial,helvetica,sans-serif;
157 <!-- Diffrent color for visited link doesn't make much sense here...
158 this page is autogenerated and it might be misleading after some
159 build log changes. -->
160 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
166 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
167 "<font color=\"#cccccc\"><pre style=\"width: 2048px;overflow: scroll\">";
172 echo "</pre></font></td></tr></table>\n";
177 echo "</body></html>";
183 echo "Fatal error: $msg";
186 function open_ftp($pidx="", $pok="")
188 global $idx, $addr, $buildlogs_server, $ok;
189 global $ftp_conn, $big_url, $url, $ns;
192 if ($pidx==="")$pidx=$idx;
193 if ($pok==="")$pok=$ok;
195 if (!isset($pidx) || !isset($addr[$pidx]))
204 $a = "$addr[$pidx]/OK";
206 $a = "$addr[$pidx]/FAIL";
214 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
216 $ftp = ftp_connect($buildlogs_server);
219 mydie(_("cannot connect to")." $buildlogs_server");
223 if (ftp_login($ftp, "anonymous",
224 "buildlogs-iface@pld-linux.org") == false) {
226 mydie(_("cannot ftp login to")." $buildlogs_server");
230 $list = ftp_nlist($ftp, $a);
231 if ($list == false) {
233 mydie(_("cannot list")." $a");
242 function directory_list($pidx="",$pok="")
244 global $idx, $addr, $buildlogs_server, $ok;
245 global $root_directory, $big_url, $url, $ns;
248 if ($pidx==="")$pidx=$idx;
249 if ($pok==="")$pok=$ok;
250 if (!isset($pidx) || !isset($addr[$pidx]))
259 $a = "$addr[$pidx]/OK";
261 $a = "$addr[$pidx]/FAIL";
269 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
271 $dir = opendir("$root_directory$a");
274 while ($file = readdir($dir)) {
275 if (($file != ".") && ($file != "..")) {
276 $list[$i] = "$a/$file";
286 global $idx, $addr, $ok;
287 global $ftp_conn, $big_url, $ns, $qa_addr;
288 global $off, $cnt, $local, $root_directory;
291 $list = directory_list();
299 echo "<h1>"._("Listing of")." $addr[$idx]/OK "
300 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
302 echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
303 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
306 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
307 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
308 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
309 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
310 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
311 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
312 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
313 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
316 function cmp($f1, $f2) {
317 global $ftp_conn, $root_directory, $local;
319 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
320 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
331 for ($i = $off; $i < $cnt + $off; $i++) {
332 if (!isset($list[$i]))
334 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
335 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
336 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
338 $s = filesize("$root_directory$list[$i]");
339 $t = $now - filemtime("$root_directory$list[$i]");
341 $s = ftp_size($ftp_conn, $list[$i]);
342 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
350 $t = $t . " " . ngettext("day","days",$t);
353 $t = $t . " " . ngettext("hour","hours",$t);
357 $t = $t . " " . ngettext("minute","minutes",$t);
359 $u = "$big_url&off=$off&id=$h";
360 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
361 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
362 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
363 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
364 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
365 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
367 echo "</table></div>\n";
369 $backarr = "<<< ";
370 $back = _("Page back");
371 $forward = _("Page forward");
372 $forwardarr = " >>>";
374 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
380 $hrefurl = "<a href=\"$big_url&off=$noff\">";
381 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
383 echo "$backarr</td><td align=\"left\">$back";
386 echo "</td>\n<td align=\"center\">";
388 if ($qa_addr[$idx] != "") {
389 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
394 echo "</td>\n<td align=right>";
395 if ($off + $cnt < count($list)) {
399 $hrefurl = "<a href=\"$big_url&off=$noff\">";
400 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
402 echo "$forward</td><td align=right width=1%>$forwardarr";
404 echo "</td>\n</tr></table></p>";
413 global $idx, $addr, $ok;
414 global $ftp_conn, $root_directory, $big_url, $ns, $id;
415 global $buildlogs_server, $local;
420 $list = directory_list();
428 for ($i = 0; $i < count($list); $i++) {
429 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
436 mydie(_("cannot find specified file:")." $id");
445 function dump_log($tail)
447 global $idx, $addr, $ok, $url;
448 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
449 global $buildlogs_server, $local, $qa_addr;
456 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
457 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
461 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
463 function one_item($h, $t) {
464 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
465 "<td bgcolor=\"#cccccc\">$t</td></tr>";
468 function href($h, $c) {
469 return "<a href=\"$h\">$c</a>";
472 one_item(_("Status"), ($ok == 1 ?
473 "<font color=\"green\"><b>"._("OK")."</b></font>" :
474 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
475 one_item(_("Source URL"),
476 href("ftp://$buildlogs_server$f",
477 "ftp://$buildlogs_server$f"));
479 $bu = "$big_url&off=$off";
481 one_item(_("text/plain URL"),
482 href("$bu&id=$id&action=text",
485 one_item(_("full text"),
486 href("$bu&id=$id",
490 if ($qa_addr[$idx] != "") {
491 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
493 one_item(_("rpm -qa of builder"), _("Not available"));
496 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
498 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
501 echo "<tr><td>Here:</td><td>" .
502 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
503 "http://" . getenv("SERVER_NAME") .
504 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
507 echo "</table><h2>"._("Content:")."</h2>";
515 # what can I say beside PHP suxx? how the fuck should I create
516 # bidirectional pipe? gotta use wget
518 if (preg_match("/\.bz2$/", $f)) {
520 } elseif (preg_match("/\.gz$/", $f)) {
527 $cmd = "$filter $root_directory$f";
529 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
532 $cmd = "$cmd | tail -n 100";
533 $fd = popen($cmd, "r");
535 while (($s = fgets($fd, 102400)) != false) {
536 if (strlen($s) > 800) {
537 $s = chunk_split($s, 800, "\n ");
540 $s = htmlspecialchars($s);
550 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
553 [<a href="<?php echo "$bu&action=qa"
554 ?>"><?=_("View rpm -qa of builder")?></a>]
564 global $ftp_conn, $root_directory;
565 global $buildlogs_server, $local;
567 header("Content-type: text/plain");
574 echo "# src : ftp://$buildlogs_server$f\n";
577 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
580 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
585 if (preg_match("/\.bz2$/", $f)) {
587 } elseif (preg_match("/\.gz$/", $f)) {
594 $cmd = "$filter $root_directory$f";
596 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
598 $fd = popen($cmd, "r");
599 while (($s = fgets($fd, 1000)) != false) {
605 function list_archs()
607 global $addr, $url, $idx, $cnt,$ok,$ns;
612 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
614 echo "<table width=\"100%\" border=\"0\">\n";
615 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
616 for ($i = 0; $i < count($addr); $i++)
617 echo "<tr><td nowrap=\"nowrap\">".
618 "<a href=\"$url?idx=$i&ok=0&cnt=$cnt\">$addr[$i]</a></td><td nowrap=\"nowrap\">".
619 "[<a href=\"$url?idx=$i&ok=1&cnt=$cnt\">OK</a>]</td>".
620 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
622 echo "</table><hr />\n";
624 echo "<div align=\"center\">";
625 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
627 echo "<a href=\"$url\">main()</a><hr />\n";
628 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
629 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
631 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
636 echo "<div align=\"center\"><small>";
637 $pow = array("vim", "php", "brain", "power", "electricity",
638 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
639 "voodoo magic", "Linux", "x-files", "X", "foobar",
640 "/dev/null", "/dev/zero", "/dev/drzewo",
641 "Leppe'", "matrix", "Neo", "PDP-11",
642 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
643 "foobarbaz", "ed", "Joe", "Unix conspiracy",
644 "overclock", "The Right Thing",
645 "The Bad Thing", "Star Treck", "NSA", "NASA",
646 "achelon", "VAX", "Real Programmer",
647 "Real Operating System", "Real Computer",
648 "computron", "bogon", "quantum bogodynamics",
649 "BOFH", "/dev/ill", "nasi tu byli",
650 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
651 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
652 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003"
653 # feel free to add sth if you change this file ;)
655 echo _("Powered by")." ";
657 for ($i = 0; $i < $max; $i++) {
658 $x = rand(0, count($pow) - 1);
659 if ($pow[$x] == "") $i--;
660 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
663 echo "</small></div>";
667 if (isset($qa_addr[$idx]) && $qa_addr[$idx] != "") {
668 echo "<form action=\"index.php\" method=\"post\">";
669 echo "<input type=\"hidden\" name=\"idx\" value=\"$idx\" />";
670 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
671 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
672 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
679 global $idx, $qa_addr;
681 if (!isset($idx) || !isset($qa_addr[$idx]))
686 if ($qa_addr[$idx] == "")
689 return fopen("$qa_addr[$idx]", "r");
694 global $url, $idx, $qa_addr, $str;
697 echo "<h1>"._("Search results for")." '$str' "._("in")." $qa_addr[$idx]</h1>";
702 echo _("Sorry, cannot open.");
704 while (($s = fgets($f, 1000)) != false) {
705 if (stristr($s, $str))
713 function dump_qa($plain)
715 global $url, $idx, $qa_addr;
722 header("Content-type: text/plain");
723 echo _("# rpm -qa of")." $a\n";
725 echo "<h1>"._("rpm -qa of")." $a</h1>";
726 echo "<a href=\"$url?idx=$idx&action=qatxt\">"._("text/plain version")."</a>";
731 echo _("Sorry, cannot open.");
733 while (($s = fgets($f, 1000)) != false) {
743 function adv_search()
745 global $addr, $url, $local, $_POST, $off, $cnt, $root_directory;
747 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
749 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
751 echo "<div align=\"center\">";
752 echo "<table border=\"0\">\n";
754 echo "<td>"._("Package name")."</td>\n";
755 echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"".$_POST[name]."\"/></td>\n";
759 echo "<td>"._("Days")."</td>\n";
760 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"".$_POST["age1"]."\" /></td>\n";
761 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"".$_POST["age2"]."\" /></td>\n";
765 echo "<td>"._("Size")."</td>\n";
766 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"".$_POST["size1"]."\" /></td>\n";
767 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"".$_POST["size2"]."\" /></td>\n";
771 echo "<td>"._("Search logs:")."</td>\n";
775 echo "<td>"._("Failed")."</td>\n";
776 echo "<td>"._("OK")."</td>\n";
779 for ($i = 0; $i < count($addr); $i++)
783 $check=" checked=\"on\"";
784 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
786 $check=" checked=\"on\"";
787 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
792 echo "<td><input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
797 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
798 // isset($_POST["size1"]) || isset($_POST["size2"]))
799 if (($_POST["name"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
800 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
804 for ($i = 0; $i < count($addr); $i++)
809 if (isset($_POST["as".$j."_".$i]))
812 $tmp_list = directory_list($i,$j);
814 $tmp_list = open_ftp($i,$j);
816 if (is_array($tmp_list))
818 while (list($k,$name)=each($tmp_list))
820 $s = filesize("$root_directory$name");
821 $t = $now - filemtime("$root_directory$name");
823 if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name)))continue;
824 if (($_POST["age1"]) && ($_POST["age1"]>$t))continue;
825 if (($_POST["age2"]) && ($_POST["age2"]<$t))continue;
827 if (($_POST["size1"]) && ($_POST["size1"]>$s))continue;
828 if (($_POST["size2"]) && ($_POST["size2"]<$s))continue;
830 $list[$i."_".$j."_".$k]=$name;
836 if (sizeof($list)==0)
838 echo _("Nothing found");
842 echo "<table border=\"0\" cellspacing=\"1\" ".
843 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
844 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
845 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
846 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
847 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
848 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
849 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
850 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
853 function cmp1($f1, $f2) {
854 global $ftp_conn, $root_directory, $local;
856 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
857 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
860 function cmp2($f1, $f2) {
861 list($p11,$p12,$p13)=explode("_",$f1);
862 list($p21,$p22,$p23)=explode("_",$f2);
863 return strcmp($f2,$f1);
868 usort($list, "cmp1");
869 // } else if ($ns == 2)
871 // uksort($list, "cmp2");
878 while (list($k,$name)=each($list))
880 if (($counter<$off) || ($counter>$off+$cnt-1))
887 list($i,$j,$k)=explode("_",$k);
889 $h = bin2hex(mhash(MHASH_MD5, $name));
890 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $name);
891 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
893 $s = filesize("$root_directory$name");
894 $t = $now - filemtime("$root_directory$name");
896 $s = ftp_size($ftp_conn, $list[$i]);
897 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
905 $t = $t . " " . ngettext("day","days",$t);
908 $t = $t . " " . ngettext("hour","hours",$t);
912 $t = $t . " " . ngettext("minute","minutes",$t);
914 $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
915 $u = "$big_url&off=$off&id=$h";
917 $builder=$addr[$i]."/".(($j=="1")?"OK":"FAIL");
919 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$builder</a></td>";
920 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
921 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
922 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
923 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
924 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
926 echo "</table></div>\n";
928 $backarr = "<<< ";
929 $back = _("Page back");
930 $forward = _("Page forward");
931 $forwardarr = " >>>";
935 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
941 $hrefurl = "<a href=\"$big_url&off=$noff\">";
942 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
944 echo "$backarr</td><td align=left>$back";
947 echo "</td>\n<td align=\"center\">";
948 echo "</td>\n<td align=\"right\">";
950 if ($off + $cnt < count($list))
955 $hrefurl = "<a href=\"$big_url&off=$noff\">";
956 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
960 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
963 echo "</td>\n</tr></table></p>";
973 echo _("Enter something!");
981 <table border="0" width="100%"><tr><td width="20%"> </td><td>
982 <h1><?=_("Welcome!")?></h1>
983 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
984 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
985 <!-- ech... niech strace... -->
986 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
987 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
988 <p>Version: $Id: index.php,v 1.85 2005/09/05 10:30:08 arekm Exp $</p>
989 </td><td width="20%"> </td></tr>
994 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
995 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
996 header("Cache-Control: no-cache, must-revalidate");
997 header("Pragma: no-cache");
1001 if ($action == "text") {
1003 } else if ($action == "adv_search") {
1007 } else if ($action == "qatxt") {
1011 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
1013 echo "</td><td valign=\"top\">";
1015 if ($action == "qa")
1017 else if ($action == "sqa")
1019 else if (isset($id))
1020 dump_log($action == "tail");
1021 else if (isset($idx))
1025 echo "</td></tr></table>";
1031 if ($action == "text") {
1033 } else if ($action == "qatxt") {
1037 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=top width=\"10%\">";
1039 echo "</td><td valign=\"top\">";
1041 if ($action == "qa")
1043 else if (isset($id))
1044 dump_log($action == "tail");
1045 else if (isset($idx))
1049 echo "</td></tr></table>";