]> git.pld-linux.org Git - projects/buildlogs.git/blobdiff - index.php
Escape few things (that can be escaped early without breaking functionality). Should...
[projects/buildlogs.git] / index.php
index ccf817b5ff4c3d2408b82f96cadbb48b64353594..6eca0717bcbd8e1c5fcc956481a7adaa246d2545 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,4 +1,7 @@
 <?php
 <?php
+if (!function_exists("ob_gzhandler"))
+  die("ob_gzhandler function is missing - install php zlib module");
+
 ob_start("ob_gzhandler", 1);
 $buildlogs_server = "buildlogs.pld-linux.org";
 $url = "index.php";
 ob_start("ob_gzhandler", 1);
 $buildlogs_server = "buildlogs.pld-linux.org";
 $url = "index.php";
@@ -17,6 +20,7 @@ $langs["en_US"]["charset"]="ISO-8859-1";
 $langs["pl_PL"]["charset"]="ISO-8859-2";
 
 $lang="en_US";
 $langs["pl_PL"]["charset"]="ISO-8859-2";
 
 $lang="en_US";
+$lang_detected="";
 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
 {
   $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
 if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
 {
   $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
@@ -45,16 +49,19 @@ textdomain("messages");
 
 if (isset($_GET["dist"]) && isset($_GET["arch"]))
 {
 
 if (isset($_GET["dist"]) && isset($_GET["arch"]))
 {
-       $dist = basename($_GET["dist"]);
-       $arch = basename($_GET["arch"]);
+       $dist = $_GET["dist"];
+       $dist = basename(htmlspecialchars($dist, ENT_QUOTES, 'UTF-8'));
+       $arch = $_GET["arch"];
+       $arch = basename(htmlspecialchars($arch, ENT_QUOTES, 'UTF-8'));
 }
 
 if (isset($_POST["dist"])) $dist = basename($_POST["dist"]);
 if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
 
 if (isset($_GET["name"])) {
 }
 
 if (isset($_POST["dist"])) $dist = basename($_POST["dist"]);
 if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
 
 if (isset($_GET["name"])) {
-  $name_url = urlencode($_GET["name"]);
-       $name = basename($_GET["name"]);
+       $name_url = urlencode($_GET["name"]);
+       $name = $_GET["name"];
+       $name = $dist = basename(htmlspecialchars($name, ENT_QUOTES, 'UTF-8'));
 }
 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
 else $ok="";
 }
 if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
 else $ok="";
@@ -62,14 +69,29 @@ if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
 else $ns="";
 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
 else $cnt = 50;
 else $ns="";
 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
 else $cnt = 50;
-if (isset($_GET["action"]))$action=$_GET["action"];
-else $action="";
+if (isset($_GET["action"])) {
+       $action = $_GET["action"];
+       $action = htmlspecialchars($action, ENT_QUOTES, 'UTF-8');
+} else
+       $action="";
 if (isset($_GET["off"]))$off=(int)$_GET["off"];
 else $off = 0;
 if (isset($_GET["off"]))$off=(int)$_GET["off"];
 else $off = 0;
-if (isset($_GET["id"]))$id=$_GET["id"];
+if (isset($_GET["id"])) {
+       $id = $_GET["id"];
+       $id = htmlspecialchars($id, ENT_QUOTES, 'UTF-8');
+}
+
+if (isset($_POST["str"])) {
+       $str = $_POST["str"];
+       $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
+}
+if (isset($_POST["action"])) {
+       $action = $_POST["action"];
+       $action = htmlspecialchars($action, ENT_QUOTES, 'UTF-8');
+}
 
 
-if (isset($_POST["str"]))$str=$_POST["str"];
-if (isset($_POST["action"]))$action=$_POST["action"];
+if (isset($arch) && $arch == "src")
+       $arch = "SRPMS";
 
 function myheader()
 {
 
 function myheader()
 {
@@ -85,17 +107,31 @@ echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
   <style type="text/css"><!--
 A { text-decoration: none; }
 A:hover { text-decoration: underline; }
   <style type="text/css"><!--
 A { text-decoration: none; }
 A:hover { text-decoration: underline; }
-H1 { font-family: arial,helvetica,sans-serif; 
-     font-size: 20pt; 
+H1 { font-family: arial,helvetica,sans-serif;
+     font-size: 20pt;
      font-weight: bold;}
      font-weight: bold;}
-H2 { font-family: arial,helvetica,sans-serif; 
-     font-size: 18pt; 
+H2 { font-family: arial,helvetica,sans-serif;
+     font-size: 18pt;
      font-weight: bold;}
      font-weight: bold;}
-BODY,TD { font-family: arial,helvetica,sans-serif; 
+BODY,TD { font-family: arial,helvetica,sans-serif;
           font-size: 13pt; }
           font-size: 13pt; }
-TH { font-family: arial,helvetica,sans-serif; 
-     font-size: 13pt; 
+TH { font-family: arial,helvetica,sans-serif;
+     font-size: 13pt;
      font-weight: bold; }
      font-weight: bold; }
+/* error lines from build logs */
+.error {
+       background-color: #b00;
+}
+.verbose {
+       color: #886;
+}
+.section {
+       color: #111;
+       background-color: #161;
+}
+.changelog a {
+       color: #fff;
+}
 //-->
 </style>
  </head>
 //-->
 </style>
  </head>
@@ -109,7 +145,7 @@ TH { font-family: arial,helvetica,sans-serif;
 function start_pre()
 {
        echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
 function start_pre()
 {
        echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
-               "<font color=\"#cccccc\"><pre style=\"width: 2048px;overflow: scroll\">";
+               "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
 }
 
 function end_pre()
 }
 
 function end_pre()
@@ -137,7 +173,13 @@ function list_logs()
        global $big_url, $ns;
        global $off, $cnt, $root_directory, $url;
 
        global $big_url, $ns;
        global $off, $cnt, $root_directory, $url;
 
-       $big_url = "$url?dist=$dist&amp;arch=$arch&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
+       $query_data = array(
+               'dist' => $dist,
+               'arch' => $arch,
+               'ok' => $ok,
+               'ns' => $ns,
+               'cnt' => $cnt);
+       $big_url = $url . '?' . http_build_query($query_data);
 
        if ($ok == 1) {
                echo "<h1>"._("Listing of")." $dist/$arch/OK "
 
        if ($ok == 1) {
                echo "<h1>"._("Listing of")." $dist/$arch/OK "
@@ -164,23 +206,32 @@ function list_logs()
        if ($ns == 0) $order = "mtime DESC";
        else $order = "name";
 
        if ($ns == 0) $order = "mtime DESC";
        else $order = "name";
 
-       $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE "
-       . "dist = '$dist' AND arch = '$arch' AND ok = $ok ORDER BY $order LIMIT $cnt OFFSET $off";
+       $query = "SELECT log_id, dist, arch, ok, name, mtime, size, id FROM logs WHERE
+                         dist = :dist AND arch = :arch AND ok = :ok ORDER BY $order LIMIT :limitnr OFFSET :offset ";
 
        try {
                $dbh = new PDO("$database");
 
        try {
                $dbh = new PDO("$database");
+               $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+               $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
        } catch (PDOException $e) {
                mydie("new PDO: " . $e->getMessage());
        }
        $now = time();
        $i = $off;
        } catch (PDOException $e) {
                mydie("new PDO: " . $e->getMessage());
        }
        $now = time();
        $i = $off;
-       foreach ($dbh->query("$query") as $row) {
-    $name = $row["name"];
-    $id = $row["id"];
-    $dist = $row["dist"];
-    $arch = $row["arch"];
+       $stmt = $dbh->prepare($query);
+       $stmt->bindParam(':dist', $dist, PDO::PARAM_STR);
+       $stmt->bindParam(':arch', $arch, PDO::PARAM_STR);
+       $stmt->bindParam(':ok', $ok, PDO::PARAM_INT);
+       $stmt->bindParam(':limitnr', $cnt, PDO::PARAM_INT);
+       $stmt->bindParam(':offset', $off, PDO::PARAM_INT);
+       $stmt->execute([$dist, $arch, $ok, $cnt, $off]);
+       while ($row = $stmt->fetch()) {
+               $name = $row["name"];
+               $id = $row["id"];
+               $dist = $row["dist"];
+               $arch = $row["arch"];
                $f = $name;
                $f = $name;
-    $name_url = urlencode($name);
+               $name_url = urlencode($name);
                $t = $now - $row["mtime"];
                $s = $row["size"];
                $h = $row["log_id"];
                $t = $now - $row["mtime"];
                $s = $row["size"];
                $h = $row["log_id"];
@@ -200,9 +251,15 @@ function list_logs()
                        $t = round($t);
                        $t = $t . "&nbsp;" . ngettext("minute","minutes",$t);
                }
                        $t = round($t);
                        $t = $t . "&nbsp;" . ngettext("minute","minutes",$t);
                }
-               $u = "$url?dist=$dist&amp;arch=$arch&amp;ok=$ok&amp;name=$name_url&amp;id=$id";
+               $url_data = array(
+                       'dist' => $dist,
+                       'arch' => $arch,
+                       'ok' => $ok,
+                       'name' => $name_url,
+                       'id' => $id);
+               $u = $url . '?' . http_build_query($url_data);
                echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
                echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
-                    "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
+                    "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">".htmlspecialchars($f, ENT_QUOTES, 'UTF-8')."</a> ".
                     "[<a href=\"$u&amp;action=text\">"._("text")."</a> | ".
                      "<a href=\"$u&amp;action=tail\">"._("tail")."</a>]".
                     "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
                     "[<a href=\"$u&amp;action=text\">"._("text")."</a> | ".
                      "<a href=\"$u&amp;action=tail\">"._("tail")."</a>]".
                     "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
@@ -263,6 +320,21 @@ function file_name()
        }
 }
 
        }
 }
 
+function get_filter($f)
+{
+       if (preg_match("/\.bz2$/", $f)) {
+               if (is_executable("/usr/bin/lbzcat"))
+                       $filter = "lbzcat";
+               else
+                       $filter = "bzcat";
+       } elseif (preg_match("/\.gz$/", $f)) {
+               $filter = "zcat";
+       } else {
+               $filter = "cat";
+       }
+       return $filter;
+}
+
 function dump_log($tail)
 {
        global $ok, $url, $dist, $arch, $name, $name_url;
 function dump_log($tail)
 {
        global $ok, $url, $dist, $arch, $name, $name_url;
@@ -276,10 +348,15 @@ function dump_log($tail)
 
        $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
        $df = preg_replace("/\.(bz2|gz)$/", "", $df);
 
        $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
        $df = preg_replace("/\.(bz2|gz)$/", "", $df);
+       list($name, $id) = explode(',', $df);
 
 
-       echo "<h1>$df</h1>";
+       if ($name != 'command') {
+               $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
+               $name = "<a href=\"$gitweb_url\">$name</a>";
+       }
+       echo "<h1>$name <small>$id</small></h1>";
 
 
-       echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
+       echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
 
        function one_item($h, $t) {
                echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
 
        function one_item($h, $t) {
                echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
@@ -290,21 +367,21 @@ function dump_log($tail)
                return "<a href=\"$h\">$c</a>";
        }
 
                return "<a href=\"$h\">$c</a>";
        }
 
-       one_item(_("Status"), ($ok == 1 ?  
-                               "<font color=\"green\"><b>"._("OK")."</b></font>" : 
+       one_item(_("Status"), ($ok == 1 ?
+                               "<font color=\"green\"><b>"._("OK")."</b></font>" :
                                "<font color=\"red\"><b>"._("Failed")."</b></a>"));
                                "<font color=\"red\"><b>"._("Failed")."</b></a>"));
-       one_item(_("Source URL"), 
-                href("ftp://$buildlogs_server/$f", 
+       one_item(_("Source URL"),
+                href("ftp://$buildlogs_server/$f",
                      "ftp://$buildlogs_server/$f"));
 
        $big_url = "$url?dist=$dist&amp;arch=$arch&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
        $bu = "$big_url&amp;off=$off";
 
                      "ftp://$buildlogs_server/$f"));
 
        $big_url = "$url?dist=$dist&amp;arch=$arch&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
        $bu = "$big_url&amp;off=$off";
 
-       one_item(_("text/plain URL"), 
+       one_item(_("text/plain URL"),
                 href("$bu&amp;name=$name_url&amp;id=$id&amp;action=text",
                      _("View!")));
        if ($tail) {
                 href("$bu&amp;name=$name_url&amp;id=$id&amp;action=text",
                      _("View!")));
        if ($tail) {
-               one_item(_("full text"), 
+               one_item(_("full text"),
                         href("$bu&amp;name=$name_url&amp;id=$id",
                              _("View!")));
        }
                         href("$bu&amp;name=$name_url&amp;id=$id",
                              _("View!")));
        }
@@ -316,42 +393,131 @@ function dump_log($tail)
         }
        one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
        /*
         }
        one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory/$f")));
        /*
-       echo "<tr><td>Here:</td><td>" . 
+       echo "<tr><td>Here:</td><td>" .
                "<a href=\"$url?idx=$idx&amp;ok=$ok&amp;id=$id\">".
                "http://" . getenv("SERVER_NAME") .
                getenv("SCRIPT_NAME") . "?idx=$idx&amp;ok=$ok&amp;id=$id</a>" .
             "</td></tr>"; */
 
                "<a href=\"$url?idx=$idx&amp;ok=$ok&amp;id=$id\">".
                "http://" . getenv("SERVER_NAME") .
                getenv("SCRIPT_NAME") . "?idx=$idx&amp;ok=$ok&amp;id=$id</a>" .
             "</td></tr>"; */
 
-       echo "</table><h2>"._("Content:")."</h2>";
 
 
        # what can I say beside PHP suxx? how the fuck should I create
        # bidirectional pipe? gotta use wget
 
 
 
        # what can I say beside PHP suxx? how the fuck should I create
        # bidirectional pipe? gotta use wget
 
-       if (preg_match("/\.bz2$/", $f)) {
-               $filter = "bzcat";
-       } elseif (preg_match("/\.gz$/", $f)) {
-               $filter = "zcat";
-       } else {
-               $filter = "cat";
-       }
+       $filter = get_filter($f);
 
        $cmd = "$filter '$root_directory/$f'";
 
        $cmd = "$filter '$root_directory/$f'";
-       if ($tail)
-               $cmd = "$cmd | tail -n 100";
        $fd = popen($cmd, "r");
        $fd = popen($cmd, "r");
-       start_pre();
+       $toc = array();
+       $err = array();
+       $first_cut = false;
+       $first_cut_done = false;
+       $time = "";
+       $out_buf = array();
+       $out_buf_size = 0;
+       $err_count = 0;
        while (($s = fgets($fd, 102400)) != false) {
        while (($s = fgets($fd, 102400)) != false) {
-               if (strlen($s) > 800) {
-                       $s = chunk_split($s, 800, "\n    ");
-                       $s = trim($s);
-               }
+
+               $toc_elem = false;
+               $err_elem = false;
+
                $s = htmlspecialchars($s);
                $s = htmlspecialchars($s);
-               echo $s;
+               // highlight errors
+               if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
+                       $first_cut = true;
+                       $err_count++;
+                       $toc_elem = "error $err_count";
+                       $err_elem = $s;
+                       $s = "<span class=error id=error-$err_count>$s</span>";
+               } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed|compilation terminated|make\[.*:.* (Stop\.$|Error))/i", $s)) {
+                       $first_cut = true;
+                       $err_count++;
+                       $toc_elem = "error $err_count";
+                       $err_elem = $s;
+                       $s = "<span class=error id=error-$err_count>$s</span>";
+               } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
+                       // rpm build section
+                       $toc_elem = "make {$m['target']}";
+                       $err_elem = $s;
+                       $s = "<span class=line id=make-{$m['target']}>$s</span>";
+               } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
+                       // rpm changelog link
+                       $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
+                       $s = "<span class=changelog>{$m['line']} $link<br/></span>";
+               } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
+                       // rpm changelogs
+                       $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
+                       $link = "<a href=\"$url\">{$m['hash']}</a>";
+                       $s = "<span class=changelog>{$m['line']} $link<br/></span>";
+               } elseif (substr($s, 0, 2) == "+ ") {
+                       // shell verbose
+                       $s = "<span class=verbose>$s</span>";
+               } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
+                       // rpm build section
+                       $toc_elem = $m['section'];
+                       $err_elem = $s;
+                       $s = "<span class=section id={$m['section']}>$s</span>";
+               } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
+                       $first_cut = true;
+                       // processing files
+                       $toc_elem = "files ".$m['name'];
+                       $err_elem = $s;
+                       $s = "<span class=section id=files-{$m['name']}>$s</span>";
+               } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
+                       $time = $m['time'];
+               }
+
+               $out_buf[] = $s;
+               $out_buf_size++;
+
+               // if error/processing found truncate early but keep last 100 lines before error
+               if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
+                       array_splice($out_buf, 0, $out_buf_size - 100);
+                       $out_buf_size = 100;
+                       $first_cut_done = true;
+               }
+
+               // if (not in tail mode) or (in tail mode but we have an error)
+               if (!$tail || $first_cut) {
+                       if ($toc_elem)
+                               $toc[] = $toc_elem;
+                       if ($err_elem)
+                               $err[] = $err_elem;
+               }
        }
        }
