2 $buildlogs_server = "buildlogs.pld-linux.org";
37 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
38 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i486.txt",
39 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i686.txt",
40 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-athlon.txt",
41 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-x86_64.txt",
42 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ia64.txt",
43 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-alpha.txt",
44 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ppc.txt",
45 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-sparc.txt",
46 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-SRPMS.txt",
47 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i386.txt",
48 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i586.txt",
49 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i686.txt",
50 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-athlon.txt",
51 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-amd64.txt",
52 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-alpha.txt",
53 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-ppc.txt",
54 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc.txt",
55 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc64.txt"/*,
56 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i386.txt",
57 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i586.txt",
58 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i686.txt",
59 "http://ftp.pld-linux.org/dists/ra/.stat/builder/fly/rpmqa-ra-alpha.txt",
60 "http://ftp.pld-linux.org/dists/ra/.stat/builder/an2/rpmqa-ra-ppc.txt",
61 "http://ftp.pld-linux.org/dists/ra/.stat/builder/ares/rpmqa-ra-sparc.txt",
62 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i486.txt",
63 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i686.txt",
64 "http://ftp.nest.pld-linux.org/.stat/builder/alpha/rpmqa-nest-alpha.txt",
65 "http://ftp.nest.pld-linux.org/.stat/builder/an2/rpmqa-nest-ppc.txt"
68 $local = 1; /* $local=0 for FTP */
69 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
71 /* It should be set */
73 $langs["en_US"]["charset"]="ISO-8859-1";
74 $langs["pl_PL"]["charset"]="ISO-8859-2";
77 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
79 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
80 $rows=explode(",",$rows[0]);
81 $lang_detected=rtrim($rows[0]);
82 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
84 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
88 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
90 if (isset($lang_detected) && isset($langs[$lang_detected]))
95 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
96 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
99 setlocale(LC_ALL,$lang);
100 bindtextdomain("messages","locale");
101 textdomain("messages");
103 if (isset($_GET["idx"]))$idx=$_GET["idx"];
104 if (isset($_GET["dist"]))
107 if (isset($_GET["arch"]))
110 for ($i = 0; $i < count($addr); $i++)
112 if ($addr[$i]=="/".$dist."/".$arch)
117 if (isset($_GET["ok"]))$ok=$_GET["ok"];
119 if (isset($_GET["ns"]))$ns=$_GET["ns"];
121 if (isset($_GET["cnt"]))$cnt=$_GET["cnt"];
122 if (isset($_GET["action"]))$action=$_GET["action"];
124 if (isset($_GET["off"]))$off=$_GET["off"];
125 if (isset($_GET["id"]))$id=$_GET["id"];
127 if (isset($_POST["str"]))$str=$_POST["str"];
128 if (isset($_POST["idx"]))$idx=$_POST["idx"];
129 if (isset($_POST["action"]))$action=$_POST["action"];
133 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
134 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
136 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
137 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml">
140 <title>PLD Build Logs</title>
141 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
142 <style type="text/css"><!--
143 A { text-decoration: none; }
144 A:hover { text-decoration: underline; }
145 H1 { font-family: arial,helvetica,sans-serif;
148 H2 { font-family: arial,helvetica,sans-serif;
151 BODY,TD { font-family: arial,helvetica,sans-serif;
153 TH { font-family: arial,helvetica,sans-serif;
159 <!-- Diffrent color for visited link doesn't make much sense here...
160 this page is autogenerated and it might be misleading after some
161 build log changes. -->
162 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
168 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
169 "<font color=\"#cccccc\"><pre style=\"width: 2048px;overflow: scroll\">";
174 echo "</pre></font></td></tr></table>\n";
179 echo "</body></html>";
185 echo "Fatal error: $msg";
188 function open_ftp($pidx="", $pok="")
190 global $idx, $addr, $buildlogs_server, $ok;
191 global $ftp_conn, $big_url, $url, $ns;
194 if ($pidx==="")$pidx=$idx;
195 if ($pok==="")$pok=$ok;
197 if (!isset($pidx) || !isset($addr[$pidx]))
206 $a = "$addr[$pidx]/OK";
208 $a = "$addr[$pidx]/FAIL";
216 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
218 $ftp = ftp_connect($buildlogs_server);
221 mydie(_("cannot connect to")." $buildlogs_server");
225 if (ftp_login($ftp, "anonymous",
226 "buildlogs-iface@pld-linux.org") == false) {
228 mydie(_("cannot ftp login to")." $buildlogs_server");
232 $list = ftp_nlist($ftp, $a);
233 if ($list == false) {
235 mydie(_("cannot list")." $a");
244 function directory_list($pidx="",$pok="")
246 global $idx, $addr, $buildlogs_server, $ok;
247 global $root_directory, $big_url, $url, $ns;
250 if ($pidx==="")$pidx=$idx;
251 if ($pok==="")$pok=$ok;
252 if (!isset($pidx) || !isset($addr[$pidx]))
261 $a = "$addr[$pidx]/OK";
263 $a = "$addr[$pidx]/FAIL";
271 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
273 $dir = opendir("$root_directory$a");
276 while ($file = readdir($dir)) {
277 if (($file != ".") && ($file != "..")) {
278 $list[$i] = array("$a/$file", filemtime("$root_directory$a/$file"));
288 global $idx, $addr, $ok;
289 global $ftp_conn, $big_url, $ns, $qa_addr;
290 global $off, $cnt, $local, $root_directory;
293 $list = directory_list();
301 echo "<h1>"._("Listing of")." $addr[$idx]/OK "
302 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
304 echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
305 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
308 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
309 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
310 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
311 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
312 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
313 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
314 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
315 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
318 function cmp($f1, $f2) {
319 global $ftp_conn, $root_directory, $local;
321 return $f2[1] - $f1[1];//filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
322 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
325 function cmp2($f1, $f2) {
326 return strcmp($f1[0], $f2[0]);
333 usort($list, "cmp2");
337 for ($i = $off; $i < $cnt + $off; $i++) {
338 $filename = $list[$i][0];
339 if (!isset($filename))
341 $h = bin2hex(mhash(MHASH_MD5, $filename));
342 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $filename);
343 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
345 $s = filesize("$root_directory$filename");
346 $t = $now - $list[$i][1];
348 $s = ftp_size($ftp_conn, $list[$i]);
349 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
357 $t = $t . " " . ngettext("day","days",$t);
360 $t = $t . " " . ngettext("hour","hours",$t);
364 $t = $t . " " . ngettext("minute","minutes",$t);
366 $u = "$big_url&off=$off&id=$h";
367 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
368 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
369 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
370 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
371 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
372 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
374 echo "</table></div>\n";
376 $backarr = "<<< ";
377 $back = _("Page back");
378 $forward = _("Page forward");
379 $forwardarr = " >>>";
381 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
387 $hrefurl = "<a href=\"$big_url&off=$noff\">";
388 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
390 echo "$backarr</td><td align=\"left\">$back";
393 echo "</td>\n<td align=\"center\">";
395 if ($qa_addr[$idx] != "") {
396 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
401 echo "</td>\n<td align=right>";
402 if ($off + $cnt < count($list)) {
406 $hrefurl = "<a href=\"$big_url&off=$noff\">";
407 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
409 echo "$forward</td><td align=right width=1%>$forwardarr";
411 echo "</td>\n</tr></table></p>";
420 global $idx, $addr, $ok;
421 global $ftp_conn, $root_directory, $big_url, $ns, $id;
422 global $buildlogs_server, $local;
427 $list = directory_list();
435 for ($i = 0; $i < count($list); $i++) {
436 $h = bin2hex(mhash(MHASH_MD5, $list[$i][0]));
443 mydie(_("cannot find specified file:")." $id");
452 function dump_log($tail)
454 global $idx, $addr, $ok, $url;
455 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
456 global $buildlogs_server, $local, $qa_addr;
463 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
464 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
468 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
470 function one_item($h, $t) {
471 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
472 "<td bgcolor=\"#cccccc\">$t</td></tr>";
475 function href($h, $c) {
476 return "<a href=\"$h\">$c</a>";
479 one_item(_("Status"), ($ok == 1 ?
480 "<font color=\"green\"><b>"._("OK")."</b></font>" :
481 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
482 one_item(_("Source URL"),
483 href("ftp://$buildlogs_server$f",
484 "ftp://$buildlogs_server$f"));
486 $bu = "$big_url&off=$off";
488 one_item(_("text/plain URL"),
489 href("$bu&id=$id&action=text",
492 one_item(_("full text"),
493 href("$bu&id=$id",
497 if ($qa_addr[$idx] != "") {
498 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
500 one_item(_("rpm -qa of builder"), _("Not available"));
503 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
505 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
508 echo "<tr><td>Here:</td><td>" .
509 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
510 "http://" . getenv("SERVER_NAME") .
511 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
514 echo "</table><h2>"._("Content:")."</h2>";
522 # what can I say beside PHP suxx? how the fuck should I create
523 # bidirectional pipe? gotta use wget
525 if (preg_match("/\.bz2$/", $f)) {
527 } elseif (preg_match("/\.gz$/", $f)) {
534 $cmd = "$filter $root_directory$f";
536 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
539 $cmd = "$cmd | tail -n 100";
540 $fd = popen($cmd, "r");
542 while (($s = fgets($fd, 102400)) != false) {
543 if (strlen($s) > 800) {
544 $s = chunk_split($s, 800, "\n ");
547 $s = htmlspecialchars($s);
557 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
560 [<a href="<?php echo "$bu&action=qa"
561 ?>"><?=_("View rpm -qa of builder")?></a>]
571 global $ftp_conn, $root_directory;
572 global $buildlogs_server, $local;
574 header("Content-type: text/plain");
581 echo "# src : ftp://$buildlogs_server$f\n";
584 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
587 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
592 if (preg_match("/\.bz2$/", $f)) {
594 } elseif (preg_match("/\.gz$/", $f)) {
601 $cmd = "$filter $root_directory$f";
603 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
605 $fd = popen($cmd, "r");
606 while (($s = fgets($fd, 1000)) != false) {
612 function list_archs()
614 global $addr, $url, $idx, $cnt,$ok,$ns;
619 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
621 echo "<table width=\"100%\" border=\"0\">\n";
622 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
623 for ($i = 0; $i < count($addr); $i++)
624 echo "<tr><td nowrap=\"nowrap\">".
625 "<a href=\"$url?idx=$i&ok=0&cnt=$cnt\">$addr[$i]</a></td><td nowrap=\"nowrap\">".
626 "[<a href=\"$url?idx=$i&ok=1&cnt=$cnt\">OK</a>]</td>".
627 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
629 echo "</table><hr />\n";
631 echo "<div align=\"center\">";
632 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
634 echo "<a href=\"$url\">main()</a><hr />\n";
635 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
636 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
638 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
643 echo "<div align=\"center\"><small>";
644 $pow = array("vim", "php", "brain", "power", "electricity",
645 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
646 "voodoo magic", "Linux", "x-files", "X", "foobar",
647 "/dev/null", "/dev/zero", "/dev/drzewo",
648 "Leppe'", "matrix", "Neo", "PDP-11",
649 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
650 "foobarbaz", "ed", "Joe", "Unix conspiracy",
651 "overclock", "The Right Thing",
652 "The Bad Thing", "Star Treck", "NSA", "NASA",
653 "achelon", "VAX", "Real Programmer",
654 "Real Operating System", "Real Computer",
655 "computron", "bogon", "quantum bogodynamics",
656 "BOFH", "/dev/ill", "nasi tu byli",
657 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
658 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
659 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003"
660 # feel free to add sth if you change this file ;)
662 echo _("Powered by")." ";
664 for ($i = 0; $i < $max; $i++) {
665 $x = rand(0, count($pow) - 1);
666 if ($pow[$x] == "") $i--;
667 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
670 echo "</small></div>";
674 if (isset($qa_addr[$idx]) && $qa_addr[$idx] != "") {
675 echo "<form action=\"index.php\" method=\"post\">";
676 echo "<input type=\"hidden\" name=\"idx\" value=\"$idx\" />";
677 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
678 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
679 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
686 global $idx, $qa_addr;
688 if (!isset($idx) || !isset($qa_addr[$idx]))
693 if ($qa_addr[$idx] == "")
696 return fopen("$qa_addr[$idx]", "r");
701 global $url, $idx, $qa_addr, $str;
704 echo "<h1>"._("Search results for")." '$str' "._("in")." $qa_addr[$idx]</h1>";
709 echo _("Sorry, cannot open.");
711 while (($s = fgets($f, 1000)) != false) {
712 if (stristr($s, $str))
720 function dump_qa($plain)
722 global $url, $idx, $qa_addr;
729 header("Content-type: text/plain");
730 echo _("# rpm -qa of")." $a\n";
732 echo "<h1>"._("rpm -qa of")." $a</h1>";
733 echo "<a href=\"$url?idx=$idx&action=qatxt\">"._("text/plain version")."</a>";
738 echo _("Sorry, cannot open.");
740 while (($s = fgets($f, 1000)) != false) {
750 function adv_search()
752 global $addr, $url, $local, $_POST, $off, $cnt, $root_directory;
754 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
756 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
758 echo "<div align=\"center\">";
759 echo "<table border=\"0\">\n";
761 echo "<td>"._("Package name")."</td>\n";
762 echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"".$_POST[name]."\"/></td>\n";
766 echo "<td>"._("Days")."</td>\n";
767 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"".$_POST["age1"]."\" /></td>\n";
768 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"".$_POST["age2"]."\" /></td>\n";
772 echo "<td>"._("Size")."</td>\n";
773 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"".$_POST["size1"]."\" /></td>\n";
774 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"".$_POST["size2"]."\" /></td>\n";
778 echo "<td>"._("Search logs:")."</td>\n";
782 echo "<td>"._("Failed")."</td>\n";
783 echo "<td>"._("OK")."</td>\n";
786 for ($i = 0; $i < count($addr); $i++)
790 $check=" checked=\"on\"";
791 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
793 $check=" checked=\"on\"";
794 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
799 echo "<td><input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
804 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
805 // isset($_POST["size1"]) || isset($_POST["size2"]))
806 if (($_POST["name"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
807 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
811 for ($i = 0; $i < count($addr); $i++)
816 if (isset($_POST["as".$j."_".$i]))
819 $tmp_list = directory_list($i,$j);
821 $tmp_list = open_ftp($i,$j);
823 if (is_array($tmp_list))
825 while (list($k,$name)=each($tmp_list))
827 $s = filesize("$root_directory$name[0]");
828 $t = $now - $name[1];
830 if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name[0])))continue;
831 if (($_POST["age1"]) && ($_POST["age1"]>$t))continue;
832 if (($_POST["age2"]) && ($_POST["age2"]<$t))continue;
834 if (($_POST["size1"]) && ($_POST["size1"]>$s))continue;
835 if (($_POST["size2"]) && ($_POST["size2"]<$s))continue;
837 $list[$i."_".$j."_".$k]=$name;
843 if (sizeof($list)==0)
845 echo _("Nothing found");
849 echo "<table border=\"0\" cellspacing=\"1\" ".
850 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
851 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
852 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
853 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
854 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
855 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
856 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
857 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
860 function cmp1($f1, $f2) {
861 global $ftp_conn, $root_directory, $local;
863 return $f2[1] - $f1[1];
864 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
867 function cmp2($f1, $f2) {
868 list($p11,$p12,$p13)=explode("_",$f1[0]);
869 list($p21,$p22,$p23)=explode("_",$f2[0]);
870 return strcmp($f1[0],$f2[0]);
875 usort($list, "cmp1");
876 // } else if ($ns == 2)
878 // uksort($list, "cmp2");
885 while (list($k,$name)=each($list))
887 if (($counter<$off) || ($counter>$off+$cnt-1))
894 list($i,$j,$k)=explode("_",$k);
895 $filename = $name[0];
897 $h = bin2hex(mhash(MHASH_MD5, $filename));
898 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $filename);
899 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
901 $s = filesize("$root_directory$filename");
902 $t = $now - $name[1];
904 $s = ftp_size($ftp_conn, $list[$i]);
905 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
913 $t = $t . " " . ngettext("day","days",$t);
916 $t = $t . " " . ngettext("hour","hours",$t);
920 $t = $t . " " . ngettext("minute","minutes",$t);
922 $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
923 $u = "$big_url&off=$off&id=$h";
925 $builder=$addr[$i]."/".(($j=="1")?"OK":"FAIL");
927 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$builder</a></td>";
928 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
929 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
930 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
931 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
932 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
934 echo "</table></div>\n";
936 $backarr = "<<< ";
937 $back = _("Page back");
938 $forward = _("Page forward");
939 $forwardarr = " >>>";
943 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
949 $hrefurl = "<a href=\"$big_url&off=$noff\">";
950 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
952 echo "$backarr</td><td align=left>$back";
955 echo "</td>\n<td align=\"center\">";
956 echo "</td>\n<td align=\"right\">";
958 if ($off + $cnt < count($list))
963 $hrefurl = "<a href=\"$big_url&off=$noff\">";
964 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
968 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
971 echo "</td>\n</tr></table></p>";
981 echo _("Enter something!");
989 <table border="0" width="100%"><tr><td width="20%"> </td><td>
990 <h1><?=_("Welcome!")?></h1>
991 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
992 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
993 <!-- ech... niech strace... -->
994 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
995 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
996 <p>Version: $Id: index.php,v 1.87 2006/01/28 20:59:43 ankry Exp $</p>
997 </td><td width="20%"> </td></tr>
1002 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1003 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
1004 header("Cache-Control: no-cache, must-revalidate");
1005 header("Pragma: no-cache");
1009 if ($action == "text") {
1011 } else if ($action == "adv_search") {
1015 } else if ($action == "qatxt") {
1019 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
1021 echo "</td><td valign=\"top\">";
1023 if ($action == "qa")
1025 else if ($action == "sqa")
1027 else if (isset($id))
1028 dump_log($action == "tail");
1029 else if (isset($idx))
1033 echo "</td></tr></table>";
1039 if ($action == "text") {
1041 } else if ($action == "qatxt") {
1045 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=top width=\"10%\">";
1047 echo "</td><td valign=\"top\">";
1049 if ($action == "qa")
1051 else if (isset($id))
1052 dump_log($action == "tail");
1053 else if (isset($idx))
1057 echo "</td></tr></table>";