Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/packages/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'packages/index.php')
-rw-r--r--packages/index.php125
1 files changed, 17 insertions, 108 deletions
diff --git a/packages/index.php b/packages/index.php
index e49540a..d38cffa 100644
--- a/packages/index.php
+++ b/packages/index.php
@@ -103,9 +103,19 @@ require_once BASE . "/lib/format.php";
$filter .= " AND " . $criterium["options"][$_GET[$criterium["name"]]];
if (isset($_GET["q"])) {
+ $extra_joins = "";
$exact_filter = " AND `binary_packages`.`pkgname` = from_base64(\"".base64_encode($_GET["q"])."\")";
$fuzzy_filter = " AND `binary_packages`.`pkgname` LIKE from_base64(\"".base64_encode("%".$_GET["q"]."%")."\")";
+ } elseif (isset($_GET["g"]) && isset($_GET["ra"])) {
+ $extra_joins =
+ mysql_join_binary_packages_install_target_providers() .
+ mysql_join_install_target_providers_install_targets();
+ $fuzzy_filter =
+ " AND `install_targets`.`name`=from_base64(\"" . base64_encode($_GET["g"]) . "\")" .
+ " AND `r_a`.`name`=from_base64(\"" . base64_encode($_GET["ra"]) . "\")";
+ $exact_filter = " AND 0";
} else {
+ $extra_joins = "";
$exact_filter = " AND 0";
$fuzzy_filter = "";
}
@@ -118,13 +128,14 @@ require_once BASE . "/lib/format.php";
mysql_join_repositories_architectures("","r_a") .
mysql_join_binary_packages_build_assignments() .
mysql_join_build_assignments_package_sources() .
+ $extra_joins .
$filter . $exact_filter .
" ORDER BY ";
$query .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";
$result = mysql_run_query(
- "SELECT " .
+ "SELECT DISTINCT " .
"`binary_packages`.`pkgname`," .
"`package_sources`.`pkgbase`," .
"CONCAT(`r_a`.`name`,\"/\",`repositories`.`name`) AS `repo`," .
@@ -195,6 +206,7 @@ require_once BASE . "/lib/format.php";
mysql_join_repositories_architectures("","r_a") .
mysql_join_binary_packages_build_assignments() .
mysql_join_build_assignments_package_sources() .
+ $extra_joins .
$filter . $fuzzy_filter .
" ORDER BY ";
@@ -208,7 +220,7 @@ require_once BASE . "/lib/format.php";
$query .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";
$result = mysql_run_query(
- "SELECT COUNT(1)" . $query
+ "SELECT COUNT(DISTINCT `binary_packages`.`id`)" . $query
);
$num_results = implode($result -> fetch_assoc());
@@ -219,7 +231,7 @@ require_once BASE . "/lib/format.php";
$page = 1;
$result = mysql_run_query(
- "SELECT " .
+ "SELECT DISTINCT " .
"`binary_packages`.`pkgname`," .
"`package_sources`.`pkgbase`," .
"CONCAT(`r_a`.`name`,\"/\",`repositories`.`name`) AS `repo`," .
@@ -240,63 +252,6 @@ require_once BASE . "/lib/format.php";
$fuzzy_matches[] = $row;
}
- function print_results($results) {
- $oddity="odd";
- foreach ($results as $row) {
- print " <tr class=\"" . $oddity . "\">\n";
- print " <td>\n";
- print " " . $row["arch"] . "\n";
- print " </td>\n";
- print " <td>\n";
- print " " . $row["repo"] . "\n";
- print " </td>\n";
- print " <td>\n";
- print " <a href=\"" . $row["repo"] . "/" . $row["pkgname"] ."/\" ";
- print "title=\"View package details for " . $row["pkgname"] . "\">" . $row["pkgname"] . "</a>\n";
- print " </td>\n";
- print " <td>\n";
- print " " . $row["version"] . "\n";
- print " </td>\n";
- print " <td>\n";
- print " ";
- if ($row["has_issues"])
- print "has open bug reports";
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
- print " <td>\n";
- print " ";
- if (isset($row["build_date"]))
- print $row["build_date"];
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
- print " <td>\n";
- print " ";
- if (isset($row["move_date"]))
- print $row["move_date"];
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
- print " <td>\n";
- print " ";
- if ($row["is_to_be_deleted"])
- print "to be deleted";
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
- print " </tr>\n";
- if ($oddity == "odd" )
- $oddity = "even";
- else
- $oddity = "odd";
- }
- }
-
function header_and_footer() {
global $page, $pages, $num_results;
@@ -450,25 +405,9 @@ if (count($exact_matches) > 0) {
<div class="pkglist-stats">
<p><?php print count($exact_matches); ?> exact match<?php if (count($exact_matches) != 1) print "es"; ?> found.</p>
</div>
- <table class="results">
- <thead>
- <tr>
-<?php
-
- foreach ($sorts as $get => $sort) {
- print " <th>\n";
- print " ".$sort["label"]."\n";
- print " </th>\n";
- }
-?>
- </tr>
- </thead>
- <tbody>
<?php
- print_results($exact_matches);
+ print_package_listing($exact_matches, $sorts, false);
?>
- </tbody>
- </table>
</div>
<?php
}
@@ -479,37 +418,7 @@ if (count($exact_matches) > 0) {
header_and_footer();
-?>
- <table class="results">
- <thead>
- <tr>
-<?php
-
- foreach ($sorts as $get => $sort) {
- print " <th>\n";
- print " <a href=\"?";
- print substr(str_replace(
- "&sort=".$_GET["sort"]."&",
- "&",
- "&".$_SERVER["QUERY_STRING"]."&"
- ),1)."sort=";
- if ($_GET["sort"] == $get)
- print "-";
- print $get."\" title=\"Sort package by ".$sort["title"]."\">".$sort["label"]."</a>\n";
- print " </th>\n";
- }
-?>
- </tr>
- </thead>
- <tbody>
-<?php
-
- print_results($fuzzy_matches);
-
-?>
- </tbody>
- </table>
-<?php
+ print_package_listing($fuzzy_matches, $sorts, true);
header_and_footer();