From e5c0107d8c0dca4bdbbfa6fa26c2ef4d8997be6a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 18 Feb 2019 14:28:52 +0100 Subject: lib/style.php,packages/index.php: move displaying part of package listing to a separate function in a separate file --- packages/index.php | 125 ++++++++--------------------------------------------- 1 file changed, 17 insertions(+), 108 deletions(-) (limited to 'packages') 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 " \n"; - print " \n"; - print " " . $row["arch"] . "\n"; - print " \n"; - print " \n"; - print " " . $row["repo"] . "\n"; - print " \n"; - print " \n"; - print " " . $row["pkgname"] . "\n"; - print " \n"; - print " \n"; - print " " . $row["version"] . "\n"; - print " \n"; - print " \n"; - print " "; - if ($row["has_issues"]) - print "has open bug reports"; - else - print " "; - print "\n"; - print " \n"; - print " \n"; - print " "; - if (isset($row["build_date"])) - print $row["build_date"]; - else - print " "; - print "\n"; - print " \n"; - print " \n"; - print " "; - if (isset($row["move_date"])) - print $row["move_date"]; - else - print " "; - print "\n"; - print " \n"; - print " \n"; - print " "; - if ($row["is_to_be_deleted"]) - print "to be deleted"; - else - print " "; - print "\n"; - print " \n"; - print " \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) {

exact match found.

- - - - $sort) { - print " \n"; - } -?> - - - - -
\n"; - print " ".$sort["label"]."\n"; - print "
0) { header_and_footer(); -?> - - - - $sort) { - print " \n"; - } -?> - - - - - -
\n"; - print " ".$sort["label"]."\n"; - print "
-