-       end_pre();
        pclose($fd);
 
        pclose($fd);
 
+       // no errors found, no processing found but we are in tail mode
+       if ($tail && !$first_cut_done && $out_buf_size > 100) {
+               array_splice($out_buf, 0, $out_buf_size - 100);
+               $out_buf_size = 100;
+       }
+
+       $code = join('', $out_buf);
+
+       if ($time) {
+               one_item(_("Runtime"), $time);
+       }
+
+       echo "</table>";
+
+       if (!empty($toc)) {
+               echo "<h2>"._("Toc:")."</h2>";
+               echo "<ul class=toc>";
+               foreach ($toc as $i => $section) {
+                       $id = str_replace(" ", "-", $section);
+                       echo "<li><a href=#{$id}>{$section}</a></li>";
+                       echo "<code>{$err[$i]}</code>";
+               }
+               echo "</ul>";
+       }
+
+       echo "<h2>"._("Content:")."</h2>";
+
+       start_pre();
+       echo $code;
+       end_pre();
+
 ?>
        <table width="100%">
         <tr>
 ?>
        <table width="100%">
         <tr>
@@ -359,7 +525,7 @@ function dump_log($tail)
           [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
          </td>
          <td align=right>
           [<a href="<?php echo $bu; ?>"><?=_("Back to list of logs")?></a>]
          </td>
          <td align=right>
-          [<a href="<?php echo "$bu&amp;action=qa" 
+          [<a href="<?php echo "$bu&amp;action=qa"
                ?>"><?=_("View rpm -qa of builder")?></a>]
          </td>
         </tr>
                ?>"><?=_("View rpm -qa of builder")?></a>]
          </td>
         </tr>
@@ -380,22 +546,14 @@ function dump_text()
                return;
 
        echo "# src  : ftp://$buildlogs_server/$f\n";
                return;
 
        echo "# src  : ftp://$buildlogs_server/$f\n";
-       echo "# date   : " .  
+       echo "# date   : " .
                        date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
 
                        date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
 
-       if (preg_match("/\.bz2$/", $f)) {
-               $filter = "bzcat";
-       } elseif (preg_match("/\.gz$/", $f)) {
-               $filter = "zcat";
-       } else {
-               $filter = "cat";
-       }
+       $filter = get_filter($f);
 
 
-  $cmd = "$filter '$root_directory/$f'";
+       $cmd = "$filter '$root_directory/$f'";
        $fd = popen($cmd, "r");
        $fd = popen($cmd, "r");
-       while (($s = fgets($fd, 1000)) != false) {
-               echo $s;
-       }
+       fpassthru($fd);
        pclose($fd);
 }
 
        pclose($fd);
 }
 
@@ -410,16 +568,17 @@ function list_archs()
 
        echo "<table width=\"100%\" border=\"0\">\n";
        echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
 
        echo "<table width=\"100%\" border=\"0\">\n";
        echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
-  foreach ($addr as $dist => $ddist) {
-    foreach ($ddist as $arch) {
-               echo "<tr><td nowrap=\"nowrap\">".
-                    "<a href=\"$url?dist=$dist&amp;arch=$arch&amp;ok=0&amp;cnt=$cnt\">
-             $dist/$arch</a></td><td nowrap=\"nowrap\">".
-                    "[<a href=\"$url?dist=$dist&amp;arch=$arch&amp;ok=1&amp;cnt=$cnt\">OK</a>]</td>".
-                    #"<td>[<a href=\"$url?idx=$i&amp;action=qa\">qa</a>]</td>".
-                    "</tr>\n";
-    }
-  }
+       foreach ($addr as $dist => $ddist) {
+               echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
+               foreach ($ddist as $arch) {
+                       echo "<tr><td nowrap=\"nowrap\">".
+                               "<a href=\"$url?dist=$dist&amp;arch=$arch&amp;ok=0&amp;cnt=$cnt\">
+                               $dist/$arch</a></td><td nowrap=\"nowrap\">".
+                               "[<a href=\"$url?dist=$dist&amp;arch=$arch&amp;ok=1&amp;cnt=$cnt\">OK</a>]</td>".
+                               #"<td>[<a href=\"$url?idx=$i&amp;action=qa\">qa</a>]</td>".
+                               "</tr>\n";
+               }
+       }
        echo "</table><hr />\n";
        
        echo "<div align=\"center\">";
        echo "</table><hr />\n";
        
        echo "<div align=\"center\">";
@@ -427,10 +586,10 @@ function list_archs()
        
        echo "<a href=\"$url\">main()</a><hr />\n";
        echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
        
        echo "<a href=\"$url\">main()</a><hr />\n";
        echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
-               "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
-            "<small>(c) 2002 ".
+            "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
+            "<small>(c) 2002-". date("Y") . " ". 
             "<a href=\"mailto:feedback@pld-linux.org\">PLD&nbsp;Team</a><br />\n".
             "<a href=\"mailto:feedback@pld-linux.org\">PLD&nbsp;Team</a><br />\n".
-            '$Revision: 1.8 $'.
+            '$Revision: 1.37 $'.
             "</small></div>\n";
 
        # smile ;)
             "</small></div>\n";
 
        # smile ;)
@@ -438,10 +597,10 @@ function list_archs()
        $pow = array("vim", "php", "brain", "power", "electricity",
                     "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
                     "voodoo magic", "Linux", "x-files", "X", "foobar",
        $pow = array("vim", "php", "brain", "power", "electricity",
                     "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
                     "voodoo magic", "Linux", "x-files", "X", "foobar",
-                    "/dev/null", "/dev/zero", "/dev/drzewo", 
+                    "/dev/null", "/dev/zero", "/dev/drzewo",
                     "Leppe'", "matrix", "Neo", "PDP-11",
                     "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
                     "Leppe'", "matrix", "Neo", "PDP-11",
                     "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
-                    "foobarbaz", "ed", "Joe", "Unix conspiracy", 
+                    "foobarbaz", "ed", "Joe", "Unix conspiracy",
                     "overclock", "The Right Thing",
                     "The Bad Thing", "Star Treck", "NSA", "NASA",
                     "achelon", "VAX", "Real Programmer",
                     "overclock", "The Right Thing",
                     "The Bad Thing", "Star Treck", "NSA", "NASA",
                     "achelon", "VAX", "Real Programmer",
@@ -464,6 +623,10 @@ function list_archs()
        }
        echo "</small></div>";
 
        }
        echo "</small></div>";
 
+       echo "<div align=\"center\"><small>";
+               echo "Your IP: " . $_SERVER['REMOTE_ADDR'];
+       echo "</small></div>";
+
        if (isset($dist) && isset($arch)) {
        echo "<form action=\"index.php\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
        if (isset($dist) && isset($arch)) {
        echo "<form action=\"index.php\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
@@ -481,11 +644,7 @@ function get_qa()
 
        if (!isset($dist) || !isset($arch))
                return false;
 
        if (!isset($dist) || !isset($arch))
                return false;
-       if($dist!='ti'){
-               $addr = "http://ftp.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
-       }else{
-               $addr = "http://ftp.pld-linux.org/branches/titanium/.stat/builder/$dist/rpmqa-$arch.txt";
-       }
+       $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
     return fopen("$addr", "r");
 }
 
     return fopen("$addr", "r");
 }
 
@@ -502,10 +661,15 @@ function search_qa()
                echo _("Sorry, cannot open.");
        } else {
                while (($s = fgets($f, 1000)) != false) {
                echo _("Sorry, cannot open.");
        } else {
                while (($s = fgets($f, 1000)) != false) {
+                       if (stristr($s, "Query done at:")) {
+                               echo "rpmqa database from " . strstr($s, ":") . "\n";
+                               continue;
+                       }
+
                        if (stristr($s, $str))
                                echo $s;
                }
                        if (stristr($s, $str))
                                echo $s;
                }
-               echo "/* EOF */";
+               echo "\n/* EOF */";
        }
        end_pre();
 }
        }
        end_pre();
 }
