2 $buildlogs_server = "buildlogs.pld-linux.org";
35 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
36 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i486.txt",
37 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i686.txt",
38 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-athlon.txt",
39 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-amd64.txt",
40 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ia64.txt",
41 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-alpha.txt",
42 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-sparc.txt",
43 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ppc.txt",
44 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/ep09/rpmqa-src.txt",
45 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/StarGate/rpmqa-i386.txt",
46 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i586.txt",
47 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/olimp/rpmqa-i686.txt",
48 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/aksjomat/rpmqa-athlon.txt",
49 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/serwus/rpmqa-amd64.txt",
50 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/alpha/rpmqa-alpha.txt",
51 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/syriusz/rpmqa-sparc.txt",
52 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/anduril/rpmqa-ppc.txt",
53 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i386.txt",
54 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i586.txt",
55 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i686.txt",
56 "http://ftp.pld-linux.org/dists/ra/.stat/builder/fly/rpmqa-ra-alpha.txt",
57 "http://ftp.pld-linux.org/dists/ra/.stat/builder/ares/rpmqa-ra-sparc.txt",
58 "http://ftp.pld-linux.org/dists/ra/.stat/builder/an2/rpmqa-ra-ppc.txt",
59 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i486.txt",
60 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i686.txt",
61 "http://ftp.nest.pld-linux.org/.stat/builder/alpha/rpmqa-nest-alpha.txt",
62 "http://ftp.nest.pld-linux.org/.stat/builder/an2/rpmqa-nest-ppc.txt"
64 $local = 1; /* $local=0 for FTP */
65 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
67 /* It should be set */
69 $langs["en_US"]["charset"]="ISO-8859-1";
70 $langs["pl_PL"]["charset"]="ISO-8859-2";
73 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
75 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
76 $rows=explode(",",$rows[0]);
77 $lang_detected=rtrim($rows[0]);
78 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
80 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
84 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
86 if (isset($lang_detected) && isset($langs[$lang_detected]))
91 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
92 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
95 setlocale(LC_ALL,$lang);
96 bindtextdomain("messages","locale");
97 textdomain("messages");
99 if (isset($_GET["idx"]))$idx=$_GET["idx"];
100 if (isset($_GET["dist"]))
103 if (isset($_GET["arch"]))
106 for ($i = 0; $i < count($addr); $i++)
108 if ($addr[$i]=="/".$dist."/".$arch)
113 if (isset($_GET["ok"]))$ok=$_GET["ok"];
115 if (isset($_GET["ns"]))$ns=$_GET["ns"];
117 if (isset($_GET["cnt"]))$cnt=$_GET["cnt"];
118 if (isset($_GET["action"]))$action=$_GET["action"];
120 if (isset($_GET["off"]))$off=$_GET["off"];
121 if (isset($_GET["id"]))$id=$_GET["id"];
123 if (isset($_POST["str"]))$str=$_POST["str"];
124 if (isset($_POST["idx"]))$idx=$_POST["idx"];
125 if (isset($_POST["action"]))$action=$_POST["action"];
129 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
130 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
132 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
133 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
134 <html xmlns="http://www.w3.org/1999/xhtml">
136 <title>PLD Build Logs</title>
137 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
138 <style type="text/css"><!--
139 A { text-decoration: none; }
140 A:hover { text-decoration: underline; }
141 H1 { font-family: arial,helvetica,sans-serif;
144 H2 { font-family: arial,helvetica,sans-serif;
147 BODY,TD { font-family: arial,helvetica,sans-serif;
149 TH { font-family: arial,helvetica,sans-serif;
155 <!-- Diffrent color for visited link doesn't make much sense here...
156 this page is autogenerated and it might be misleading after some
157 build log changes. -->
158 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
164 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
165 "<font color=\"#cccccc\"><pre>";
170 echo "</pre></font></td></tr></table>\n";
175 echo "</body></html>";
181 echo "Fatal error: $msg";
184 function open_ftp($pidx="", $pok="")
186 global $idx, $addr, $buildlogs_server, $ok;
187 global $ftp_conn, $big_url, $url, $ns;
190 if ($pidx==="")$pidx=$idx;
191 if ($pok==="")$pok=$ok;
193 if (!isset($pidx) || !isset($addr[$pidx]))
202 $a = "$addr[$pidx]/OK";
204 $a = "$addr[$pidx]/FAIL";
212 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
214 $ftp = ftp_connect($buildlogs_server);
217 mydie(_("cannot connect to")." $buildlogs_server");
221 if (ftp_login($ftp, "anonymous",
222 "buildlogs-iface@pld-linux.org") == false) {
224 mydie(_("cannot ftp login to")." $buildlogs_server");
228 $list = ftp_nlist($ftp, $a);
229 if ($list == false) {
231 mydie(_("cannot list")." $a");
240 function directory_list($pidx="",$pok="")
242 global $idx, $addr, $buildlogs_server, $ok;
243 global $root_directory, $big_url, $url, $ns;
246 if ($pidx==="")$pidx=$idx;
247 if ($pok==="")$pok=$ok;
248 if (!isset($pidx) || !isset($addr[$pidx]))
257 $a = "$addr[$pidx]/OK";
259 $a = "$addr[$pidx]/FAIL";
267 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
269 $dir = opendir("$root_directory$a");
272 while ($file = readdir($dir)) {
273 if (($file != ".") && ($file != "..")) {
274 $list[$i] = "$a/$file";
284 global $idx, $addr, $ok;
285 global $ftp_conn, $big_url, $ns, $qa_addr;
286 global $off, $cnt, $local, $root_directory;
289 $list = directory_list();
297 echo "<h1>"._("Listing of")." $addr[$idx]/OK "
298 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
300 echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
301 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
304 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
305 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
306 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
307 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
308 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
309 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
310 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
311 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
314 function cmp($f1, $f2) {
315 global $ftp_conn, $root_directory, $local;
317 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
318 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
329 for ($i = $off; $i < $cnt + $off; $i++) {
330 if (!isset($list[$i]))
332 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
333 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
334 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
336 $s = filesize("$root_directory$list[$i]");
337 $t = $now - filemtime("$root_directory$list[$i]");
339 $s = ftp_size($ftp_conn, $list[$i]);
340 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
348 $t = $t . " " . ngettext("day","days",$t);
351 $t = $t . " " . ngettext("hour","hours",$t);
355 $t = $t . " " . ngettext("minute","minutes",$t);
357 $u = "$big_url&off=$off&id=$h";
358 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
359 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
360 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
361 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
362 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
363 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
365 echo "</table></div>\n";
367 $backarr = "<<< ";
368 $back = _("Page back");
369 $forward = _("Page forward");
370 $forwardarr = " >>>";
372 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
378 $hrefurl = "<a href=\"$big_url&off=$noff\">";
379 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
381 echo "$backarr</td><td align=\"left\">$back";
384 echo "</td>\n<td align=\"center\">";
386 if ($qa_addr[$idx] != "") {
387 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
392 echo "</td>\n<td align=right>";
393 if ($off + $cnt < count($list)) {
397 $hrefurl = "<a href=\"$big_url&off=$noff\">";
398 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
400 echo "$forward</td><td align=right width=1%>$forwardarr";
402 echo "</td>\n</tr></table></p>";
411 global $idx, $addr, $ok;
412 global $ftp_conn, $root_directory, $big_url, $ns, $id;
413 global $buildlogs_server, $local;
418 $list = directory_list();
426 for ($i = 0; $i < count($list); $i++) {
427 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
434 mydie(_("cannot find specified file:")." $id");
443 function dump_log($tail)
445 global $idx, $addr, $ok, $url;
446 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
447 global $buildlogs_server, $local, $qa_addr;
454 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
455 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
459 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
461 function one_item($h, $t) {
462 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
463 "<td bgcolor=\"#cccccc\">$t</td></tr>";
466 function href($h, $c) {
467 return "<a href=\"$h\">$c</a>";
470 one_item(_("Status"), ($ok == 1 ?
471 "<font color=\"green\"><b>"._("OK")."</b></font>" :
472 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
473 one_item(_("Source URL"),
474 href("ftp://$buildlogs_server$f",
475 "ftp://$buildlogs_server$f"));
477 $bu = "$big_url&off=$off";
479 one_item(_("text/plain URL"),
480 href("$bu&id=$id&action=text",
483 one_item(_("full text"),
484 href("$bu&id=$id",
488 if ($qa_addr[$idx] != "") {
489 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
491 one_item(_("rpm -qa of builder"), _("Not available"));
494 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
496 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
499 echo "<tr><td>Here:</td><td>" .
500 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
501 "http://" . getenv("SERVER_NAME") .
502 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
505 echo "</table><h2>"._("Content:")."</h2>";
513 # what can I say beside PHP suxx? how the fuck should I create
514 # bidirectional pipe? gotta use wget
516 if (preg_match("/\.bz2$/", $f)) {
518 } elseif (preg_match("/\.gz$/", $f)) {
525 $cmd = "$filter $root_directory$f";
527 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
530 $cmd = "$cmd | tail -n 100";
531 $fd = popen($cmd, "r");
533 while (($s = fgets($fd, 102400)) != false) {
534 $s = chunk_split($s, 800, "\n ");
535 $s = htmlspecialchars($s);
545 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
548 [<a href="<?php echo "$bu&action=qa"
549 ?>"><?=_("View rpm -qa of builder")?></a>]
559 global $ftp_conn, $root_directory;
560 global $buildlogs_server, $local;
562 header("Content-type: text/plain");
569 echo "# src : ftp://$buildlogs_server$f\n";
572 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
575 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
580 if (preg_match("/\.bz2$/", $f)) {
582 } elseif (preg_match("/\.gz$/", $f)) {
589 $cmd = "$filter $root_directory$f";
591 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
593 $fd = popen($cmd, "r");
594 while (($s = fgets($fd, 1000)) != false) {
600 function list_archs()
602 global $addr, $url, $idx, $cnt,$ok,$ns;
607 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
609 echo "<table width=\"100%\" border=\"0\">\n";
610 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
611 for ($i = 0; $i < count($addr); $i++)
612 echo "<tr><td nowrap=\"nowrap\">".
613 "<a href=\"$url?idx=$i&ok=0&cnt=$cnt\">$addr[$i]</a></td><td nowrap=\"nowrap\">".
614 "[<a href=\"$url?idx=$i&ok=1&cnt=$cnt\">OK</a>]</td>".
615 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
617 echo "</table><hr />\n";
619 echo "<div align=\"center\">";
620 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
622 echo "<a href=\"$url\">main()</a><hr />\n";
623 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
624 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
626 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
631 echo "<div align=\"center\"><small>";
632 $pow = array("vim", "php", "brain", "power", "electricity",
633 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
634 "voodoo magic", "Linux", "x-files", "X", "foobar",
635 "/dev/null", "/dev/zero", "/dev/drzewo",
636 "Leppe'", "matrix", "Neo", "PDP-11",
637 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
638 "foobarbaz", "ed", "Joe", "Unix conspiracy",
639 "overclock", "The Right Thing",
640 "The Bad Thing", "Star Treck", "NSA", "NASA",
641 "achelon", "VAX", "Real Programmer",
642 "Real Operating System", "Real Computer",
643 "computron", "bogon", "quantum bogodynamics",
644 "BOFH", "/dev/ill", "nasi tu byli",
645 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
646 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
647 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003"
648 # feel free to add sth if you change this file ;)
650 echo _("Powered by")." ";
652 for ($i = 0; $i < $max; $i++) {
653 $x = rand(0, count($pow) - 1);
654 if ($pow[$x] == "") $i--;
655 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
658 echo "</small></div>";
662 if (isset($qa_addr[$idx]) && $qa_addr[$idx] != "") {
663 echo "<form action=\"index.php\" method=\"post\">";
664 echo "<input type=\"hidden\" name=\"idx\" value=\"$idx\" />";
665 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
666 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
667 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
674 global $idx, $qa_addr;
676 if (!isset($idx) || !isset($qa_addr[$idx]))
681 if ($qa_addr[$idx] == "")
684 return fopen("$qa_addr[$idx]", "r");
689 global $url, $idx, $qa_addr, $str;
692 echo "<h1>"._("Search results for")." '$str' "._("in")." $qa_addr[$idx]</h1>";
697 echo _("Sorry, cannot open.");
699 while (($s = fgets($f, 1000)) != false) {
700 if (stristr($s, $str))
708 function dump_qa($plain)
710 global $url, $idx, $qa_addr;
717 header("Content-type: text/plain");
718 echo _("# rpm -qa of")." $a\n";
720 echo "<h1>"._("rpm -qa of")." $a</h1>";
721 echo "<a href=\"$url?idx=$idx&action=qatxt\">"._("text/plain version")."</a>";
726 echo _("Sorry, cannot open.");
728 while (($s = fgets($f, 1000)) != false) {
738 function adv_search()
740 global $addr, $url, $local, $_POST, $off, $cnt, $root_directory;
742 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
744 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
746 echo "<div align=\"center\">";
747 echo "<table border=\"0\">\n";
749 echo "<td>"._("Package name")."</td>\n";
750 echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"".$_POST[name]."\"/></td>\n";
754 echo "<td>"._("Days")."</td>\n";
755 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"".$_POST["age1"]."\" /></td>\n";
756 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"".$_POST["age2"]."\" /></td>\n";
760 echo "<td>"._("Size")."</td>\n";
761 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"".$_POST["size1"]."\" /></td>\n";
762 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"".$_POST["size2"]."\" /></td>\n";
766 echo "<td>"._("Search logs:")."</td>\n";
770 echo "<td>"._("Failed")."</td>\n";
771 echo "<td>"._("OK")."</td>\n";
774 for ($i = 0; $i < count($addr); $i++)
778 $check=" checked=\"on\"";
779 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
781 $check=" checked=\"on\"";
782 echo "<td><input name=\"$name\" type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
787 echo "<td><input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
792 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
793 // isset($_POST["size1"]) || isset($_POST["size2"]))
794 if (($_POST["name"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
795 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
799 for ($i = 0; $i < count($addr); $i++)
804 if (isset($_POST["as".$j."_".$i]))
807 $tmp_list = directory_list($i,$j);
809 $tmp_list = open_ftp($i,$j);
811 if (is_array($tmp_list))
813 while (list($k,$name)=each($tmp_list))
815 $s = filesize("$root_directory$name");
816 $t = $now - filemtime("$root_directory$name");
818 if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name)))continue;
819 if (($_POST["age1"]) && ($_POST["age1"]>$t))continue;
820 if (($_POST["age2"]) && ($_POST["age2"]<$t))continue;
822 if (($_POST["size1"]) && ($_POST["size1"]>$s))continue;
823 if (($_POST["size2"]) && ($_POST["size2"]<$s))continue;
825 $list[$i."_".$j."_".$k]=$name;
831 if (sizeof($list)==0)
833 echo _("Nothing found");
837 echo "<table border=\"0\" cellspacing=\"1\" ".
838 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
839 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
840 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
841 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
842 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
843 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
844 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
845 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
848 function cmp1($f1, $f2) {
849 global $ftp_conn, $root_directory, $local;
851 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
852 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
855 function cmp2($f1, $f2) {
856 list($p11,$p12,$p13)=explode("_",$f1);
857 list($p21,$p22,$p23)=explode("_",$f2);
858 return strcmp($f2,$f1);
863 usort($list, "cmp1");
864 // } else if ($ns == 2)
866 // uksort($list, "cmp2");
873 while (list($k,$name)=each($list))
875 if (($counter<$off) || ($counter>$off+$cnt-1))
882 list($i,$j,$k)=explode("_",$k);
884 $h = bin2hex(mhash(MHASH_MD5, $name));
885 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $name);
886 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
888 $s = filesize("$root_directory$name");
889 $t = $now - filemtime("$root_directory$name");
891 $s = ftp_size($ftp_conn, $list[$i]);
892 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
900 $t = $t . " " . ngettext("day","days",$t);
903 $t = $t . " " . ngettext("hour","hours",$t);
907 $t = $t . " " . ngettext("minute","minutes",$t);
909 $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
910 $u = "$big_url&off=$off&id=$h";
912 $builder=$addr[$i]."/".(($j=="1")?"OK":"FAIL");
914 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$builder</a></td>";
915 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
916 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
917 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
918 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
919 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
921 echo "</table></div>\n";
923 $backarr = "<<< ";
924 $back = _("Page back");
925 $forward = _("Page forward");
926 $forwardarr = " >>>";
930 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
936 $hrefurl = "<a href=\"$big_url&off=$noff\">";
937 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
939 echo "$backarr</td><td align=left>$back";
942 echo "</td>\n<td align=\"center\">";
943 echo "</td>\n<td align=\"right\">";
945 if ($off + $cnt < count($list))
950 $hrefurl = "<a href=\"$big_url&off=$noff\">";
951 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
955 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
958 echo "</td>\n</tr></table></p>";
968 echo _("Enter something!");
976 <table border="0" width="100%"><tr><td width="20%"> </td><td>
977 <h1><?=_("Welcome!")?></h1>
978 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
979 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
980 <!-- ech... niech strace... -->
981 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
982 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
983 <p>Version: $Id: index.php,v 1.81 2005/09/04 12:34:28 arekm Exp $</p>
984 </td><td width="20%"> </td></tr>
989 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
990 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
991 header("Cache-Control: no-cache, must-revalidate");
992 header("Pragma: no-cache");
996 if ($action == "text") {
998 } else if ($action == "adv_search") {
1002 } else if ($action == "qatxt") {
1006 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
1008 echo "</td><td valign=\"top\">";
1010 if ($action == "qa")
1012 else if ($action == "sqa")
1014 else if (isset($id))
1015 dump_log($action == "tail");
1016 else if (isset($idx))
1020 echo "</td></tr></table>";
1026 if ($action == "text") {
1028 } else if ($action == "qatxt") {
1032 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=top width=\"10%\">";
1034 echo "</td><td valign=\"top\">";
1036 if ($action == "qa")
1038 else if (isset($id))
1039 dump_log($action == "tail");
1040 else if (isset($idx))
1044 echo "</td></tr></table>";