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");
52 if (isset($_GET["dist"]) && isset($_GET["arch"]))
54 $dist = basename($_GET["dist"]);
55 $arch = basename($_GET["arch"]);
58 if (isset($_POST["dist"])) $dist = basename($_POST["dist"]);
59 if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
61 if (isset($_GET["name"])) {
62 $name_url = urlencode($_GET["name"]);
63 $name = basename($_GET["name"]);
65 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
67 if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
69 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
71 if (isset($_GET["action"]))$action=$_GET["action"];
73 if (isset($_GET["off"]))$off=(int)$_GET["off"];
75 if (isset($_GET["id"]))$id=$_GET["id"];
77 if (isset($_POST["str"]))$str=$_POST["str"];
78 if (isset($_POST["action"]))$action=$_POST["action"];
85 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
86 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
88 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
89 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
90 <html xmlns="http://www.w3.org/1999/xhtml">
92 <title>PLD Build Logs</title>
93 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
94 <style type="text/css"><!--
95 A { text-decoration: none; }
96 A:hover { text-decoration: underline; }
97 H1 { font-family: arial,helvetica,sans-serif;
100 H2 { font-family: arial,helvetica,sans-serif;
103 BODY,TD { font-family: arial,helvetica,sans-serif;
105 TH { font-family: arial,helvetica,sans-serif;
108 /* error lines from build logs */
110 background-color: #b00;
117 background-color: #161;
125 <!-- Diffrent color for visited link doesn't make much sense here...
126 this page is autogenerated and it might be misleading after some
127 build log changes. -->
128 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
134 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
135 "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
140 echo "</pre></font></td></tr></table>\n";
145 echo "</body></html>";
151 echo "Fatal error: $msg";
159 global $arch, $dist, $ok;
160 global $big_url, $ns;
161 global $off, $cnt, $root_directory, $url;
163 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
166 echo "<h1>"._("Listing of")." $dist/$arch/OK "
167 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
169 echo "<h1>"._("Listing of")." $dist/$arch/FAIL "
170 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
173 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
174 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
175 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
176 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
177 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
178 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
179 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
180 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
183 if ($ns != 1) $ns = 0;
184 if (!isset($ok)) $ok = 0;
185 // if (!isset($off)) $off = 0;
186 // if (!isset($cnt)) $cnt = 50;
187 if ($ns == 0) $order = "mtime DESC";
188 else $order = "name";
190 $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE "
191 . "dist = '$dist' AND arch = '$arch' AND ok = $ok ORDER BY $order LIMIT $cnt OFFSET $off";
194 $dbh = new PDO("$database");
195 } catch (PDOException $e) {
196 mydie("new PDO: " . $e->getMessage());
200 foreach ($dbh->query("$query") as $row) {
201 $name = $row["name"];
203 $dist = $row["dist"];
204 $arch = $row["arch"];
206 $name_url = urlencode($name);
207 $t = $now - $row["mtime"];
217 $t = $t . " " . ngettext("day","days",$t);
220 $t = $t . " " . ngettext("hour","hours",$t);
224 $t = $t . " " . ngettext("minute","minutes",$t);
226 $u = "$url?dist=$dist&arch=$arch&ok=$ok&name=$name_url&id=$id";
227 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
228 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
229 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
230 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
231 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
232 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
236 echo "</table></div>\n";
238 $backarr = "<<< ";
239 $back = _("Page back");
240 $forward = _("Page forward");
241 $forwardarr = " >>>";
243 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
246 $noff = $off - $count;
249 $hrefurl = "<a href=\"$big_url&off=$noff\">";
250 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
252 echo "$backarr</td><td align=\"left\">$back";
255 echo "</td>\n<td align=\"center\">";
257 if (isset($dist) && isset($arch)) {
258 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
263 echo "</td>\n<td align=right>";
264 if ($cnt == $count) {
268 $hrefurl = "<a href=\"$big_url&off=$noff\">";
269 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
271 echo "$forward</td><td align=right width=1%>$forwardarr";
273 echo "</td>\n</tr></table></p>";
278 global $ok, $dist, $arch, $name, $name_url, $id;
280 if (isset($name) && isset($ok) && isset($arch) && isset($dist)) {
281 if (isset($id) && $id != '') {
282 $name = $name . ",$id";
284 $w = $ok ? "OK" : "FAIL";
285 return "$dist/$arch/$w/$name.bz2";
289 function dump_log($tail)
291 global $ok, $url, $dist, $arch, $name, $name_url;
292 global $root_directory, $big_url, $ns, $id, $cnt, $off;
293 global $buildlogs_server;
300 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
301 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
302 list($name, $id) = explode(',', $df);
304 if ($name != 'command') {
305 $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
306 $name = "<a href=\"$gitweb_url\">$name</a>";
308 echo "<h1>$name <small>$id</small></h1>";
310 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
312 function one_item($h, $t) {
313 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
314 "<td bgcolor=\"#cccccc\">$t</td></tr>";
317 function href($h, $c) {
318 return "<a href=\"$h\">$c</a>";
321 one_item(_("Status"), ($ok == 1 ?
322 "<font color=\"green\"><b>"._("OK")."</b></font>" :
323 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
324 one_item(_("Source URL"),
325 href("ftp://$buildlogs_server/$f",
326 "ftp://$buildlogs_server/$f"));
328 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
329 $bu = "$big_url&off=$off";
331 one_item(_("text/plain URL"),
332 href("$bu&name=$name_url&id=$id&action=text",
335 one_item(_("full text"),
336 href("$bu&name=$name_url&id=$id",
340 if (isset($dist) && isset($arch)) {
341 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
343 one_item(_("rpm -qa of builder"), _("Not available"));
345 one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
347 echo "<tr><td>Here:</td><td>" .
348 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
349 "http://" . getenv("SERVER_NAME") .
350 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
355 # what can I say beside PHP suxx? how the fuck should I create
356 # bidirectional pipe? gotta use wget
358 if (preg_match("/\.bz2$/", $f)) {
360 } elseif (preg_match("/\.gz$/", $f)) {
366 $cmd = "$filter '$root_directory/$f'";
367 $fd = popen($cmd, "r");
371 $first_cut_done = false;
376 while (($s = fgets($fd, 102400)) != false) {
381 $s = htmlspecialchars($s);
383 if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
386 $toc_elem = "error $err_count";
388 $s = "<span class=error id=error-$err_count>$s</span>";
389 } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed)/i", $s)) {
392 $toc_elem = "error $err_count";
394 $s = "<span class=error id=error-$err_count>$s</span>";
395 } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
397 $toc_elem = "make {$m['target']}";
399 $s = "<span class=line id=make-{$m['target']}>$s</span>";
400 } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
401 // rpm changelog link
402 $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
403 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
404 } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
406 $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
407 $link = "<a href=\"$url\">{$m['hash']}</a>";
408 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
409 } elseif (substr($s, 0, 2) == "+ ") {
411 $s = "<span class=verbose>$s</span>";
412 } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
414 $toc_elem = $m['section'];
416 $s = "<span class=section id={$m['section']}>$s</span>";
417 } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
420 $toc_elem = "files ".$m['name'];
422 $s = "<span class=section id=files-{$m['name']}>$s</span>";
423 } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
430 // if error/processing found truncate early but keep last 100 lines before error
431 if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
432 array_splice($out_buf, 0, $out_buf_size - 100);
434 $first_cut_done = true;
437 // if (not in tail mode) or (in tail mode but we have an error)
438 if (!$tail || $first_cut) {
447 // no errors found, no processing found but we are in tail mode
448 if ($tail && !$first_cut_done && $out_buf_size > 100) {
449 array_splice($out_buf, 0, $out_buf_size - 100);
453 $code = join('', $out_buf);
456 one_item(_("Runtime"), $time);
462 echo "<h2>"._("Toc:")."</h2>";
463 echo "<ul class=toc>";
464 foreach ($toc as $i => $section) {
465 $id = str_replace(" ", "-", $section);
466 echo "<li><a href=#{$id}>{$section}</a></li>";
467 echo "<code>{$err[$i]}</code>";
472 echo "<h2>"._("Content:")."</h2>";
482 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
485 [<a href="<?php echo "$bu&action=qa"
486 ?>"><?=_("View rpm -qa of builder")?></a>]
496 global $root_directory;
497 global $buildlogs_server;
499 header("Content-type: text/plain");
505 echo "# src : ftp://$buildlogs_server/$f\n";
507 date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
509 if (preg_match("/\.bz2$/", $f)) {
510 if (is_executable("/usr/bin/lbzcat"))
514 } elseif (preg_match("/\.gz$/", $f)) {
520 $cmd = "$filter '$root_directory/$f'";
521 $fd = popen($cmd, "r");
522 while (($s = fgets($fd, 1000)) != false) {
528 function list_archs()
530 global $addr, $url, $cnt,$ok,$ns;
535 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
537 echo "<table width=\"100%\" border=\"0\">\n";
538 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
539 foreach ($addr as $dist => $ddist) {
540 echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
541 foreach ($ddist as $arch) {
542 echo "<tr><td nowrap=\"nowrap\">".
543 "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
544 $dist/$arch</a></td><td nowrap=\"nowrap\">".
545 "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
546 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
550 echo "</table><hr />\n";
552 echo "<div align=\"center\">";
553 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
555 echo "<a href=\"$url\">main()</a><hr />\n";
556 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
557 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
558 "<small>(c) 2002-". date("Y") . " ".
559 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
564 echo "<div align=\"center\"><small>";
565 $pow = array("vim", "php", "brain", "power", "electricity",
566 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
567 "voodoo magic", "Linux", "x-files", "X", "foobar",
568 "/dev/null", "/dev/zero", "/dev/drzewo",
569 "Leppe'", "matrix", "Neo", "PDP-11",
570 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
571 "foobarbaz", "ed", "Joe", "Unix conspiracy",
572 "overclock", "The Right Thing",
573 "The Bad Thing", "Star Treck", "NSA", "NASA",
574 "achelon", "VAX", "Real Programmer",
575 "Real Operating System", "Real Computer",
576 "computron", "bogon", "quantum bogodynamics",
577 "BOFH", "/dev/ill", "nasi tu byli",
578 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
579 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
580 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003", "sqlite3",
581 "synergy", "six Cray XMT Supercomputers"
582 # feel free to add sth if you change this file ;)
584 echo _("Powered by")." ";
586 for ($i = 0; $i < $max; $i++) {
587 $x = rand(0, count($pow) - 1);
588 if ($pow[$x] == "") $i--;
589 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
592 echo "</small></div>";
594 echo "<div align=\"center\"><small>";
595 echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
596 echo "</small></div>";
598 if (isset($dist) && isset($arch)) {
599 echo "<form action=\"index.php\" method=\"post\">";
600 echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
601 echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
602 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
603 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
604 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
613 if (!isset($dist) || !isset($arch))
615 $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
616 return fopen("$addr", "r");
621 global $url, $str, $dist, $arch;
624 echo "<h1>"._("Search results for")." '$str' "._("in")." $dist/$arch</h1>";
629 echo _("Sorry, cannot open.");
631 while (($s = fgets($f, 1000)) != false) {
632 if (stristr($s, "Query done at:")) {
633 echo "rpmqa database from " . strstr($s, ":") . "\n";
637 if (stristr($s, $str))
645 function dump_qa($plain)
647 global $url, $dist, $arch;
652 header("Content-type: text/plain");
653 echo _("# rpm -qa of")." $dist/$arch\n";
655 echo "<h1>"._("rpm -qa of")." $a</h1>";
656 echo "<a href=\"$url?dist=$dist&arch=$arch&action=qatxt\">"._("text/plain version")."</a>";
661 echo _("Sorry, cannot open.");
663 while (($s = fgets($f, 1000)) != false) {
673 function adv_search()
675 global $database, $addr, $fail_or_ok, $url, $_POST, $off, $cnt, $root_directory, $ok, $ns;
677 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
679 echo "<script><!--\n".
680 "function checkboxToggle() {\n".
681 "for (var i=0;i<document.forms[0].elements.length;i++) {\n".
682 "var e = document.forms[0].elements[i];\n".
683 "if ((e.name != 'all') && (e.type=='checkbox'))\n".
684 "e.checked = document.forms[0].all.checked;\n".
685 "}\n }\n -->\n </script>\n";
687 /* Shut up warnings */
688 if (!isset($_POST["n2"])) $_POST["n2"] = "";
689 if (!isset($_POST["age1"])) $_POST["age1"] = "";
690 if (!isset($_POST["age2"])) $_POST["age2"] = "";
691 if (!isset($_POST["size1"])) $_POST["size1"] = "";
692 if (!isset($_POST["size2"])) $_POST["size2"] = "";
694 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
696 echo "<div align=\"center\">";
697 echo "<table border=\"0\">\n";
699 echo "<td>"._("Package name")."</td>\n";
700 echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
704 echo "<td>"._("Days")."</td>\n";
705 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
706 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
710 echo "<td>"._("Size")."</td>\n";
711 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
712 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
716 echo "<td>"._("Search logs:")."</td>\n";
720 echo "<td>"._("Failed")."</td>\n";
721 echo "<td>"._("OK")."</td>\n";
725 foreach ($addr as $dist => $ddist) {
726 foreach ($ddist as $arch) {
729 if (!isset($_POST["$name"])) {
732 $check=" checked='checked'";
734 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
736 if (!isset($_POST["$n2"])) {
739 $check=" checked='checked'";
741 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
748 echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
753 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
754 // isset($_POST["size1"]) || isset($_POST["size2"])
755 if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
756 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
758 $query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
759 if ($_POST["n2"] != "") {
760 $n = addslashes($_POST["n2"]);
761 $query .= "AND name LIKE '$n%' ";
765 if ($_POST["age1"] != "") {
766 $age = $now - (int)$_POST["age1"] * 24 * 3600;
767 $query .= "AND mtime > $age ";
770 if ($_POST["age2"] != "") {
771 $age = $now - (int)$_POST["age2"] * 24 * 3600;
772 $query .= "AND mtime < $age ";
775 if ($_POST["size1"] != "") {
776 $size = (int)$_POST["size1"];
777 $query .= "AND size > $size ";
780 if ($_POST["size2"] != "") {
781 $size = (int)$_POST["size2"];
782 $query .= "AND size < $size ";
787 foreach ($addr as $dist => $ddist) {
788 foreach ($ddist as $arch) {
789 for ($j = 0; $j < 2; $j++) {
790 if (isset($_POST["as" . $j . "_" .$i])) {
791 $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
798 if ($or == " OR ") $query .= ")";
799 // if (!isset($cnt)) $cnt = 50;
800 // if (!isset($off)) $off = 0;
801 if (!isset($ns)) $ns = 0;
804 $query .= " ORDER BY mtime DESC";
807 $query .= " ORDER BY name";
810 $query .= " ORDER BY dist, arch, name";
813 $query .= " LIMIT $cnt OFFSET $off ";
816 $dbh = new PDO("$database");
817 } catch (PDOException $e) {
818 mydie("new PDO: " . $e->getMessage());
820 $result = $dbh->query("$query")->fetchAll();
822 if ($result == FALSE) {
823 echo _("Nothing found");
825 echo "<table border=\"0\" cellspacing=\"1\" ".
826 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
827 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
828 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
829 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
830 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
831 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
832 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
833 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
836 // for ($i = $off; $i < $off + $count; $i++) {
837 foreach ($result as $row) {
838 $dist = $row["dist"];
839 $arch = $row["arch"];
840 $name = $row["name"];
841 $name_url = urlencode($name);
844 $t = $now - $row["mtime"];
852 $t = $t . " " . ngettext("day","days",$t);
855 $t = $t . " " . ngettext("hour","hours",$t);
859 $t = $t . " " . ngettext("minute","minutes",$t);
862 // $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
864 $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
865 $b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
867 $builder = "$dist/$arch/". $fail_or_ok[$ok];
869 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$b\">$builder</a></td>";
870 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
871 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
872 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
873 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
874 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
877 echo "</table></div>\n";
879 $backarr = "<<< ";
880 $back = _("Page back");
881 $forward = _("Page forward");
882 $forwardarr = " >>>";
887 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
893 $hrefurl = "<a href=\"$big_url&off=$noff\">";
894 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
896 echo "$backarr</td><td align=left>$back";
899 echo "</td>\n<td align=\"center\">";
900 echo "</td>\n<td align=\"right\">";
902 if ($off + $cnt < count($list))
907 $hrefurl = "<a href=\"$big_url&off=$noff\">";
908 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
912 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
915 echo "</td>\n</tr></table></p>";
919 echo _("Enter something!");
921 echo "</div></form>\n";
927 <table border="0" width="100%"><tr><td width="20%"> </td><td>
928 <h1><?=_("Welcome!")?></h1>
929 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
930 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
931 <!-- ech... niech strace... -->
932 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
933 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
934 </td><td width="20%"> </td></tr>
939 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
940 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
941 header("Cache-Control: no-cache, must-revalidate");
942 header("Pragma: no-cache");
945 if ($action == "text") {
947 } else if ($action == "adv_search") {
951 } else if ($action == "qatxt") {
955 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
957 echo "</td><td valign=\"top\">";
961 else if ($action == "sqa")
963 else if (isset($id) || isset($name))
964 dump_log($action == "tail");
965 else if (isset($dist))
969 echo "</td></tr></table>";