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 get_filter($f)
289 if (preg_match("/\.bz2$/", $f)) {
290 if (is_executable("/usr/bin/lbzcat"))
294 } elseif (preg_match("/\.gz$/", $f)) {
302 function dump_log($tail)
304 global $ok, $url, $dist, $arch, $name, $name_url;
305 global $root_directory, $big_url, $ns, $id, $cnt, $off;
306 global $buildlogs_server;
313 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
314 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
315 list($name, $id) = explode(',', $df);
317 if ($name != 'command') {
318 $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
319 $name = "<a href=\"$gitweb_url\">$name</a>";
321 echo "<h1>$name <small>$id</small></h1>";
323 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
325 function one_item($h, $t) {
326 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
327 "<td bgcolor=\"#cccccc\">$t</td></tr>";
330 function href($h, $c) {
331 return "<a href=\"$h\">$c</a>";
334 one_item(_("Status"), ($ok == 1 ?
335 "<font color=\"green\"><b>"._("OK")."</b></font>" :
336 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
337 one_item(_("Source URL"),
338 href("ftp://$buildlogs_server/$f",
339 "ftp://$buildlogs_server/$f"));
341 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
342 $bu = "$big_url&off=$off";
344 one_item(_("text/plain URL"),
345 href("$bu&name=$name_url&id=$id&action=text",
348 one_item(_("full text"),
349 href("$bu&name=$name_url&id=$id",
353 if (isset($dist) && isset($arch)) {
354 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
356 one_item(_("rpm -qa of builder"), _("Not available"));
358 one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
360 echo "<tr><td>Here:</td><td>" .
361 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
362 "http://" . getenv("SERVER_NAME") .
363 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
368 # what can I say beside PHP suxx? how the fuck should I create
369 # bidirectional pipe? gotta use wget
371 $filter = get_filter($f);
373 $cmd = "$filter '$root_directory/$f'";
374 $fd = popen($cmd, "r");
378 $first_cut_done = false;
383 while (($s = fgets($fd, 102400)) != false) {
388 $s = htmlspecialchars($s);
390 if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
393 $toc_elem = "error $err_count";
395 $s = "<span class=error id=error-$err_count>$s</span>";
396 } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed)/i", $s)) {
399 $toc_elem = "error $err_count";
401 $s = "<span class=error id=error-$err_count>$s</span>";
402 } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
404 $toc_elem = "make {$m['target']}";
406 $s = "<span class=line id=make-{$m['target']}>$s</span>";
407 } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
408 // rpm changelog link
409 $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
410 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
411 } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
413 $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
414 $link = "<a href=\"$url\">{$m['hash']}</a>";
415 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
416 } elseif (substr($s, 0, 2) == "+ ") {
418 $s = "<span class=verbose>$s</span>";
419 } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
421 $toc_elem = $m['section'];
423 $s = "<span class=section id={$m['section']}>$s</span>";
424 } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
427 $toc_elem = "files ".$m['name'];
429 $s = "<span class=section id=files-{$m['name']}>$s</span>";
430 } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
437 // if error/processing found truncate early but keep last 100 lines before error
438 if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
439 array_splice($out_buf, 0, $out_buf_size - 100);
441 $first_cut_done = true;
444 // if (not in tail mode) or (in tail mode but we have an error)
445 if (!$tail || $first_cut) {
454 // no errors found, no processing found but we are in tail mode
455 if ($tail && !$first_cut_done && $out_buf_size > 100) {
456 array_splice($out_buf, 0, $out_buf_size - 100);
460 $code = join('', $out_buf);
463 one_item(_("Runtime"), $time);
469 echo "<h2>"._("Toc:")."</h2>";
470 echo "<ul class=toc>";
471 foreach ($toc as $i => $section) {
472 $id = str_replace(" ", "-", $section);
473 echo "<li><a href=#{$id}>{$section}</a></li>";
474 echo "<code>{$err[$i]}</code>";
479 echo "<h2>"._("Content:")."</h2>";
489 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
492 [<a href="<?php echo "$bu&action=qa"
493 ?>"><?=_("View rpm -qa of builder")?></a>]
503 global $root_directory;
504 global $buildlogs_server;
506 header("Content-type: text/plain");
512 echo "# src : ftp://$buildlogs_server/$f\n";
514 date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
516 $filter = get_filter($f);
518 $cmd = "$filter '$root_directory/$f'";
519 $fd = popen($cmd, "r");
524 function list_archs()
526 global $addr, $url, $cnt,$ok,$ns;
531 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
533 echo "<table width=\"100%\" border=\"0\">\n";
534 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
535 foreach ($addr as $dist => $ddist) {
536 echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
537 foreach ($ddist as $arch) {
538 echo "<tr><td nowrap=\"nowrap\">".
539 "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
540 $dist/$arch</a></td><td nowrap=\"nowrap\">".
541 "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
542 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
546 echo "</table><hr />\n";
548 echo "<div align=\"center\">";
549 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
551 echo "<a href=\"$url\">main()</a><hr />\n";
552 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
553 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
554 "<small>(c) 2002-". date("Y") . " ".
555 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
560 echo "<div align=\"center\"><small>";
561 $pow = array("vim", "php", "brain", "power", "electricity",
562 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
563 "voodoo magic", "Linux", "x-files", "X", "foobar",
564 "/dev/null", "/dev/zero", "/dev/drzewo",
565 "Leppe'", "matrix", "Neo", "PDP-11",
566 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
567 "foobarbaz", "ed", "Joe", "Unix conspiracy",
568 "overclock", "The Right Thing",
569 "The Bad Thing", "Star Treck", "NSA", "NASA",
570 "achelon", "VAX", "Real Programmer",
571 "Real Operating System", "Real Computer",
572 "computron", "bogon", "quantum bogodynamics",
573 "BOFH", "/dev/ill", "nasi tu byli",
574 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
575 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
576 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003", "sqlite3",
577 "synergy", "six Cray XMT Supercomputers"
578 # feel free to add sth if you change this file ;)
580 echo _("Powered by")." ";
582 for ($i = 0; $i < $max; $i++) {
583 $x = rand(0, count($pow) - 1);
584 if ($pow[$x] == "") $i--;
585 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
588 echo "</small></div>";
590 echo "<div align=\"center\"><small>";
591 echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
592 echo "</small></div>";
594 if (isset($dist) && isset($arch)) {
595 echo "<form action=\"index.php\" method=\"post\">";
596 echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
597 echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
598 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
599 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
600 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
609 if (!isset($dist) || !isset($arch))
611 $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
612 return fopen("$addr", "r");
617 global $url, $str, $dist, $arch;
620 echo "<h1>"._("Search results for")." '$str' "._("in")." $dist/$arch</h1>";
625 echo _("Sorry, cannot open.");
627 while (($s = fgets($f, 1000)) != false) {
628 if (stristr($s, "Query done at:")) {
629 echo "rpmqa database from " . strstr($s, ":") . "\n";
633 if (stristr($s, $str))
641 function dump_qa($plain)
643 global $url, $dist, $arch;
648 header("Content-type: text/plain");
649 echo _("# rpm -qa of")." $dist/$arch\n";
651 echo "<h1>"._("rpm -qa of")." $a</h1>";
652 echo "<a href=\"$url?dist=$dist&arch=$arch&action=qatxt\">"._("text/plain version")."</a>";
657 echo _("Sorry, cannot open.");
659 while (($s = fgets($f, 1000)) != false) {
669 function adv_search()
671 global $database, $addr, $fail_or_ok, $url, $_POST, $off, $cnt, $root_directory, $ok, $ns;
673 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
675 echo "<script><!--\n".
676 "function checkboxToggle() {\n".
677 "for (var i=0;i<document.forms[0].elements.length;i++) {\n".
678 "var e = document.forms[0].elements[i];\n".
679 "if ((e.name != 'all') && (e.type=='checkbox'))\n".
680 "e.checked = document.forms[0].all.checked;\n".
681 "}\n }\n -->\n </script>\n";
683 /* Shut up warnings */
684 if (!isset($_POST["n2"])) $_POST["n2"] = "";
685 if (!isset($_POST["age1"])) $_POST["age1"] = "";
686 if (!isset($_POST["age2"])) $_POST["age2"] = "";
687 if (!isset($_POST["size1"])) $_POST["size1"] = "";
688 if (!isset($_POST["size2"])) $_POST["size2"] = "";
690 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
692 echo "<div align=\"center\">";
693 echo "<table border=\"0\">\n";
695 echo "<td>"._("Package name")."</td>\n";
696 echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
700 echo "<td>"._("Days")."</td>\n";
701 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
702 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
706 echo "<td>"._("Size")."</td>\n";
707 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
708 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
712 echo "<td>"._("Search logs:")."</td>\n";
716 echo "<td>"._("Failed")."</td>\n";
717 echo "<td>"._("OK")."</td>\n";
721 foreach ($addr as $dist => $ddist) {
722 foreach ($ddist as $arch) {
725 if (!isset($_POST["$name"])) {
728 $check=" checked='checked'";
730 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
732 if (!isset($_POST["$n2"])) {
735 $check=" checked='checked'";
737 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
744 echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
749 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
750 // isset($_POST["size1"]) || isset($_POST["size2"])
751 if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
752 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
754 $query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
755 if ($_POST["n2"] != "") {
756 $n = addslashes($_POST["n2"]);
757 $query .= "AND name LIKE '$n%' ";
761 if ($_POST["age1"] != "") {
762 $age = $now - (int)$_POST["age1"] * 24 * 3600;
763 $query .= "AND mtime > $age ";
766 if ($_POST["age2"] != "") {
767 $age = $now - (int)$_POST["age2"] * 24 * 3600;
768 $query .= "AND mtime < $age ";
771 if ($_POST["size1"] != "") {
772 $size = (int)$_POST["size1"];
773 $query .= "AND size > $size ";
776 if ($_POST["size2"] != "") {
777 $size = (int)$_POST["size2"];
778 $query .= "AND size < $size ";
783 foreach ($addr as $dist => $ddist) {
784 foreach ($ddist as $arch) {
785 for ($j = 0; $j < 2; $j++) {
786 if (isset($_POST["as" . $j . "_" .$i])) {
787 $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
794 if ($or == " OR ") $query .= ")";
795 // if (!isset($cnt)) $cnt = 50;
796 // if (!isset($off)) $off = 0;
797 if (!isset($ns)) $ns = 0;
800 $query .= " ORDER BY mtime DESC";
803 $query .= " ORDER BY name";
806 $query .= " ORDER BY dist, arch, name";
809 $query .= " LIMIT $cnt OFFSET $off ";
812 $dbh = new PDO("$database");
813 } catch (PDOException $e) {
814 mydie("new PDO: " . $e->getMessage());
816 $result = $dbh->query("$query")->fetchAll();
818 if ($result == FALSE) {
819 echo _("Nothing found");
821 echo "<table border=\"0\" cellspacing=\"1\" ".
822 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
823 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
824 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
825 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
826 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
827 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
828 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
829 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
832 // for ($i = $off; $i < $off + $count; $i++) {
833 foreach ($result as $row) {
834 $dist = $row["dist"];
835 $arch = $row["arch"];
836 $name = $row["name"];
837 $name_url = urlencode($name);
840 $t = $now - $row["mtime"];
848 $t = $t . " " . ngettext("day","days",$t);
851 $t = $t . " " . ngettext("hour","hours",$t);
855 $t = $t . " " . ngettext("minute","minutes",$t);
858 // $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
860 $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
861 $b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
863 $builder = "$dist/$arch/". $fail_or_ok[$ok];
865 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$b\">$builder</a></td>";
866 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
867 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
868 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
869 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
870 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
873 echo "</table></div>\n";
875 $backarr = "<<< ";
876 $back = _("Page back");
877 $forward = _("Page forward");
878 $forwardarr = " >>>";
883 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
889 $hrefurl = "<a href=\"$big_url&off=$noff\">";
890 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
892 echo "$backarr</td><td align=left>$back";
895 echo "</td>\n<td align=\"center\">";
896 echo "</td>\n<td align=\"right\">";
898 if ($off + $cnt < count($list))
903 $hrefurl = "<a href=\"$big_url&off=$noff\">";
904 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
908 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
911 echo "</td>\n</tr></table></p>";
915 echo _("Enter something!");
917 echo "</div></form>\n";
923 <table border="0" width="100%"><tr><td width="20%"> </td><td>
924 <h1><?=_("Welcome!")?></h1>
925 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
926 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
927 <!-- ech... niech strace... -->
928 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
929 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a>.</p>
930 </td><td width="20%"> </td></tr>
935 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
936 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
937 header("Cache-Control: no-cache, must-revalidate");
938 header("Pragma: no-cache");
941 if ($action == "text") {
943 } else if ($action == "adv_search") {
947 } else if ($action == "qatxt") {
951 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
953 echo "</td><td valign=\"top\">";
957 else if ($action == "sqa")
959 else if (isset($id) || isset($name))
960 dump_log($action == "tail");
961 else if (isset($dist))
965 echo "</td></tr></table>";