@@ -517,7 +681,7 @@ function dump_qa($plain)
        $f = get_qa();
 
        if ($plain) {
        $f = get_qa();
 
        if ($plain) {
-               header("Content-type: text/plain"); 
+               header("Content-type: text/plain");
                echo _("# rpm -qa of")." $dist/$arch\n";
        } else {
                echo "<h1>"._("rpm -qa of")." $a</h1>";
                echo _("# rpm -qa of")." $dist/$arch\n";
        } else {
                echo "<h1>"._("rpm -qa of")." $a</h1>";
@@ -597,14 +761,14 @@ function adv_search()
     if (!isset($_POST["$name"])) {
        $check = " ";
     } else {
     if (!isset($_POST["$name"])) {
        $check = " ";
     } else {
-       $check=" checked=\"on\"";
+       $check=" checked='checked'";
     }
     echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
     $name="as1_".$i;
     if (!isset($_POST["$n2"])) {
        $check = " ";
     } else {
     }
     echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
     $name="as1_".$i;
     if (!isset($_POST["$n2"])) {
        $check = " ";
     } else {
-       $check=" checked=\"on\"";
+       $check=" checked='checked'";
     }
     echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
     echo "</tr>\n";
     }
     echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
     echo "</tr>\n";
@@ -679,7 +843,7 @@ function adv_search()
                        break;
        }
        $query .= " LIMIT $cnt OFFSET $off ";
                        break;
        }
        $query .= " LIMIT $cnt OFFSET $off ";
-    
+
        try {
                $dbh = new PDO("$database");
        } catch (PDOException $e) {
        try {
                $dbh = new PDO("$database");
        } catch (PDOException $e) {
@@ -786,7 +950,7 @@ function adv_search()
   {
     echo _("Enter something!");
   }
   {
     echo _("Enter something!");
   }
-  echo "</form>\n";
+  echo "</div></form>\n";
 }
 
 function welcome()
 }
 
 function welcome()
@@ -797,9 +961,8 @@ function welcome()
 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
 <!-- ech... niech strace... -->
 <p><?=_("Welcome to PLD Build Logs WWW interface.")?></p><p>
 <?=_("Feel free to email bug reports, complaints and feature requests ")?>
 <!-- ech... niech strace... -->
-<a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?> 
-<a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
-<p>Version: $Id: index.php,v 1.8 2009/01/21 13:36:11 shadzik Exp $</p>
+<a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
+ <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a>.</p>
 </td><td width="20%">&nbsp;</td></tr>
 </table>
 <?php
 </td><td width="20%">&nbsp;</td></tr>
 </table>
 <?php
This page took 0.130652 seconds and 4 git commands to generate.