2 if (!function_exists("ob_gzhandler"))
3 die("ob_gzhandler function is missing - install php zlib module");
5 ob_start("ob_gzhandler", 1);
6 $buildlogs_server = "buildlogs.pld-linux.org";
8 $fail_or_ok = array( "FAIL", "OK" );
10 $database = 'sqlite:/home/services/ftp/buildlogs2.db';
11 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
14 // $database, $root_directory and others are taken from buildlogs.inc
15 include('buildlogs.inc');
17 /* It should be set */
19 $langs["en_US"]["charset"]="ISO-8859-1";
20 $langs["pl_PL"]["charset"]="ISO-8859-2";
24 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
26 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
27 $rows=explode(",",$rows[0]);
28 $lang_detected=rtrim($rows[0]);
29 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
31 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
35 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
37 if (isset($lang_detected) && isset($langs[$lang_detected]))
42 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
43 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
46 setlocale(LC_ALL,$lang);
47 bindtextdomain("messages","locale");
48 textdomain("messages");
50 if (isset($_GET["dist"]) && isset($_GET["arch"]))
52 $dist = basename($_GET["dist"]);
53 $arch = basename($_GET["arch"]);
56 if (isset($_POST["dist"])) $dist = basename($_POST["dist"]);
57 if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
59 if (isset($_GET["name"])) {
60 $name_url = urlencode($_GET["name"]);
61 $name = basename($_GET["name"]);
63 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
65 if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
67 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
69 if (isset($_GET["action"]))$action=$_GET["action"];
71 if (isset($_GET["off"]))$off=(int)$_GET["off"];
73 if (isset($_GET["id"]))$id=$_GET["id"];
75 if (isset($_POST["str"]))$str=$_POST["str"];
76 if (isset($_POST["action"]))$action=$_POST["action"];
78 if (isset($arch) && $arch == "src")
83 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
84 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
86 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
87 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
88 <html xmlns="http://www.w3.org/1999/xhtml">
90 <title>PLD Build Logs</title>
91 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
92 <style type="text/css"><!--
93 A { text-decoration: none; }
94 A:hover { text-decoration: underline; }
95 H1 { font-family: arial,helvetica,sans-serif;
98 H2 { font-family: arial,helvetica,sans-serif;
101 BODY,TD { font-family: arial,helvetica,sans-serif;
103 TH { font-family: arial,helvetica,sans-serif;
106 /* error lines from build logs */
108 background-color: #b00;
115 background-color: #161;
123 <!-- Diffrent color for visited link doesn't make much sense here...
124 this page is autogenerated and it might be misleading after some
125 build log changes. -->
126 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
132 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
133 "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
138 echo "</pre></font></td></tr></table>\n";
143 echo "</body></html>";
149 echo "Fatal error: $msg";
157 global $arch, $dist, $ok;
158 global $big_url, $ns;
159 global $off, $cnt, $root_directory, $url;
161 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
164 echo "<h1>"._("Listing of")." $dist/$arch/OK "
165 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
167 echo "<h1>"._("Listing of")." $dist/$arch/FAIL "
168 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
171 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
172 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
173 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
174 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
175 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
176 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
177 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
178 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
181 if ($ns != 1) $ns = 0;
182 if (!isset($ok)) $ok = 0;
183 // if (!isset($off)) $off = 0;
184 // if (!isset($cnt)) $cnt = 50;
185 if ($ns == 0) $order = "mtime DESC";
186 else $order = "name";
188 $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE "
189 . "dist = '$dist' AND arch = '$arch' AND ok = $ok ORDER BY $order LIMIT $cnt OFFSET $off";
192 $dbh = new PDO("$database");
193 } catch (PDOException $e) {
194 mydie("new PDO: " . $e->getMessage());
198 foreach ($dbh->query("$query") as $row) {
199 $name = $row["name"];
201 $dist = $row["dist"];
202 $arch = $row["arch"];
204 $name_url = urlencode($name);
205 $t = $now - $row["mtime"];
215 $t = $t . " " . ngettext("day","days",$t);
218 $t = $t . " " . ngettext("hour","hours",$t);
222 $t = $t . " " . ngettext("minute","minutes",$t);
224 $u = "$url?dist=$dist&arch=$arch&ok=$ok&name=$name_url&id=$id";
225 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
226 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
227 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
228 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
229 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
230 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
234 echo "</table></div>\n";
236 $backarr = "<<< ";
237 $back = _("Page back");
238 $forward = _("Page forward");
239 $forwardarr = " >>>";
241 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
244 $noff = $off - $count;
247 $hrefurl = "<a href=\"$big_url&off=$noff\">";
248 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
250 echo "$backarr</td><td align=\"left\">$back";
253 echo "</td>\n<td align=\"center\">";
255 if (isset($dist) && isset($arch)) {
256 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
261 echo "</td>\n<td align=right>";
262 if ($cnt == $count) {
266 $hrefurl = "<a href=\"$big_url&off=$noff\">";
267 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
269 echo "$forward</td><td align=right width=1%>$forwardarr";
271 echo "</td>\n</tr></table></p>";
276 global $ok, $dist, $arch, $name, $name_url, $id;
278 if (isset($name) && isset($ok) && isset($arch) && isset($dist)) {
279 if (isset($id) && $id != '') {
280 $name = $name . ",$id";
282 $w = $ok ? "OK" : "FAIL";
283 return "$dist/$arch/$w/$name.bz2";
287 function dump_log($tail)
289 global $ok, $url, $dist, $arch, $name, $name_url;
290 global $root_directory, $big_url, $ns, $id, $cnt, $off;
291 global $buildlogs_server;
298 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
299 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
300 list($name, $id) = explode(',', $df);
302 if ($name != 'command') {
303 $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
304 $name = "<a href=\"$gitweb_url\">$name</a>";
306 echo "<h1>$name <small>$id</small></h1>";
308 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
310 function one_item($h, $t) {
311 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
312 "<td bgcolor=\"#cccccc\">$t</td></tr>";
315 function href($h, $c) {
316 return "<a href=\"$h\">$c</a>";
319 one_item(_("Status"), ($ok == 1 ?
320 "<font color=\"green\"><b>"._("OK")."</b></font>" :
321 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
322 one_item(_("Source URL"),
323 href("ftp://$buildlogs_server/$f",
324 "ftp://$buildlogs_server/$f"));
326 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
327 $bu = "$big_url&off=$off";
329 one_item(_("text/plain URL"),
330 href("$bu&name=$name_url&id=$id&action=text",
333 one_item(_("full text"),
334 href("$bu&name=$name_url&id=$id",
338 if (isset($dist) && isset($arch)) {
339 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
341 one_item(_("rpm -qa of builder"), _("Not available"));
343 one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
345 echo "<tr><td>Here:</td><td>" .
346 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
347 "http://" . getenv("SERVER_NAME") .
348 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
353 # what can I say beside PHP suxx? how the fuck should I create
354 # bidirectional pipe? gotta use wget
356 if (preg_match("/\.bz2$/", $f)) {
358 } elseif (preg_match("/\.gz$/", $f)) {
364 $cmd = "$filter '$root_directory/$f'";
365 $fd = popen($cmd, "r");
369 $first_cut_done = false;
374 while (($s = fgets($fd, 102400)) != false) {
379 $s = htmlspecialchars($s);
381 if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
384 $toc_elem = "error $err_count";
386 $s = "<span class=error id=error-$err_count>$s</span>";
387 } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed)/i", $s)) {
390 $toc_elem = "error $err_count";
392 $s = "<span class=error id=error-$err_count>$s</span>";
393 } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
395 $toc_elem = "make {$m['target']}";
397 $s = "<span class=line id=make-{$m['target']}>$s</span>";
398 } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
399 // rpm changelog link
400 $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
401 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
402 } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
404 $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
405 $link = "<a href=\"$url\">{$m['hash']}</a>";
406 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
407 } elseif (substr($s, 0, 2) == "+ ") {
409 $s = "<span class=verbose>$s</span>";
410 } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
412 $toc_elem = $m['section'];
414 $s = "<span class=section id={$m['section']}>$s</span>";
415 } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
418 $toc_elem = "files ".$m['name'];
420 $s = "<span class=section id=files-{$m['name']}>$s</span>";
421 } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
428 // if error/processing found truncate early but keep last 100 lines before error
429 if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
430 array_splice($out_buf, 0, $out_buf_size - 100);
432 $first_cut_done = true;
435 // if (not in tail mode) or (in tail mode but we have an error)
436 if (!$tail || $first_cut) {
445 // no errors found, no processing found but we are in tail mode
446 if ($tail && !$first_cut_done && $out_buf_size > 100) {
447 array_splice($out_buf, 0, $out_buf_size - 100);
451 $code = join('', $out_buf);
454 one_item(_("Runtime"), $time);
460 echo "<h2>"._("Toc:")."</h2>";
461 echo "<ul class=toc>";
462 foreach ($toc as $i => $section) {
463 $id = str_replace(" ", "-", $section);
464 echo "<li><a href=#{$id}>{$section}</a></li>";
465 echo "<code>{$err[$i]}</code>";
470 echo "<h2>"._("Content:")."</h2>";
480 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
483 [<a href="<?php echo "$bu&action=qa"
484 ?>"><?=_("View rpm -qa of builder")?></a>]
494 global $root_directory;
495 global $buildlogs_server;
497 header("Content-type: text/plain");
503 echo "# src : ftp://$buildlogs_server/$f\n";
505 date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
507 if (preg_match("/\.bz2$/", $f)) {
508 if (is_executable("/usr/bin/lbzcat"))
512 } elseif (preg_match("/\.gz$/", $f)) {
518 $cmd = "$filter '$root_directory/$f'";
519 $fd = popen($cmd, "r");
520 while (($s = fgets($fd, 1000)) != false) {
526 function list_archs()
528 global $addr, $url, $cnt,$ok,$ns;
533 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
535 echo "<table width=\"100%\" border=\"0\">\n";
536 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
537 foreach ($addr as $dist => $ddist) {
538 echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
539 foreach ($ddist as $arch) {
540 echo "<tr><td nowrap=\"nowrap\">".
541 "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
542 $dist/$arch</a></td><td nowrap=\"nowrap\">".
543 "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
544 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
548 echo "</table><hr />\n";
550 echo "<div align=\"center\">";
551 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
553 echo "<a href=\"$url\">main()</a><hr />\n";
554 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
555 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
556 "<small>(c) 2002-". date("Y") . " ".
557 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
562 echo "<div align=\"center\"><small>";
563 $pow = array("vim", "php", "brain", "power", "electricity",
564 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
565 "voodoo magic", "Linux", "x-files", "X", "foobar",
566 "/dev/null", "/dev/zero", "/dev/drzewo",
567 "Leppe'", "matrix", "Neo", "PDP-11",
568 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
569 "foobarbaz", "ed", "Joe", "Unix conspiracy",
570 "overclock", "The Right Thing",
571 "The Bad Thing", "Star Treck", "NSA", "NASA",
572 "achelon", "VAX", "Real Programmer",
573 "Real Operating System", "Real Computer",
574 "computron", "bogon", "quantum bogodynamics",
575 "BOFH", "/dev/ill", "nasi tu byli",
576 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
577 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
578 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003", "sqlite3",
579 "synergy", "six Cray XMT Supercomputers"
580 # feel free to add sth if you change this file ;)
582 echo _("Powered by")." ";
584 for ($i = 0; $i < $max; $i++) {
585 $x = rand(0, count($pow) - 1);
586 if ($pow[$x] == "") $i--;
587 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
590 echo "</small></div>";
592 echo "<div align=\"center\"><small>";
593 echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
594 echo "</small></div>";
596 if (isset($dist) && isset($arch)) {
597 echo "<form action=\"index.php\" method=\"post\">";
598 echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
599 echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
600 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
601 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
602 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
611 if (!isset($dist) || !isset($arch))
613 $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
614 return fopen("$addr", "r");
619 global $url, $str, $dist, $arch;
622 echo "<h1>"._("Search results for")." '$str' "._("in")." $dist/$arch</h1>";
627 echo _("Sorry, cannot open.");
629 while (($s = fgets($f, 1000)) != false) {
630 if (stristr($s, "Query done at:")) {
631 echo "rpmqa database from " . strstr($s, ":") . "\n";
635 if (stristr($s, $str))
643 function dump_qa($plain)
645 global $url, $dist, $arch;
650 header("Content-type: text/plain");
651 echo _("# rpm -qa of")." $dist/$arch\n";
653 echo "<h1>"._("rpm -qa of")." $a</h1>";
654 echo "<a href=\"$url?dist=$dist&arch=$arch&action=qatxt\">"._("text/plain version")."</a>";
659 echo _("Sorry, cannot open.");
661 while (($s = fgets($f, 1000)) != false) {
671 function adv_search()
673 global $database, $addr, $fail_or_ok, $url, $_POST, $off, $cnt, $root_directory, $ok, $ns;
675 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
677 echo "<script><!--\n".
678 "function checkboxToggle() {\n".
679 "for (var i=0;i<document.forms[0].elements.length;i++) {\n".
680 "var e = document.forms[0].elements[i];\n".
681 "if ((e.name != 'all') && (e.type=='checkbox'))\n".
682 "e.checked = document.forms[0].all.checked;\n".
683 "}\n }\n -->\n </script>\n";
685 /* Shut up warnings */
686 if (!isset($_POST["n2"])) $_POST["n2"] = "";
687 if (!isset($_POST["age1"])) $_POST["age1"] = "";
688 if (!isset($_POST["age2"])) $_POST["age2"] = "";
689 if (!isset($_POST["size1"])) $_POST["size1"] = "";
690 if (!isset($_POST["size2"])) $_POST["size2"] = "";
692 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
694 echo "<div align=\"center\">";
695 echo "<table border=\"0\">\n";
697 echo "<td>"._("Package name")."</td>\n";
698 echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
702 echo "<td>"._("Days")."</td>\n";
703 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
704 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
708 echo "<td>"._("Size")."</td>\n";
709 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
710 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
714 echo "<td>"._("Search logs:")."</td>\n";
718 echo "<td>"._("Failed")."</td>\n";
719 echo "<td>"._("OK")."</td>\n";
723 foreach ($addr as $dist => $ddist) {
724 foreach ($ddist as $arch) {
727 if (!isset($_POST["$name"])) {
730 $check=" checked='checked'";
732 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
734 if (!isset($_POST["$n2"])) {
737 $check=" checked='checked'";
739 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
746 echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
751 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
752 // isset($_POST["size1"]) || isset($_POST["size2"])
753 if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
754 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
756 $query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
757 if ($_POST["n2"] != "") {
758 $n = addslashes($_POST["n2"]);
759 $query .= "AND name LIKE '$n%' ";
763 if ($_POST["age1"] != "") {
764 $age = $now - (int)$_POST["age1"] * 24 * 3600;
765 $query .= "AND mtime > $age ";
768 if ($_POST["age2"] != "") {
769 $age = $now - (int)$_POST["age2"] * 24 * 3600;
770 $query .= "AND mtime < $age ";
773 if ($_POST["size1"] != "") {
774 $size = (int)$_POST["size1"];
775 $query .= "AND size > $size ";
778 if ($_POST["size2"] != "") {
779 $size = (int)$_POST["size2"];
780 $query .= "AND size < $size ";
785 foreach ($addr as $dist => $ddist) {
786 foreach ($ddist as $arch) {
787 for ($j = 0; $j < 2; $j++) {
788 if (isset($_POST["as" . $j . "_" .$i])) {
789 $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
796 if ($or == " OR ") $query .= ")";
797 // if (!isset($cnt)) $cnt = 50;
798 // if (!isset($off)) $off = 0;
799 if (!isset($ns)) $ns = 0;
802 $query .= " ORDER BY mtime DESC";
805 $query .= " ORDER BY name";
808 $query .= " ORDER BY dist, arch, name";
811 $query .= " LIMIT $cnt OFFSET $off ";
814 $dbh = new PDO("$database");
815 } catch (PDOException $e) {
816 mydie("new PDO: " . $e->getMessage());
818 $result = $dbh->query("$query")->fetchAll();
820 if ($result == FALSE) {
821 echo _("Nothing found");
823 echo "<table border=\"0\" cellspacing=\"1\" ".
824 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
825 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
826 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
827 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
828 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
829 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
830 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
831 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
834 // for ($i = $off; $i < $off + $count; $i++) {
835 foreach ($result as $row) {
836 $dist = $row["dist"];
837 $arch = $row["arch"];
838 $name = $row["name"];
839 $name_url = urlencode($name);
842 $t = $now - $row["mtime"];
850 $t = $t . " " . ngettext("day","days",$t);
853 $t = $t . " " . ngettext("hour","hours",$t);
857 $t = $t . " " . ngettext("minute","minutes",$t);
860 // $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
862 $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
863 $b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
865 $builder = "$dist/$arch/". $fail_or_ok[$ok];
867 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$b\">$builder</a></td>";
868 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
869 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
870 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
871 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
872 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
875 echo "</table></div>\n";
877 $backarr = "<<< ";
878 $back = _("Page back");
879 $forward = _("Page forward");
880 $forwardarr = " >>>";
885 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
891 $hrefurl = "<a href=\"$big_url&off=$noff\">";
892 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
894 echo "$backarr</td><td align=left>$back";
897 echo "</td>\n<td align=\"center\">";
898 echo "</td>\n<td align=\"right\">";
900 if ($off + $cnt < count($list))
905 $hrefurl = "<a href=\"$big_url&off=$noff\">";
906 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
910 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
913 echo "</td>\n</tr></table></p>";
917 echo _("Enter something!");
919 echo "</div></form>\n";
925 <table border="0" width="100%"><tr><td width="20%"> </td><td>
926 <h1><?=_("Welcome!")?></h1>
927 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
928 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
929 <!-- ech... niech strace... -->
930 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
931 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
932 </td><td width="20%"> </td></tr>
937 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
938 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
939 header("Cache-Control: no-cache, must-revalidate");
940 header("Pragma: no-cache");
943 if ($action == "text") {
945 } else if ($action == "adv_search") {
949 } else if ($action == "qatxt") {
953 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
955 echo "</td><td valign=\"top\">";
959 else if ($action == "sqa")
961 else if (isset($id) || isset($name))
962 dump_log($action == "tail");
963 else if (isset($dist))
967 echo "</td></tr></table>";