2 $buildlogs_server = "buildlogs.pld-linux.org";
39 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
40 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i386.txt",
41 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i486.txt",
42 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i686.txt",
43 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-athlon.txt",
44 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-amd64.txt",
45 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ia64.txt",
46 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-alpha.txt",
47 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-sparc.txt",
48 "http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ppc.txt",
50 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-SRPMS.txt",
51 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/cna/rpmqa-i386.txt",
52 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i586.txt",
53 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/olimp/rpmqa-i686.txt",
54 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-athlon.txt",
55 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-amd64.txt",
56 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/alpha/rpmqa-alpha.txt",
57 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc.txt",
58 "http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-ppc.txt",
59 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i386.txt",
60 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i586.txt",
61 "http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i686.txt",
62 "http://ftp.pld-linux.org/dists/ra/.stat/builder/fly/rpmqa-ra-alpha.txt",
63 "http://ftp.pld-linux.org/dists/ra/.stat/builder/ares/rpmqa-ra-sparc.txt",
64 "http://ftp.pld-linux.org/dists/ra/.stat/builder/an2/rpmqa-ra-ppc.txt",
65 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i486.txt",
66 "http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i686.txt",
67 "http://ftp.nest.pld-linux.org/.stat/builder/alpha/rpmqa-nest-alpha.txt",
68 "http://ftp.nest.pld-linux.org/.stat/builder/an2/rpmqa-nest-ppc.txt"
70 $local = 1; /* $local=0 for FTP */
71 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
73 /* It should be set */
75 $langs["en_US"]["charset"]="ISO-8859-1";
76 $langs["pl_PL"]["charset"]="ISO-8859-2";
79 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
81 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
82 $rows=explode(",",$rows[0]);
83 $lang_detected=rtrim($rows[0]);
84 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
86 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
90 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
92 if (isset($lang_detected) && isset($langs[$lang_detected]))
97 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
98 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
100 putenv("LANG=$lang");
101 setlocale(LC_ALL,$lang);
102 bindtextdomain("messages","locale");
103 textdomain("messages");
105 if (isset($_GET["idx"]))$idx=$_GET["idx"];
106 if (isset($_GET["ok"]))$ok=$_GET["ok"];
108 if (isset($_GET["ns"]))$ns=$_GET["ns"];
110 if (isset($_GET["cnt"]))$cnt=$_GET["cnt"];
111 if (isset($_GET["action"]))$action=$_GET["action"];
113 if (isset($_GET["off"]))$off=$_GET["off"];
114 if (isset($_GET["id"]))$id=$_GET["id"];
116 if (isset($_POST["str"]))$str=$_POST["str"];
117 if (isset($_POST["idx"]))$idx=$_POST["idx"];
118 if (isset($_POST["action"]))$action=$_POST["action"];
122 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
123 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
125 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
126 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
127 <html xmlns="http://www.w3.org/1999/xhtml">
129 <title>PLD Build Logs</title>
130 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
131 <style type="text/css"><!--
132 A { text-decoration: none; }
133 A:hover { text-decoration: underline; }
134 H1 { font-family: arial,helvetica,sans-serif;
137 H2 { font-family: arial,helvetica,sans-serif;
140 BODY,TD { font-family: arial,helvetica,sans-serif;
142 TH { font-family: arial,helvetica,sans-serif;
148 <!-- Diffrent color for visited link doesn't make much sense here...
149 this page is autogenerated and it might be misleading after some
150 build log changes. -->
151 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
157 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
158 "<font color=\"#cccccc\"><pre>";
163 echo "</pre></font></td></tr></table>\n";
168 echo "</body></html>";
174 echo "Fatal error: $msg";
177 function open_ftp($pidx="", $pok="")
179 global $idx, $addr, $buildlogs_server, $ok;
180 global $ftp_conn, $big_url, $url, $ns;
183 if ($pidx==="")$pidx=$idx;
184 if ($pok==="")$pok=$ok;
186 if (!isset($pidx) || !isset($addr[$pidx]))
195 $a = "$addr[$pidx]/OK";
197 $a = "$addr[$pidx]/FAIL";
205 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
207 $ftp = ftp_connect($buildlogs_server);
210 mydie(_("cannot connect to")." $buildlogs_server");
214 if (ftp_login($ftp, "anonymous",
215 "buildlogs-iface@pld-linux.org") == false) {
217 mydie(_("cannot ftp login to")." $buildlogs_server");
221 $list = ftp_nlist($ftp, $a);
222 if ($list == false) {
224 mydie(_("cannot list")." $a");
233 function directory_list($pidx="",$pok="")
235 global $idx, $addr, $buildlogs_server, $ok;
236 global $root_directory, $big_url, $url, $ns;
239 if ($pidx==="")$pidx=$idx;
240 if ($pok==="")$pok=$ok;
241 if (!isset($pidx) || !isset($addr[$pidx]))
250 $a = "$addr[$pidx]/OK";
252 $a = "$addr[$pidx]/FAIL";
260 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
262 $dir = opendir("$root_directory$a");
265 while ($file = readdir($dir)) {
266 if (($file != ".") && ($file != "..")) {
267 $list[$i] = "$a/$file";
277 global $idx, $addr, $ok;
278 global $ftp_conn, $big_url, $ns, $qa_addr;
279 global $off, $cnt, $local, $root_directory;
282 $list = directory_list();
290 echo "<h1>"._("Listing of")." $addr[$idx]/OK "
291 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
293 echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
294 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
297 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
298 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
299 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
300 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
301 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
302 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
303 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
304 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
307 function cmp($f1, $f2) {
308 global $ftp_conn, $root_directory, $local;
310 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
311 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
322 for ($i = $off; $i < $cnt + $off; $i++) {
323 if (!isset($list[$i]))
325 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
326 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
327 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
329 $s = filesize("$root_directory$list[$i]");
330 $t = $now - filemtime("$root_directory$list[$i]");
332 $s = ftp_size($ftp_conn, $list[$i]);
333 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
341 $t = $t . " " . ngettext("day","days",$t);
344 $t = $t . " " . ngettext("hour","hours",$t);
348 $t = $t . " " . ngettext("minute","minutes",$t);
350 $u = "$big_url&off=$off&id=$h";
351 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
352 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
353 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
354 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
355 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
356 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
358 echo "</table></div>\n";
360 $backarr = "<<< ";
361 $back = _("Page back");
362 $forward = _("Page forward");
363 $forwardarr = " >>>";
365 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
371 $hrefurl = "<a href=\"$big_url&off=$noff\">";
372 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
374 echo "$backarr</td><td align=\"left\">$back";
377 echo "</td>\n<td align=\"center\">";
379 if ($qa_addr[$idx] != "") {
380 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
385 echo "</td>\n<td align=right>";
386 if ($off + $cnt < count($list)) {
390 $hrefurl = "<a href=\"$big_url&off=$noff\">";
391 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
393 echo "$forward</td><td align=right width=1%>$forwardarr";
395 echo "</td>\n</tr></table></p>";
404 global $idx, $addr, $ok;
405 global $ftp_conn, $root_directory, $big_url, $ns, $id;
406 global $buildlogs_server, $local;
411 $list = directory_list();
419 for ($i = 0; $i < count($list); $i++) {
420 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
427 mydie(_("cannot find specified file:")." $id");
436 function dump_log($tail)
438 global $idx, $addr, $ok, $url;
439 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
440 global $buildlogs_server, $local, $qa_addr;
447 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
448 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
452 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
454 function one_item($h, $t) {
455 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
456 "<td bgcolor=\"#cccccc\">$t</td></tr>";
459 function href($h, $c) {
460 return "<a href=\"$h\">$c</a>";
463 one_item(_("Status"), ($ok == 1 ?
464 "<font color=green><b>"._("OK")."</b></font>" :
465 "<font color=red><b>"._("Failed")."</b></a>"));
466 one_item(_("Source URL"),
467 href("ftp://$buildlogs_server$f",
468 "ftp://$buildlogs_server$f"));
470 $bu = "$big_url&off=$off";
472 one_item(_("text/plain URL"),
473 href("$bu&id=$id&action=text",
476 one_item(_("full text"),
477 href("$bu&id=$id",
481 if ($qa_addr[$idx] != "") {
482 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
484 one_item(_("rpm -qa of builder"), _("Not available"));
487 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
489 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
492 echo "<tr><td>Here:</td><td>" .
493 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
494 "http://" . getenv("SERVER_NAME") .
495 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
498 echo "</table><h2>"._("Content:")."</h2>";
506 # what can I say beside PHP suxx? how the fuck should I create
507 # bidirectional pipe? gotta use wget
509 if (preg_match("/\.bz2$/", $f)) {
511 } elseif (preg_match("/\.gz$/", $f)) {
518 $cmd = "$filter $root_directory$f";
520 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
523 $cmd = "$cmd | tail -n 100";
524 $fd = popen($cmd, "r");
526 while (($s = fgets($fd, 1000)) != false) {
527 $s = htmlspecialchars($s);
537 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
540 [<a href="<?php echo "$bu&action=qa"
541 ?>"><?=_("View rpm -qa of builder")?></a>]
551 global $ftp_conn, $root_directory;
552 global $buildlogs_server, $local;
554 header("Content-type: text/plain");
561 echo "# src : ftp://$buildlogs_server$f\n";
564 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
567 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
572 if (preg_match("/\.bz2$/", $f)) {
574 } elseif (preg_match("/\.gz$/", $f)) {
581 $cmd = "$filter $root_directory$f";
583 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
585 $fd = popen($cmd, "r");
586 while (($s = fgets($fd, 1000)) != false) {
592 function list_archs()
594 global $addr, $url, $idx, $cnt,$ok,$ns;
599 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
601 echo "<table width=\"100%\" border=\"0\">\n";
602 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
603 for ($i = 0; $i < count($addr); $i++)
604 echo "<tr><td nowrap=\"nowrap\">".
605 "<a href=\"$url?idx=$i&ok=0&cnt=$cnt\">$addr[$i]</a></td><td nowrap=\"nowrap\">".
606 "[<a href=\"$url?idx=$i&ok=1&cnt=$cnt\">OK</a>]</td>".
607 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
609 echo "</table><hr />\n";
611 echo "<div align=\"center\">";
612 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
614 echo "<a href=\"$url\">main()</a><hr />\n";
615 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
616 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
618 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a>\n".
622 echo "<div align=\"center\"><small>";
623 $pow = array("vim", "php", "brain", "power", "electricity",
624 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
625 "voodoo magic", "Linux", "x-files", "X", "foobar",
626 "/dev/null", "/dev/zero", "/dev/drzewo",
627 "Leppe'", "matrix", "Neo", "PDP-11",
628 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
629 "foobarbaz", "ed", "Joe", "Unix conspiracy",
630 "overclock", "The Right Thing",
631 "The Bad Thing", "Star Treck", "NSA", "NASA",
632 "achelon", "VAX", "Real Programmer",
633 "Real Operating System", "Real Computer",
634 "computron", "bogon", "quantum bogodynamics",
635 "BOFH", "/dev/ill", "nasi tu byli",
636 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
637 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
638 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003"
639 # feel free to add sth if you change this file ;)
641 echo _("Powered by")." ";
643 for ($i = 0; $i < $max; $i++) {
644 $x = rand(0, count($pow) - 1);
645 if ($pow[$x] == "") $i--;
646 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
649 echo "</small></div>";
653 if (isset($qa_addr[$idx]) && $qa_addr[$idx] != "") {
654 echo "<form action=\"index.php\" method=\"post\">";
655 echo "<input type=hidden name=idx value=$idx />";
656 echo "<input type=hidden name=action value=sqa />";
657 echo "<input type=text size=14 name=str /><br />";
658 echo "<input type=submit name=submit value=\""._("Search rpmqa!")."\" />";
665 global $idx, $qa_addr;
667 if (!isset($idx) || !isset($qa_addr[$idx]))
672 if ($qa_addr[$idx] == "")
675 return fopen("$qa_addr[$idx]", "r");
680 global $url, $idx, $qa_addr, $str;
683 echo "<h1>"._("Search results for")." '$str' "._("in")." $qa_addr[$idx]</h1>";
688 echo _("Sorry, cannot open.");
690 while (($s = fgets($f, 1000)) != false) {
691 if (stristr($s, $str))
699 function dump_qa($plain)
701 global $url, $idx, $qa_addr;
708 header("Content-type: text/plain");
709 echo _("# rpm -qa of")." $a\n";
711 echo "<h1>"._("rpm -qa of")." $a</h1>";
712 echo "<a href=\"$url?idx=$idx&action=qatxt\">"._("text/plain version")."</a>";
717 echo _("Sorry, cannot open.");
719 while (($s = fgets($f, 1000)) != false) {
729 function adv_search()
731 global $addr, $url, $local, $_POST, $off, $cnt, $root_directory;
733 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
735 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
737 echo "<div align=\"center\">";
738 echo "<table border=\"0\">\n";
740 echo "<td>"._("Package name")."</td>\n";
741 echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"".$_POST[name]."\"/></td>\n";
745 echo "<td>"._("Days")."</td>\n";
746 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"".$_POST["age1"]."\" /></td>\n";
747 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"".$_POST["age2"]."\" /></td>\n";
751 echo "<td>"._("Size")."</td>\n";
752 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"".$_POST["size1"]."\" /></td>\n";
753 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"".$_POST["size2"]."\" /></td>\n";
757 echo "<td>"._("Search logs:")."</td>\n";
761 echo "<td>"._("Failed")."</td>\n";
762 echo "<td>"._("OK")."</td>\n";
765 for ($i = 0; $i < count($addr); $i++)
769 $check=" checked=\"on\"";
770 echo "<td><input name=$name type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
772 $check=" checked=\"on\"";
773 echo "<td><input name=$name type=\"checkbox\"$check>".$addr[$i]."</input></td>\n";
778 echo "<td><input type=submit name=submit value=\""._("Search!")."\" /></td>";
783 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
784 // isset($_POST["size1"]) || isset($_POST["size2"]))
785 if (($_POST["name"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
786 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
790 for ($i = 0; $i < count($addr); $i++)
795 if (isset($_POST["as".$j."_".$i]))
798 $tmp_list = directory_list($i,$j);
800 $tmp_list = open_ftp($i,$j);
802 if (is_array($tmp_list))
804 while (list($k,$name)=each($tmp_list))
806 $s = filesize("$root_directory$name");
807 $t = $now - filemtime("$root_directory$name");
809 if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name)))continue;
810 if (($_POST["age1"]) && ($_POST["age1"]>$t))continue;
811 if (($_POST["age2"]) && ($_POST["age2"]<$t))continue;
813 if (($_POST["size1"]) && ($_POST["size1"]>$s))continue;
814 if (($_POST["size2"]) && ($_POST["size2"]<$s))continue;
816 $list[$i."_".$j."_".$k]=$name;
822 if (sizeof($list)==0)
824 echo _("Nothing found");
828 echo "<table border=\"0\" cellspacing=\"1\" ".
829 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
830 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
831 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
832 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
833 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
834 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
835 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
836 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
839 function cmp1($f1, $f2) {
840 global $ftp_conn, $root_directory, $local;
842 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
843 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
846 function cmp2($f1, $f2) {
847 list($p11,$p12,$p13)=explode("_",$f1);
848 list($p21,$p22,$p23)=explode("_",$f2);
849 return strcmp($f2,$f1);
854 usort($list, "cmp1");
855 // } else if ($ns == 2)
857 // uksort($list, "cmp2");
864 while (list($k,$name)=each($list))
866 if (($counter<$off) || ($counter>$off+$cnt-1))
873 list($i,$j,$k)=explode("_",$k);
875 $h = bin2hex(mhash(MHASH_MD5, $name));
876 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $name);
877 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
879 $s = filesize("$root_directory$name");
880 $t = $now - filemtime("$root_directory$name");
882 $s = ftp_size($ftp_conn, $list[$i]);
883 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
891 $t = $t . " " . ngettext("day","days",$t);
894 $t = $t . " " . ngettext("hour","hours",$t);
898 $t = $t . " " . ngettext("minute","minutes",$t);
900 $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
901 $u = "$big_url&off=$off&id=$h";
903 $builder=$addr[$i]."/".(($j=="1")?"OK":"FAIL");
905 echo "<td bgcolor=#CCCCCC><a href=\"$u\">$builder</a></td>";
906 echo "<td bgcolor=#CCCCCC><a href=\"$u\">$f</a> ".
907 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
908 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
909 "</td><td bgcolor=#CCCCCC align=right>".
910 "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
912 echo "</table></div>\n";
914 $backarr = "<<< ";
915 $back = _("Page back");
916 $forward = _("Page forward");
917 $forwardarr = " >>>";
921 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
927 $hrefurl = "<a href=\"$big_url&off=$noff\">";
928 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
930 echo "$backarr</td><td align=left>$back";
933 echo "</td>\n<td align=\"center\">";
934 echo "</td>\n<td align=\"right\">";
936 if ($off + $cnt < count($list))
941 $hrefurl = "<a href=\"$big_url&off=$noff\">";
942 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
946 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
949 echo "</td>\n</tr></table></p>";
959 echo _("Enter something!");
967 <table border="0" width="100%"><tr><td width="20%"> </td><td>
968 <h1><?=_("Welcome!")?></h1>
969 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
970 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
971 <!-- ech... niech strace... -->
972 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
973 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
974 <p>Version: $Id: index.php,v 1.74 2004/07/09 21:50:35 ankry Exp $</p>
975 </td><td width="20%"> </td></tr>
980 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
981 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
982 header("Cache-Control: no-cache, must-revalidate");
983 header("Pragma: no-cache");
987 if ($action == "text") {
989 } else if ($action == "adv_search") {
993 } else if ($action == "qatxt") {
997 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
999 echo "</td><td valign=\"top\">";
1001 if ($action == "qa")
1003 else if ($action == "sqa")
1005 else if (isset($id))
1006 dump_log($action == "tail");
1007 else if (isset($idx))
1011 echo "</td></tr></table>";
1017 if ($action == "text") {
1019 } else if ($action == "qatxt") {
1023 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=top width=\"10%\">";
1025 echo "</td><td valign=\"top\">";
1027 if ($action == "qa")
1029 else if (isset($id))
1030 dump_log($action == "tail");
1031 else if (isset($idx))
1035 echo "</td></tr></table>";