2 ob_start("ob_gzhandler", 1);
3 $buildlogs_server = "buildlogs.pld-linux.org";
5 $fail_or_ok = array( "FAIL", "OK" );
7 $database = 'sqlite:/home/services/ftp/buildlogs2.db';
8 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
11 // $database, $root_directory and others are taken from buildlogs.inc
12 include('buildlogs.inc');
14 /* It should be set */
16 $langs["en_US"]["charset"]="ISO-8859-1";
17 $langs["pl_PL"]["charset"]="ISO-8859-2";
20 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
22 $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
23 $rows=explode(",",$rows[0]);
24 $lang_detected=rtrim($rows[0]);
25 } else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
27 $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
31 $lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
33 if (isset($lang_detected) && isset($langs[$lang_detected]))
38 if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
39 if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
42 setlocale(LC_ALL,$lang);
43 bindtextdomain("messages","locale");
44 textdomain("messages");
46 if (isset($_GET["dist"]) && isset($_GET["arch"]))
48 $dist = basename($_GET["dist"]);
49 $arch = basename($_GET["arch"]);
52 if (isset($_POST["dist"])) $dist = basename($_POST["dist"]);
53 if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
55 if (isset($_GET["name"])) {
56 $name_url = urlencode($_GET["name"]);
57 $name = basename($_GET["name"]);
59 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
61 if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
63 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
65 if (isset($_GET["action"]))$action=$_GET["action"];
67 if (isset($_GET["off"]))$off=(int)$_GET["off"];
69 if (isset($_GET["id"]))$id=$_GET["id"];
71 if (isset($_POST["str"]))$str=$_POST["str"];
72 if (isset($_POST["action"]))$action=$_POST["action"];
79 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
80 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
82 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
83 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
84 <html xmlns="http://www.w3.org/1999/xhtml">
86 <title>PLD Build Logs</title>
87 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
88 <style type="text/css"><!--
89 A { text-decoration: none; }
90 A:hover { text-decoration: underline; }
91 H1 { font-family: arial,helvetica,sans-serif;
94 H2 { font-family: arial,helvetica,sans-serif;
97 BODY,TD { font-family: arial,helvetica,sans-serif;
99 TH { font-family: arial,helvetica,sans-serif;
102 /* error lines from build logs */
104 background-color: #b00;
111 background-color: #161;
119 <!-- Diffrent color for visited link doesn't make much sense here...
120 this page is autogenerated and it might be misleading after some
121 build log changes. -->
122 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
128 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
129 "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
134 echo "</pre></font></td></tr></table>\n";
139 echo "</body></html>";
145 echo "Fatal error: $msg";
153 global $arch, $dist, $ok;
154 global $big_url, $ns;
155 global $off, $cnt, $root_directory, $url;
157 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
160 echo "<h1>"._("Listing of")." $dist/$arch/OK "
161 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
163 echo "<h1>"._("Listing of")." $dist/$arch/FAIL "
164 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
167 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
168 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
169 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
170 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
171 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
172 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
173 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
174 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
177 if ($ns != 1) $ns = 0;
178 if (!isset($ok)) $ok = 0;
179 // if (!isset($off)) $off = 0;
180 // if (!isset($cnt)) $cnt = 50;
181 if ($ns == 0) $order = "mtime DESC";
182 else $order = "name";
184 $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE "
185 . "dist = '$dist' AND arch = '$arch' AND ok = $ok ORDER BY $order LIMIT $cnt OFFSET $off";
188 $dbh = new PDO("$database");
189 } catch (PDOException $e) {
190 mydie("new PDO: " . $e->getMessage());
194 foreach ($dbh->query("$query") as $row) {
195 $name = $row["name"];
197 $dist = $row["dist"];
198 $arch = $row["arch"];
200 $name_url = urlencode($name);
201 $t = $now - $row["mtime"];
211 $t = $t . " " . ngettext("day","days",$t);
214 $t = $t . " " . ngettext("hour","hours",$t);
218 $t = $t . " " . ngettext("minute","minutes",$t);
220 $u = "$url?dist=$dist&arch=$arch&ok=$ok&name=$name_url&id=$id";
221 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
222 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
223 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
224 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
225 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
226 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
230 echo "</table></div>\n";
232 $backarr = "<<< ";
233 $back = _("Page back");
234 $forward = _("Page forward");
235 $forwardarr = " >>>";
237 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
240 $noff = $off - $count;
243 $hrefurl = "<a href=\"$big_url&off=$noff\">";
244 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
246 echo "$backarr</td><td align=\"left\">$back";
249 echo "</td>\n<td align=\"center\">";
251 if (isset($dist) && isset($arch)) {
252 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
257 echo "</td>\n<td align=right>";
258 if ($cnt == $count) {
262 $hrefurl = "<a href=\"$big_url&off=$noff\">";
263 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
265 echo "$forward</td><td align=right width=1%>$forwardarr";
267 echo "</td>\n</tr></table></p>";
272 global $ok, $dist, $arch, $name, $name_url, $id;
274 if (isset($name) && isset($ok) && isset($arch) && isset($dist)) {
275 if (isset($id) && $id != '') {
276 $name = $name . ",$id";
278 $w = $ok ? "OK" : "FAIL";
279 return "$dist/$arch/$w/$name.bz2";
283 function dump_log($tail)
285 global $ok, $url, $dist, $arch, $name, $name_url;
286 global $root_directory, $big_url, $ns, $id, $cnt, $off;
287 global $buildlogs_server;
294 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
295 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
296 list($name, $id) = explode(',', $df);
298 if ($name != 'command') {
299 $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
300 $name = "<a href=\"$gitweb_url\">$name</a>";
302 echo "<h1>$name <small>$id</small></h1>";
304 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
306 function one_item($h, $t) {
307 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
308 "<td bgcolor=\"#cccccc\">$t</td></tr>";
311 function href($h, $c) {
312 return "<a href=\"$h\">$c</a>";
315 one_item(_("Status"), ($ok == 1 ?
316 "<font color=\"green\"><b>"._("OK")."</b></font>" :
317 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
318 one_item(_("Source URL"),
319 href("ftp://$buildlogs_server/$f",
320 "ftp://$buildlogs_server/$f"));
322 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
323 $bu = "$big_url&off=$off";
325 one_item(_("text/plain URL"),
326 href("$bu&name=$name_url&id=$id&action=text",
329 one_item(_("full text"),
330 href("$bu&name=$name_url&id=$id",
334 if (isset($dist) && isset($arch)) {
335 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
337 one_item(_("rpm -qa of builder"), _("Not available"));
339 one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
341 echo "<tr><td>Here:</td><td>" .
342 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
343 "http://" . getenv("SERVER_NAME") .
344 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
349 # what can I say beside PHP suxx? how the fuck should I create
350 # bidirectional pipe? gotta use wget
352 if (preg_match("/\.bz2$/", $f)) {
354 } elseif (preg_match("/\.gz$/", $f)) {
360 $cmd = "$filter '$root_directory/$f'";
361 $fd = popen($cmd, "r");
365 $first_cut_done = false;
369 while (($s = fgets($fd, 102400)) != false) {
374 $s = htmlspecialchars($s);
376 if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
379 $toc_elem = "error $err_count";
381 $s = "<span class=error id=error-$err_count>$s</span>";
382 } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed)/i", $s)) {
385 $toc_elem = "error $err_count";
387 $s = "<span class=error id=error-$err_count>$s</span>";
388 } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
390 $toc_elem = "make {$m['target']}";
392 $s = "<span class=line id=make-{$m['target']}>$s</span>";
393 } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
394 // rpm changelog link
395 $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
396 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
397 } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
399 $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
400 $link = "<a href=\"$url\">{$m['hash']}</a>";
401 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
402 } elseif (substr($s, 0, 2) == "+ ") {
404 $s = "<span class=verbose>$s</span>";
405 } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
407 $toc_elem = $m['section'];
409 $s = "<span class=section id={$m['section']}>$s</span>";
410 } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
413 $toc_elem = "files ".$m['name'];
415 $s = "<span class=section id=files-{$m['name']}>$s</span>";
416 } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
423 // if error/processing found truncate early but keep last 100 lines before error
424 if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
425 array_splice($out_buf, 0, $out_buf_size - 100);
427 $first_cut_done = true;
430 // if (not in tail mode) or (in tail mode but we have an error)
431 if (!$tail || $first_cut) {
440 // no errors found, no processing found but we are in tail mode
441 if ($tail && !$first_cut_done && $out_buf_size > 100) {
442 array_splice($out_buf, 0, $out_buf_size - 100);
446 $code = join('', $out_buf);
449 one_item(_("Runtime"), $time);
455 echo "<h2>"._("Toc:")."</h2>";
456 echo "<ul class=toc>";
457 foreach ($toc as $i => $section) {
458 $id = str_replace(" ", "-", $section);
459 echo "<li><a href=#{$id}>{$section}</a></li>";
460 echo "<code>{$err[$i]}</code>";
465 echo "<h2>"._("Content:")."</h2>";
475 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
478 [<a href="<?php echo "$bu&action=qa"
479 ?>"><?=_("View rpm -qa of builder")?></a>]
489 global $root_directory;
490 global $buildlogs_server;
492 header("Content-type: text/plain");
498 echo "# src : ftp://$buildlogs_server/$f\n";
500 date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
502 if (preg_match("/\.bz2$/", $f)) {
503 if (is_executable("/usr/bin/lbzcat"))
507 } elseif (preg_match("/\.gz$/", $f)) {
513 $cmd = "$filter '$root_directory/$f'";
514 $fd = popen($cmd, "r");
515 while (($s = fgets($fd, 1000)) != false) {
521 function list_archs()
523 global $addr, $url, $cnt,$ok,$ns;
528 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
530 echo "<table width=\"100%\" border=\"0\">\n";
531 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
532 foreach ($addr as $dist => $ddist) {
533 echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
534 foreach ($ddist as $arch) {
535 echo "<tr><td nowrap=\"nowrap\">".
536 "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
537 $dist/$arch</a></td><td nowrap=\"nowrap\">".
538 "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
539 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
543 echo "</table><hr />\n";
545 echo "<div align=\"center\">";
546 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
548 echo "<a href=\"$url\">main()</a><hr />\n";
549 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
550 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
551 "<small>(c) 2002-". date("Y") . " ".
552 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
557 echo "<div align=\"center\"><small>";
558 $pow = array("vim", "php", "brain", "power", "electricity",
559 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
560 "voodoo magic", "Linux", "x-files", "X", "foobar",
561 "/dev/null", "/dev/zero", "/dev/drzewo",
562 "Leppe'", "matrix", "Neo", "PDP-11",
563 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
564 "foobarbaz", "ed", "Joe", "Unix conspiracy",
565 "overclock", "The Right Thing",
566 "The Bad Thing", "Star Treck", "NSA", "NASA",
567 "achelon", "VAX", "Real Programmer",
568 "Real Operating System", "Real Computer",
569 "computron", "bogon", "quantum bogodynamics",
570 "BOFH", "/dev/ill", "nasi tu byli",
571 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
572 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
573 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003", "sqlite3",
574 "synergy", "six Cray XMT Supercomputers"
575 # feel free to add sth if you change this file ;)
577 echo _("Powered by")." ";
579 for ($i = 0; $i < $max; $i++) {
580 $x = rand(0, count($pow) - 1);
581 if ($pow[$x] == "") $i--;
582 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
585 echo "</small></div>";
587 echo "<div align=\"center\"><small>";
588 echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
589 echo "</small></div>";
591 if (isset($dist) && isset($arch)) {
592 echo "<form action=\"index.php\" method=\"post\">";
593 echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
594 echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
595 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
596 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
597 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
606 if (!isset($dist) || !isset($arch))
608 $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
609 return fopen("$addr", "r");
614 global $url, $str, $dist, $arch;
617 echo "<h1>"._("Search results for")." '$str' "._("in")." $dist/$arch</h1>";
622 echo _("Sorry, cannot open.");
624 while (($s = fgets($f, 1000)) != false) {
625 if (stristr($s, "Query done at:")) {
626 echo "rpmqa database from " . strstr($s, ":") . "\n";
630 if (stristr($s, $str))
638 function dump_qa($plain)
640 global $url, $dist, $arch;
645 header("Content-type: text/plain");
646 echo _("# rpm -qa of")." $dist/$arch\n";
648 echo "<h1>"._("rpm -qa of")." $a</h1>";
649 echo "<a href=\"$url?dist=$dist&arch=$arch&action=qatxt\">"._("text/plain version")."</a>";
654 echo _("Sorry, cannot open.");
656 while (($s = fgets($f, 1000)) != false) {
666 function adv_search()
668 global $database, $addr, $fail_or_ok, $url, $_POST, $off, $cnt, $root_directory, $ok, $ns;
670 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
672 echo "<script><!--\n".
673 "function checkboxToggle() {\n".
674 "for (var i=0;i<document.forms[0].elements.length;i++) {\n".
675 "var e = document.forms[0].elements[i];\n".
676 "if ((e.name != 'all') && (e.type=='checkbox'))\n".
677 "e.checked = document.forms[0].all.checked;\n".
678 "}\n }\n -->\n </script>\n";
680 /* Shut up warnings */
681 if (!isset($_POST["n2"])) $_POST["n2"] = "";
682 if (!isset($_POST["age1"])) $_POST["age1"] = "";
683 if (!isset($_POST["age2"])) $_POST["age2"] = "";
684 if (!isset($_POST["size1"])) $_POST["size1"] = "";
685 if (!isset($_POST["size2"])) $_POST["size2"] = "";
687 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
689 echo "<div align=\"center\">";
690 echo "<table border=\"0\">\n";
692 echo "<td>"._("Package name")."</td>\n";
693 echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
697 echo "<td>"._("Days")."</td>\n";
698 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
699 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
703 echo "<td>"._("Size")."</td>\n";
704 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
705 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
709 echo "<td>"._("Search logs:")."</td>\n";
713 echo "<td>"._("Failed")."</td>\n";
714 echo "<td>"._("OK")."</td>\n";
718 foreach ($addr as $dist => $ddist) {
719 foreach ($ddist as $arch) {
722 if (!isset($_POST["$name"])) {
725 $check=" checked='checked'";
727 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
729 if (!isset($_POST["$n2"])) {
732 $check=" checked='checked'";
734 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
741 echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
746 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
747 // isset($_POST["size1"]) || isset($_POST["size2"])
748 if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
749 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
751 $query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
752 if ($_POST["n2"] != "") {
753 $n = addslashes($_POST["n2"]);
754 $query .= "AND name LIKE '$n%' ";
758 if ($_POST["age1"] != "") {
759 $age = $now - (int)$_POST["age1"] * 24 * 3600;
760 $query .= "AND mtime > $age ";
763 if ($_POST["age2"] != "") {
764 $age = $now - (int)$_POST["age2"] * 24 * 3600;
765 $query .= "AND mtime < $age ";
768 if ($_POST["size1"] != "") {
769 $size = (int)$_POST["size1"];
770 $query .= "AND size > $size ";
773 if ($_POST["size2"] != "") {
774 $size = (int)$_POST["size2"];
775 $query .= "AND size < $size ";
780 foreach ($addr as $dist => $ddist) {
781 foreach ($ddist as $arch) {
782 for ($j = 0; $j < 2; $j++) {
783 if (isset($_POST["as" . $j . "_" .$i])) {
784 $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
791 if ($or == " OR ") $query .= ")";
792 // if (!isset($cnt)) $cnt = 50;
793 // if (!isset($off)) $off = 0;
794 if (!isset($ns)) $ns = 0;
797 $query .= " ORDER BY mtime DESC";
800 $query .= " ORDER BY name";
803 $query .= " ORDER BY dist, arch, name";
806 $query .= " LIMIT $cnt OFFSET $off ";
809 $dbh = new PDO("$database");
810 } catch (PDOException $e) {
811 mydie("new PDO: " . $e->getMessage());
813 $result = $dbh->query("$query")->fetchAll();
815 if ($result == FALSE) {
816 echo _("Nothing found");
818 echo "<table border=\"0\" cellspacing=\"1\" ".
819 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
820 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
821 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
822 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
823 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
824 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
825 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
826 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
829 // for ($i = $off; $i < $off + $count; $i++) {
830 foreach ($result as $row) {
831 $dist = $row["dist"];
832 $arch = $row["arch"];
833 $name = $row["name"];
834 $name_url = urlencode($name);
837 $t = $now - $row["mtime"];
845 $t = $t . " " . ngettext("day","days",$t);
848 $t = $t . " " . ngettext("hour","hours",$t);
852 $t = $t . " " . ngettext("minute","minutes",$t);
855 // $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
857 $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
858 $b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
860 $builder = "$dist/$arch/". $fail_or_ok[$ok];
862 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$b\">$builder</a></td>";
863 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
864 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
865 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
866 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
867 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
870 echo "</table></div>\n";
872 $backarr = "<<< ";
873 $back = _("Page back");
874 $forward = _("Page forward");
875 $forwardarr = " >>>";
880 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
886 $hrefurl = "<a href=\"$big_url&off=$noff\">";
887 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
889 echo "$backarr</td><td align=left>$back";
892 echo "</td>\n<td align=\"center\">";
893 echo "</td>\n<td align=\"right\">";
895 if ($off + $cnt < count($list))
900 $hrefurl = "<a href=\"$big_url&off=$noff\">";
901 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
905 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
908 echo "</td>\n</tr></table></p>";
912 echo _("Enter something!");
914 echo "</div></form>\n";
920 <table border="0" width="100%"><tr><td width="20%"> </td><td>
921 <h1><?=_("Welcome!")?></h1>
922 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
923 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
924 <!-- ech... niech strace... -->
925 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
926 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
927 <p>Version: $Id: index.php,v 1.37 2014/10/20 12:59:06 glen Exp $</p>
928 </td><td width="20%"> </td></tr>
933 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
934 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
935 header("Cache-Control: no-cache, must-revalidate");
936 header("Pragma: no-cache");
939 if ($action == "text") {
941 } else if ($action == "adv_search") {
945 } else if ($action == "qatxt") {
949 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
951 echo "</td><td valign=\"top\">";
955 else if ($action == "sqa")
957 else if (isset($id) || isset($name))
958 dump_log($action == "tail");
959 else if (isset($dist))
963 echo "</td></tr></table>";