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 = $_GET["dist"];
53 $dist = basename(htmlspecialchars($dist, ENT_QUOTES, 'UTF-8'));
54 $arch = $_GET["arch"];
55 $arch = basename(htmlspecialchars($arch, ENT_QUOTES, 'UTF-8'));
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 = $_GET["name"];
64 $name = $dist = basename(htmlspecialchars($name, ENT_QUOTES, 'UTF-8'));
66 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
68 if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
70 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
72 if (isset($_GET["action"])) {
73 $action = $_GET["action"];
74 $action = htmlspecialchars($action, ENT_QUOTES, 'UTF-8');
77 if (isset($_GET["off"]))$off=(int)$_GET["off"];
79 if (isset($_GET["id"])) {
81 $id = htmlspecialchars($id, ENT_QUOTES, 'UTF-8');
84 if (isset($_POST["str"])) {
86 $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
88 if (isset($_POST["action"])) {
89 $action = $_POST["action"];
90 $action = htmlspecialchars($action, ENT_QUOTES, 'UTF-8');
93 if (isset($arch) && $arch == "src")
98 echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
99 echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
101 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
102 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
103 <html xmlns="http://www.w3.org/1999/xhtml">
105 <title>PLD Build Logs</title>
106 <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
107 <style type="text/css"><!--
108 A { text-decoration: none; }
109 A:hover { text-decoration: underline; }
110 H1 { font-family: arial,helvetica,sans-serif;
113 H2 { font-family: arial,helvetica,sans-serif;
116 BODY,TD { font-family: arial,helvetica,sans-serif;
118 TH { font-family: arial,helvetica,sans-serif;
121 /* error lines from build logs */
123 background-color: #b00;
130 background-color: #161;
138 <!-- Diffrent color for visited link doesn't make much sense here...
139 this page is autogenerated and it might be misleading after some
140 build log changes. -->
141 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
147 echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
148 "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
153 echo "</pre></font></td></tr></table>\n";
158 echo "</body></html>";
164 echo "Fatal error: $msg";
172 global $arch, $dist, $ok;
173 global $big_url, $ns;
174 global $off, $cnt, $root_directory, $url;
182 $big_url = $url . '?' . http_build_query($query_data);
185 echo "<h1>"._("Listing of")." $dist/$arch/OK "
186 ."(<a href=\"$big_url&ok=0\">"._("fail")."</a>)</h1>\n";
188 echo "<h1>"._("Listing of")." $dist/$arch/FAIL "
189 ."(<a href=\"$big_url&ok=1\">"._("ok")."</a>)</h1>\n";
192 echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
193 "cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
194 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
195 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
196 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
197 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
198 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
199 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
202 if ($ns != 1) $ns = 0;
203 if (!isset($ok)) $ok = 0;
204 // if (!isset($off)) $off = 0;
205 // if (!isset($cnt)) $cnt = 50;
206 if ($ns == 0) $order = "mtime DESC";
207 else $order = "name";
209 $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE
210 dist = :dist AND arch = :arch AND ok = :ok ORDER BY $order LIMIT :limitnr OFFSET :offset ";
213 $dbh = new PDO("$database");
214 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
215 $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
216 } catch (PDOException $e) {
217 mydie("new PDO: " . $e->getMessage());
221 $stmt = $dbh->prepare($query);
222 $stmt->bindParam(':dist', $dist, PDO::PARAM_STR);
223 $stmt->bindParam(':arch', $arch, PDO::PARAM_STR);
224 $stmt->bindParam(':ok', $ok, PDO::PARAM_INT);
225 $stmt->bindParam(':limitnr', $cnt, PDO::PARAM_INT);
226 $stmt->bindParam(':offset', $off, PDO::PARAM_INT);
227 $stmt->execute([$dist, $arch, $ok, $cnt, $off]);
228 while ($row = $stmt->fetch()) {
229 $name = $row["name"];
231 $dist = $row["dist"];
232 $arch = $row["arch"];
234 $name_url = urlencode($name);
235 $t = $now - $row["mtime"];
245 $t = $t . " " . ngettext("day","days",$t);
248 $t = $t . " " . ngettext("hour","hours",$t);
252 $t = $t . " " . ngettext("minute","minutes",$t);
260 $u = $url . '?' . http_build_query($url_data);
261 echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
262 "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">".htmlspecialchars($f, ENT_QUOTES, 'UTF-8')."</a> ".
263 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
264 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
265 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
266 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
270 echo "</table></div>\n";
272 $backarr = "<<< ";
273 $back = _("Page back");
274 $forward = _("Page forward");
275 $forwardarr = " >>>";
277 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
280 $noff = $off - $count;
283 $hrefurl = "<a href=\"$big_url&off=$noff\">";
284 echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
286 echo "$backarr</td><td align=\"left\">$back";
289 echo "</td>\n<td align=\"center\">";
291 if (isset($dist) && isset($arch)) {
292 echo "[<a href=\"$big_url&action=qa\">"._("View <quot>rpm -qa</quot> of builder")."</a>]";
297 echo "</td>\n<td align=right>";
298 if ($cnt == $count) {
302 $hrefurl = "<a href=\"$big_url&off=$noff\">";
303 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
305 echo "$forward</td><td align=right width=1%>$forwardarr";
307 echo "</td>\n</tr></table></p>";
312 global $ok, $dist, $arch, $name, $name_url, $id;
314 if (isset($name) && isset($ok) && isset($arch) && isset($dist)) {
315 if (isset($id) && $id != '') {
316 $name = $name . ",$id";
318 $w = $ok ? "OK" : "FAIL";
319 return "$dist/$arch/$w/$name.bz2";
323 function get_filter($f)
325 if (preg_match("/\.bz2$/", $f)) {
326 if (is_executable("/usr/bin/lbzcat"))
330 } elseif (preg_match("/\.gz$/", $f)) {
338 function dump_log($tail)
340 global $ok, $url, $dist, $arch, $name, $name_url;
341 global $root_directory, $big_url, $ns, $id, $cnt, $off;
342 global $buildlogs_server;
349 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
350 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
351 list($name, $id) = explode(',', $df);
353 if ($name != 'command') {
354 $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
355 $name = "<a href=\"$gitweb_url\">$name</a>";
357 echo "<h1>$name <small>$id</small></h1>";
359 echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
361 function one_item($h, $t) {
362 echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
363 "<td bgcolor=\"#cccccc\">$t</td></tr>";
366 function href($h, $c) {
367 return "<a href=\"$h\">$c</a>";
370 one_item(_("Status"), ($ok == 1 ?
371 "<font color=\"green\"><b>"._("OK")."</b></font>" :
372 "<font color=\"red\"><b>"._("Failed")."</b></a>"));
373 one_item(_("Source URL"),
374 href("ftp://$buildlogs_server/$f",
375 "ftp://$buildlogs_server/$f"));
377 $big_url = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&cnt=$cnt";
378 $bu = "$big_url&off=$off";
380 one_item(_("text/plain URL"),
381 href("$bu&name=$name_url&id=$id&action=text",
384 one_item(_("full text"),
385 href("$bu&name=$name_url&id=$id",
389 if (isset($dist) && isset($arch)) {
390 one_item(_("rpm -qa of builder"), href("$bu&action=qa", _("View!")));
392 one_item(_("rpm -qa of builder"), _("Not available"));
394 one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
396 echo "<tr><td>Here:</td><td>" .
397 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
398 "http://" . getenv("SERVER_NAME") .
399 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
404 # what can I say beside PHP suxx? how the fuck should I create
405 # bidirectional pipe? gotta use wget
407 $filter = get_filter($f);
409 $cmd = "$filter '$root_directory/$f'";
410 $fd = popen($cmd, "r");
414 $first_cut_done = false;
419 while (($s = fgets($fd, 102400)) != false) {
424 $s = htmlspecialchars($s);
426 if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
429 $toc_elem = "error $err_count";
431 $s = "<span class=error id=error-$err_count>$s</span>";
432 } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed|compilation terminated|make\[.*:.* (Stop\.$|Error))/i", $s)) {
435 $toc_elem = "error $err_count";
437 $s = "<span class=error id=error-$err_count>$s</span>";
438 } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
440 $toc_elem = "make {$m['target']}";
442 $s = "<span class=line id=make-{$m['target']}>$s</span>";
443 } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
444 // rpm changelog link
445 $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
446 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
447 } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
449 $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
450 $link = "<a href=\"$url\">{$m['hash']}</a>";
451 $s = "<span class=changelog>{$m['line']} $link<br/></span>";
452 } elseif (substr($s, 0, 2) == "+ ") {
454 $s = "<span class=verbose>$s</span>";
455 } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
457 $toc_elem = $m['section'];
459 $s = "<span class=section id={$m['section']}>$s</span>";
460 } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
463 $toc_elem = "files ".$m['name'];
465 $s = "<span class=section id=files-{$m['name']}>$s</span>";
466 } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
473 // if error/processing found truncate early but keep last 100 lines before error
474 if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
475 array_splice($out_buf, 0, $out_buf_size - 100);
477 $first_cut_done = true;
480 // if (not in tail mode) or (in tail mode but we have an error)
481 if (!$tail || $first_cut) {
490 // no errors found, no processing found but we are in tail mode
491 if ($tail && !$first_cut_done && $out_buf_size > 100) {
492 array_splice($out_buf, 0, $out_buf_size - 100);
496 $code = join('', $out_buf);
499 one_item(_("Runtime"), $time);
505 echo "<h2>"._("Toc:")."</h2>";
506 echo "<ul class=toc>";
507 foreach ($toc as $i => $section) {
508 $id = str_replace(" ", "-", $section);
509 echo "<li><a href=#{$id}>{$section}</a></li>";
510 echo "<code>{$err[$i]}</code>";
515 echo "<h2>"._("Content:")."</h2>";
525 [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
528 [<a href="<?php echo "$bu&action=qa"
529 ?>"><?=_("View rpm -qa of builder")?></a>]
539 global $root_directory;
540 global $buildlogs_server;
542 header("Content-type: text/plain");
548 echo "# src : ftp://$buildlogs_server/$f\n";
550 date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
552 $filter = get_filter($f);
554 $cmd = "$filter '$root_directory/$f'";
555 $fd = popen($cmd, "r");
560 function list_archs()
562 global $addr, $url, $cnt,$ok,$ns;
567 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
569 echo "<table width=\"100%\" border=\"0\">\n";
570 echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
571 foreach ($addr as $dist => $ddist) {
572 echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
573 foreach ($ddist as $arch) {
574 echo "<tr><td nowrap=\"nowrap\">".
575 "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
576 $dist/$arch</a></td><td nowrap=\"nowrap\">".
577 "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
578 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
582 echo "</table><hr />\n";
584 echo "<div align=\"center\">";
585 echo "<a href=\"$big_url&action=adv_search\">"._("Advanced Search")."</a><br />\n";
587 echo "<a href=\"$url\">main()</a><hr />\n";
588 echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
589 "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
590 "<small>(c) 2002-". date("Y") . " ".
591 "<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
596 echo "<div align=\"center\"><small>";
597 $pow = array("vim", "php", "brain", "power", "electricity",
598 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
599 "voodoo magic", "Linux", "x-files", "X", "foobar",
600 "/dev/null", "/dev/zero", "/dev/drzewo",
601 "Leppe'", "matrix", "Neo", "PDP-11",
602 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
603 "foobarbaz", "ed", "Joe", "Unix conspiracy",
604 "overclock", "The Right Thing",
605 "The Bad Thing", "Star Treck", "NSA", "NASA",
606 "achelon", "VAX", "Real Programmer",
607 "Real Operating System", "Real Computer",
608 "computron", "bogon", "quantum bogodynamics",
609 "BOFH", "/dev/ill", "nasi tu byli",
610 "Paranoid Android", "Lunatic Corp", "Parallel thinking",
611 "sfistak", "Linus", "The Golden Path", "Dark Side of the Force",
612 "Przewodniczacego Lepper-a", "KDE", "Microsoft Windows 2003", "sqlite3",
613 "synergy", "six Cray XMT Supercomputers"
614 # feel free to add sth if you change this file ;)
616 echo _("Powered by")." ";
618 for ($i = 0; $i < $max; $i++) {
619 $x = rand(0, count($pow) - 1);
620 if ($pow[$x] == "") $i--;
621 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
624 echo "</small></div>";
626 echo "<div align=\"center\"><small>";
627 echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
628 echo "</small></div>";
630 if (isset($dist) && isset($arch)) {
631 echo "<form action=\"index.php\" method=\"post\">";
632 echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
633 echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
634 echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
635 echo "<input type=\"text\" size=\"14\" name=\"str\" /><br />";
636 echo "<input type=\"submit\" name=\"submit\" value=\""._("Search rpmqa!")."\" />";
645 if (!isset($dist) || !isset($arch))
647 $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
648 return fopen("$addr", "r");
653 global $url, $str, $dist, $arch;
656 echo "<h1>"._("Search results for")." '$str' "._("in")." $dist/$arch</h1>";
661 echo _("Sorry, cannot open.");
663 while (($s = fgets($f, 1000)) != false) {
664 if (stristr($s, "Query done at:")) {
665 echo "rpmqa database from " . strstr($s, ":") . "\n";
669 if (stristr($s, $str))
677 function dump_qa($plain)
679 global $url, $dist, $arch;
684 header("Content-type: text/plain");
685 echo _("# rpm -qa of")." $dist/$arch\n";
687 echo "<h1>"._("rpm -qa of")." $a</h1>";
688 echo "<a href=\"$url?dist=$dist&arch=$arch&action=qatxt\">"._("text/plain version")."</a>";
693 echo _("Sorry, cannot open.");
695 while (($s = fgets($f, 1000)) != false) {
705 function adv_search()
707 global $database, $addr, $fail_or_ok, $url, $_POST, $off, $cnt, $root_directory, $ok, $ns;
709 $big_url = "$url?ok=$ok&ns=$ns&cnt=$cnt";
711 echo "<script><!--\n".
712 "function checkboxToggle() {\n".
713 "for (var i=0;i<document.forms[0].elements.length;i++) {\n".
714 "var e = document.forms[0].elements[i];\n".
715 "if ((e.name != 'all') && (e.type=='checkbox'))\n".
716 "e.checked = document.forms[0].all.checked;\n".
717 "}\n }\n -->\n </script>\n";
719 /* Shut up warnings */
720 if (!isset($_POST["n2"])) $_POST["n2"] = "";
721 if (!isset($_POST["age1"])) $_POST["age1"] = "";
722 if (!isset($_POST["age2"])) $_POST["age2"] = "";
723 if (!isset($_POST["size1"])) $_POST["size1"] = "";
724 if (!isset($_POST["size2"])) $_POST["size2"] = "";
726 echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
728 echo "<div align=\"center\">";
729 echo "<table border=\"0\">\n";
731 echo "<td>"._("Package name")."</td>\n";
732 echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
736 echo "<td>"._("Days")."</td>\n";
737 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
738 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
742 echo "<td>"._("Size")."</td>\n";
743 echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
744 echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
748 echo "<td>"._("Search logs:")."</td>\n";
752 echo "<td>"._("Failed")."</td>\n";
753 echo "<td>"._("OK")."</td>\n";
757 foreach ($addr as $dist => $ddist) {
758 foreach ($ddist as $arch) {
761 if (!isset($_POST["$name"])) {
764 $check=" checked='checked'";
766 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
768 if (!isset($_POST["$n2"])) {
771 $check=" checked='checked'";
773 echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
780 echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
785 // if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
786 // isset($_POST["size1"]) || isset($_POST["size2"])
787 if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
788 ($_POST["size1"]!="") || ($_POST["size2"]!=""))
790 $query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
791 if ($_POST["n2"] != "") {
792 $n = addslashes($_POST["n2"]);
793 $query .= "AND name LIKE '$n%' ";
797 if ($_POST["age1"] != "") {
798 $age = $now - (int)$_POST["age1"] * 24 * 3600;
799 $query .= "AND mtime > $age ";
802 if ($_POST["age2"] != "") {
803 $age = $now - (int)$_POST["age2"] * 24 * 3600;
804 $query .= "AND mtime < $age ";
807 if ($_POST["size1"] != "") {
808 $size = (int)$_POST["size1"];
809 $query .= "AND size > $size ";
812 if ($_POST["size2"] != "") {
813 $size = (int)$_POST["size2"];
814 $query .= "AND size < $size ";
819 foreach ($addr as $dist => $ddist) {
820 foreach ($ddist as $arch) {
821 for ($j = 0; $j < 2; $j++) {
822 if (isset($_POST["as" . $j . "_" .$i])) {
823 $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
830 if ($or == " OR ") $query .= ")";
831 // if (!isset($cnt)) $cnt = 50;
832 // if (!isset($off)) $off = 0;
833 if (!isset($ns)) $ns = 0;
836 $query .= " ORDER BY mtime DESC";
839 $query .= " ORDER BY name";
842 $query .= " ORDER BY dist, arch, name";
845 $query .= " LIMIT $cnt OFFSET $off ";
848 $dbh = new PDO("$database");
849 } catch (PDOException $e) {
850 mydie("new PDO: " . $e->getMessage());
852 $result = $dbh->query("$query")->fetchAll();
854 if ($result == FALSE) {
855 echo _("Nothing found");
857 echo "<table border=\"0\" cellspacing=\"1\" ".
858 "cellpadding=3 bgcolor=\"#000000\" width=\"90%\">\n";
859 echo "<tr><th bgcolor=\"#CCCCFF\" align=\"left\" width=\"10%\">"._("Builder").
860 "[<a href=\"$big_url&ns=2\">"._("sort")."</a>]</th>";
861 echo "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"60%\">"._("Log File").
862 "[<a href=\"$big_url&ns=1\">"._("sort")."</a>]</th>".
863 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
864 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
865 "[<a href=\"$big_url&ns=0\">"._("sort")."</a>]</th>".
868 // for ($i = $off; $i < $off + $count; $i++) {
869 foreach ($result as $row) {
870 $dist = $row["dist"];
871 $arch = $row["arch"];
872 $name = $row["name"];
873 $name_url = urlencode($name);
876 $t = $now - $row["mtime"];
884 $t = $t . " " . ngettext("day","days",$t);
887 $t = $t . " " . ngettext("hour","hours",$t);
891 $t = $t . " " . ngettext("minute","minutes",$t);
894 // $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
896 $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
897 $b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
899 $builder = "$dist/$arch/". $fail_or_ok[$ok];
901 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$b\">$builder</a></td>";
902 echo "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
903 "[<a href=\"$u&action=text\">"._("text")."</a> | ".
904 "<a href=\"$u&action=tail\">"._("tail")."</a>]".
905 "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
906 "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
909 echo "</table></div>\n";
911 $backarr = "<<< ";
912 $back = _("Page back");
913 $forward = _("Page forward");
914 $forwardarr = " >>>";
919 echo "<p><table width=\"90%\" align=\"center\"><tr><td align=left width=1%>";
925 $hrefurl = "<a href=\"$big_url&off=$noff\">";
926 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
928 echo "$backarr</td><td align=left>$back";
931 echo "</td>\n<td align=\"center\">";
932 echo "</td>\n<td align=\"right\">";
934 if ($off + $cnt < count($list))
939 $hrefurl = "<a href=\"$big_url&off=$noff\">";
940 echo "$hrefurl$forward</a></td><td align=\"right\" width=\"1%\">$hrefurl$forwardarr</a>";
944 echo "$forward</td><td align=\"right\" width=\"1%\">$forwardarr";
947 echo "</td>\n</tr></table></p>";
951 echo _("Enter something!");
953 echo "</div></form>\n";
959 <table border="0" width="100%"><tr><td width="20%"> </td><td>
960 <h1><?=_("Welcome!")?></h1>
961 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
962 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
963 <!-- ech... niech strace... -->
964 <a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
965 <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a>.</p>
966 </td><td width="20%"> </td></tr>
971 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
972 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
973 header("Cache-Control: no-cache, must-revalidate");
974 header("Pragma: no-cache");
977 if ($action == "text") {
979 } else if ($action == "adv_search") {
983 } else if ($action == "qatxt") {
987 echo "<table cellpadding=\"10\" width=\"100%\"><tr><td valign=\"top\" width=\"10%\">";
989 echo "</td><td valign=\"top\">";
993 else if ($action == "sqa")
995 else if (isset($id) || isset($name))
996 dump_log($action == "tail");
997 else if (isset($dist))
1001 echo "</td></tr></table>";