From 6249c40e9417aff0ab8eb6f84c1f6693771c7b81 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 29 Jun 2004 00:56:31 +0000 Subject: fleshing out the package logic, renamed pkg include files for consistency --- web/html/pkgsearch.php | 32 ++-- web/lang/index_po.inc | 5 + web/lang/mgmnt_po.inc | 5 + web/lang/pkgfuncs_po.inc | 119 ++++++++++++++ web/lang/pkgs_po.inc | 119 -------------- web/lang/search_po.inc | 20 +++ web/lib/acctfuncs.inc | 1 + web/lib/pkgfuncs.inc | 421 +++++++++++++++++++++++++++++++++++++++++++++++ web/lib/pkgs.inc | 417 ---------------------------------------------- 9 files changed, 584 insertions(+), 555 deletions(-) create mode 100644 web/lang/pkgfuncs_po.inc delete mode 100644 web/lang/pkgs_po.inc create mode 100644 web/lib/pkgfuncs.inc delete mode 100644 web/lib/pkgs.inc (limited to 'web') diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php index 64d229bc..9ab00ca9 100644 --- a/web/html/pkgsearch.php +++ b/web/html/pkgsearch.php @@ -1,6 +1,6 @@ \n"; @@ -59,14 +58,13 @@ if (isset($_REQUEST["do_Flag"])) { # a message and give the user a link to resume where they were # in the search # - pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], - $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], - $_REQUEST["PP"]); + pkg_search_page($_COOKIE["AURSID"]); + } } elseif (isset($_REQUEST["do_Adopt"])) { - if ($atype != "User" && $atype != "") { + if ($atype == "User" || $atype == "") { print __("You do not have access to adopt packages."); print "
\n"; @@ -79,9 +77,8 @@ if (isset($_REQUEST["do_Flag"])) { # a message and give the user a link to resume where they were # in the search # - pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], - $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], - $_REQUEST["PP"]); + pkg_search_page($_COOKIE["AURSID"]); + } @@ -94,15 +91,14 @@ if (isset($_REQUEST["do_Flag"])) { # vote on the packages in $ids array. 'unvote' for any packages # listed in the $_REQUEST["All_IDs"] array. # - print "adopting
\n"; + print "voting
\n"; # After voting, show the search page again (or maybe print out # a message and give the user a link to resume where they were # in the search # - pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], - $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], - $_REQUEST["PP"]); + pkg_search_page($_COOKIE["AURSID"]); + } @@ -116,9 +112,7 @@ if (isset($_REQUEST["do_Flag"])) { } else { # do_More/do_Less/do_Search/do_MyPackages - just do a search # - pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], - $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], - $_REQUEST["PP"]); + pkg_search_page($_COOKIE["AURSID"]); } diff --git a/web/lang/index_po.inc b/web/lang/index_po.inc index d96cd67a..13c50339 100644 --- a/web/lang/index_po.inc +++ b/web/lang/index_po.inc @@ -111,4 +111,9 @@ $_t["en"]["Logged-in as: %h%s%h"] = "Logged-in as: %h%s%h"; # $_t["fr"]["Logged-in as: %h%s%h"] = "--> Traduction française ici. <--"; # $_t["de"]["Logged-in as: %h%s%h"] = "--> Deutsche Übersetzung hier. <--"; +$_t["en"]["Error looking up username, %s."] = "Error looking up username, %s."; +# $_t["es"]["Error looking up username, %s."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Error looking up username, %s."] = "--> Traduction française ici. <--"; +# $_t["de"]["Error looking up username, %s."] = "--> Deutsche Übersetzung hier. <--"; + ?> \ No newline at end of file diff --git a/web/lang/mgmnt_po.inc b/web/lang/mgmnt_po.inc index 438f50df..824ef500 100644 --- a/web/lang/mgmnt_po.inc +++ b/web/lang/mgmnt_po.inc @@ -16,4 +16,9 @@ $_t["en"]["Under construction..."] = "Under construction..."; # $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; # $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; +$_t["en"]["Manage package ID: %s"] = "Manage package ID: %s"; +# $_t["es"]["Manage package ID: %s"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Manage package ID: %s"] = "--> Traduction française ici. <--"; +# $_t["de"]["Manage package ID: %s"] = "--> Deutsche Übersetzung hier. <--"; + ?> \ No newline at end of file diff --git a/web/lang/pkgfuncs_po.inc b/web/lang/pkgfuncs_po.inc new file mode 100644 index 00000000..cd96ecbe --- /dev/null +++ b/web/lang/pkgfuncs_po.inc @@ -0,0 +1,119 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Category"] = "--> Traduction française ici. <--"; +# $_t["de"]["Category"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Maintainer"] = "Maintainer"; +# $_t["es"]["Maintainer"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Maintainer"] = "--> Traduction française ici. <--"; +# $_t["de"]["Maintainer"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Name"] = "Name"; +# $_t["es"]["Name"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Name"] = "--> Traduction française ici. <--"; +# $_t["de"]["Name"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Per page"] = "Per page"; +# $_t["es"]["Per page"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Per page"] = "--> Traduction française ici. <--"; +# $_t["de"]["Per page"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Popularity"] = "Popularity"; +# $_t["es"]["Popularity"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Popularity"] = "--> Traduction française ici. <--"; +# $_t["de"]["Popularity"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Sort by"] = "Sort by"; +# $_t["es"]["Sort by"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Sort by"] = "--> Traduction française ici. <--"; +# $_t["de"]["Sort by"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Search Criteria"] = "Search Criteria"; +# $_t["es"]["Search Criteria"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Search Criteria"] = "--> Traduction française ici. <--"; +# $_t["de"]["Search Criteria"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Location"] = "Location"; +# $_t["es"]["Location"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Location"] = "--> Traduction française ici. <--"; +# $_t["de"]["Location"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Keywords"] = "Keywords"; +# $_t["es"]["Keywords"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Keywords"] = "--> Traduction française ici. <--"; +# $_t["de"]["Keywords"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Any"] = "Any"; +# $_t["es"]["Any"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Any"] = "--> Traduction française ici. <--"; +# $_t["de"]["Any"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Votes"] = "Votes"; +# $_t["es"]["Votes"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Votes"] = "--> Traduction française ici. <--"; +# $_t["de"]["Votes"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Description"] = "Description"; +# $_t["es"]["Description"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Description"] = "--> Traduction française ici. <--"; +# $_t["de"]["Description"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["No packages matched your search criteria."] = "No packages matched your search criteria."; +# $_t["es"]["No packages matched your search criteria."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["No packages matched your search criteria."] = "--> Traduction française ici. <--"; +# $_t["de"]["No packages matched your search criteria."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["My Packages"] = "My Packages"; +# $_t["es"]["My Packages"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["My Packages"] = "--> Traduction française ici. <--"; +# $_t["de"]["My Packages"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Go"] = "Go"; +# $_t["es"]["Go"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Go"] = "--> Traduction française ici. <--"; +# $_t["de"]["Go"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Out-of-date"] = "Out-of-date"; +# $_t["es"]["Out-of-date"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Out-of-date"] = "--> Traduction française ici. <--"; +# $_t["de"]["Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Flag Out-of-date"] = "Flag Out-of-date"; +# $_t["es"]["Flag Out-of-date"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Flag Out-of-date"] = "--> Traduction française ici. <--"; +# $_t["de"]["Flag Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Actions"] = "Actions"; +# $_t["es"]["Actions"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Actions"] = "--> Traduction française ici. <--"; +# $_t["de"]["Actions"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Adopt Packages"] = "Adopt Packages"; +# $_t["es"]["Adopt Packages"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Adopt Packages"] = "--> Traduction française ici. <--"; +# $_t["de"]["Adopt Packages"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Disown Packages"] = "Disown Packages"; +# $_t["es"]["Disown Packages"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Disown Packages"] = "--> Traduction française ici. <--"; +# $_t["de"]["Disown Packages"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Vote"] = "Vote"; +# $_t["es"]["Vote"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Vote"] = "--> Traduction française ici. <--"; +# $_t["de"]["Vote"] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/pkgs_po.inc b/web/lang/pkgs_po.inc deleted file mode 100644 index cd96ecbe..00000000 --- a/web/lang/pkgs_po.inc +++ /dev/null @@ -1,119 +0,0 @@ - Traducción española aquí. <--"; -# $_t["fr"]["Category"] = "--> Traduction française ici. <--"; -# $_t["de"]["Category"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Maintainer"] = "Maintainer"; -# $_t["es"]["Maintainer"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Maintainer"] = "--> Traduction française ici. <--"; -# $_t["de"]["Maintainer"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Name"] = "Name"; -# $_t["es"]["Name"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Name"] = "--> Traduction française ici. <--"; -# $_t["de"]["Name"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Per page"] = "Per page"; -# $_t["es"]["Per page"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Per page"] = "--> Traduction française ici. <--"; -# $_t["de"]["Per page"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Popularity"] = "Popularity"; -# $_t["es"]["Popularity"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Popularity"] = "--> Traduction française ici. <--"; -# $_t["de"]["Popularity"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Sort by"] = "Sort by"; -# $_t["es"]["Sort by"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Sort by"] = "--> Traduction française ici. <--"; -# $_t["de"]["Sort by"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Search Criteria"] = "Search Criteria"; -# $_t["es"]["Search Criteria"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Search Criteria"] = "--> Traduction française ici. <--"; -# $_t["de"]["Search Criteria"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Location"] = "Location"; -# $_t["es"]["Location"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Location"] = "--> Traduction française ici. <--"; -# $_t["de"]["Location"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Keywords"] = "Keywords"; -# $_t["es"]["Keywords"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Keywords"] = "--> Traduction française ici. <--"; -# $_t["de"]["Keywords"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Any"] = "Any"; -# $_t["es"]["Any"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Any"] = "--> Traduction française ici. <--"; -# $_t["de"]["Any"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Votes"] = "Votes"; -# $_t["es"]["Votes"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Votes"] = "--> Traduction française ici. <--"; -# $_t["de"]["Votes"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Description"] = "Description"; -# $_t["es"]["Description"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Description"] = "--> Traduction française ici. <--"; -# $_t["de"]["Description"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["No packages matched your search criteria."] = "No packages matched your search criteria."; -# $_t["es"]["No packages matched your search criteria."] = "--> Traducción española aquí. <--"; -# $_t["fr"]["No packages matched your search criteria."] = "--> Traduction française ici. <--"; -# $_t["de"]["No packages matched your search criteria."] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["My Packages"] = "My Packages"; -# $_t["es"]["My Packages"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["My Packages"] = "--> Traduction française ici. <--"; -# $_t["de"]["My Packages"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Go"] = "Go"; -# $_t["es"]["Go"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Go"] = "--> Traduction française ici. <--"; -# $_t["de"]["Go"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Out-of-date"] = "Out-of-date"; -# $_t["es"]["Out-of-date"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Out-of-date"] = "--> Traduction française ici. <--"; -# $_t["de"]["Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Flag Out-of-date"] = "Flag Out-of-date"; -# $_t["es"]["Flag Out-of-date"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Flag Out-of-date"] = "--> Traduction française ici. <--"; -# $_t["de"]["Flag Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Actions"] = "Actions"; -# $_t["es"]["Actions"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Actions"] = "--> Traduction française ici. <--"; -# $_t["de"]["Actions"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Adopt Packages"] = "Adopt Packages"; -# $_t["es"]["Adopt Packages"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Adopt Packages"] = "--> Traduction française ici. <--"; -# $_t["de"]["Adopt Packages"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Disown Packages"] = "Disown Packages"; -# $_t["es"]["Disown Packages"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Disown Packages"] = "--> Traduction française ici. <--"; -# $_t["de"]["Disown Packages"] = "--> Deutsche Übersetzung hier. <--"; - -$_t["en"]["Vote"] = "Vote"; -# $_t["es"]["Vote"] = "--> Traducción española aquí. <--"; -# $_t["fr"]["Vote"] = "--> Traduction française ici. <--"; -# $_t["de"]["Vote"] = "--> Deutsche Übersetzung hier. <--"; - -?> \ No newline at end of file diff --git a/web/lang/search_po.inc b/web/lang/search_po.inc index 438f50df..01527c4c 100644 --- a/web/lang/search_po.inc +++ b/web/lang/search_po.inc @@ -16,4 +16,24 @@ $_t["en"]["Under construction..."] = "Under construction..."; # $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; # $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; +$_t["en"]["You must be logged in before you can vote for packages."] = "You must be logged in before you can vote for packages."; +# $_t["es"]["You must be logged in before you can vote for packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You must be logged in before you can vote for packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You must be logged in before you can vote for packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You do not have access to disown packages."] = "You do not have access to disown packages."; +# $_t["es"]["You do not have access to disown packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You do not have access to disown packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You do not have access to disown packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You must be logged in before you can flag packages."] = "You must be logged in before you can flag packages."; +# $_t["es"]["You must be logged in before you can flag packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You must be logged in before you can flag packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You must be logged in before you can flag packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You do not have access to adopt packages."] = "You do not have access to adopt packages."; +# $_t["es"]["You do not have access to adopt packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You do not have access to adopt packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You do not have access to adopt packages."] = "--> Deutsche Übersetzung hier. <--"; + ?> \ No newline at end of file diff --git a/web/lib/acctfuncs.inc b/web/lib/acctfuncs.inc index 9cd7fab2..d27b96f4 100644 --- a/web/lib/acctfuncs.inc +++ b/web/lib/acctfuncs.inc @@ -464,6 +464,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", } $search_vars[] = "SB"; $q.= "LIMIT ". $OFFSET . ", " . $HITS_PER_PAGE; + $result = db_query($q, $dbh); if (!$result) { print __("No results matched your search criteria."); diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc new file mode 100644 index 00000000..c8427ab8 --- /dev/null +++ b/web/lib/pkgfuncs.inc @@ -0,0 +1,421 @@ +\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " ".__("Search Criteria")."\n"; + print "
\n"; + print "\n"; + + print "\n"; + print "\n"; + + print "\n"; + + print "\n"; + + print "\n"; + + print "\n"; + + print "\n"; + + if ($SID) { + print "\n"; + } + + print "\n"; + print "
\n"; + print " ".__("Location"); + print "
\n"; + print " \n"; + print "
\n"; + print " ".__("Category"); + print "
\n"; + print " \n"; + print "
\n"; + print " ".__("Keywords"); + print "
\n"; + print " \n"; + print "
\n"; + print " ".__("Sort by"); + print "
\n"; + print " \n"; + print "
\n"; + print " ".__("Per page"); + print "
\n"; + print " \n"; + print "
 \n"; + print " \n"; + print " \n"; + print " \n"; + print "
\n"; + + print "
\n"; + print "
\n"; + print "
\n"; + + # query to pull out package info + # +# $q = "SELECT Packages.*, IF(ISNULL(PackageID), 0, COUNT(*)) AS Votes "; +# $q.= "FROM Packages LEFT JOIN PackageVotes "; +# $q.= "ON Packages.ID = PackageVotes.PackageID "; + $q = "SELECT * FROM Packages "; + $has_where = 0; + if (isset($_REQUEST["L"]) && $_REQUEST["L"]) { + $q.= "WHERE LocationID = ".mysql_escape_string($_REQUEST["L"])." "; + $has_where = 1; + } + if (isset($_REQUEST["C"]) && $_REQUEST["C"]) { + if (!$has_where) { + $q.= "WHERE CategoryID = ".mysql_escape_string($_REQUEST["C"])." "; + $has_where = 1; + } else { + $q.= "AND CategoryID = ".mysql_escape_string($_REQUEST["C"])." "; + } + } + if ($K) { + if (!$has_where) { + $q.= "WHERE (Name LIKE '".mysql_escape_string($K)."%' OR "; + $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; + $has_where = 1; + } else { + $q.= "AND (Name LIKE '".mysql_escape_string($K)."%' OR "; + $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; + } + } + if (isset($_REQUEST["M"]) && $_REQUEST["M"] && $SID) { + if ($myuid) { + if (!$has_where) { + $q.= "WHERE MaintainerUID = ".$myuid." "; + $has_where = 1; + } else { + $q.= "AND MaintainerUID = ".$myuid." "; + } + } + } + + switch (isset($_REQUEST["SB"])) { + case 'c': + $q.= "ORDER BY CategoryID ASC, Name ASC, LocationID ASC "; + break; + case 'l': + $q.= "ORDER BY LocationID ASC, Name ASC, CategoryID ASC "; + break; + case 'v': + $q.= "ORDER BY NumVotes DESC, Name ASC, CategoryID ASC "; + break; + default: + $q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC "; + break; + } + $q.= "LIMIT ".$O.", ".$PP; + + print $q."
\n"; + + $result = db_query($q, $dbh); + if (!$result) { + print __("Error retrieving package list."); + + } elseif (!mysql_num_rows($result)) { + print __("No packages matched your search criteria."); + + } else { + # TODO need an "action" table in here like on /devel? It would + # allow the visitor to flag packages out-of-date, vote, adopt/disown? + # Probably need to think about the overall UI of this - the package + # name will be a link that goes to 'details'. There should also be + # a column for 'manage/edit' + + if ($SID) { + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " ".__("Actions")."\n"; + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "\n"; + print "
"; + print ""; + print ""; + print ""; + print "
\n"; + print "
\n"; + print "
\n"; + print "
\n"; + } + + # print out package search results + # + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " Package Listing\n"; + print "
\n"; + print "\n"; + print "\n"; + if ($SID) { + print " \n"; + } + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + if ($SID) { + print " \n"; + } + print "\n"; + + for ($i=0; $row = mysql_fetch_assoc($result); $i++) { + (($i % 2) == 0) ? $c = "data1" : $c = "data2"; + print "\n"; + if ($SID) { + print " \n"; + } + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + if ($myuid == $row["MaintainerUID"] || $not_managed) { + $manage_url = "Manage"; + print " \n"; + } else { + print "\n"; + } + + print "\n"; + + } + print "
 ".__("Location")."".__("Category")."".__("Name")."".__("Votes")."".__("Description")."".__("Maintainer")."".__("Manage")."
"; + if ($row["OutOfDate"]) { + print ""; + } + print ""; + if ($i == 0) { + $all_ids = $row["ID"]; + } else { + $all_ids .= ":".$row["ID"]; + } + if ($row["OutOfDate"]) { + print ""; + } + print ""; + print $locs[$row["LocationID"]].""; + print $cats[$row["CategoryID"]].""; + $details_url = "".$row["Name"]; + $details_url.= "-".$row["Version"].""; + print $details_url.""; + print "   ".$row["NumVotes"].""; + print $row["Description"].""; + $not_managed = 0; + if (isset($devs[$row["MaintainerUID"]])) { + print $devs[$row["MaintainerUID"]]["Username"]; + } elseif (isset($tus[$row["MaintainerUID"]])) { + print $tus[$row["MaintainerUID"]]["Username"]; + } else { + print "None"; + $not_managed = 1; + } + print ""; + print $manage_url." 
\n"; + print "
\n"; + print "\n"; + + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "
"; + print " \n"; + print " "; + print " \n"; + print "
\n"; + print "
\n"; + print "
\n"; + } + print "\n"; + + return; +} + +# vim: ts=2 sw=2 noet ft=php +?> diff --git a/web/lib/pkgs.inc b/web/lib/pkgs.inc deleted file mode 100644 index 9fd70cbf..00000000 --- a/web/lib/pkgs.inc +++ /dev/null @@ -1,417 +0,0 @@ -\n"; - - print "
\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Search Criteria")."\n"; - print "
\n"; - print "\n"; - - print "\n"; - print "\n"; - - print "\n"; - - print "\n"; - - print "\n"; - - print "\n"; - - print "\n"; - - if ($SID) { - print "\n"; - } - - print "\n"; - print "
\n"; - print " ".__("Location"); - print "
\n"; - print " \n"; - print "
\n"; - print " ".__("Category"); - print "
\n"; - print " \n"; - print "
\n"; - print " ".__("Keywords"); - print "
\n"; - print " \n"; - print "
\n"; - print " ".__("Sort by"); - print "
\n"; - print " \n"; - print "
\n"; - print " ".__("Per page"); - print "
\n"; - print " \n"; - print "
 \n"; - print " \n"; - print " \n"; - print " \n"; - print "
\n"; - - print "
\n"; - print "
\n"; - print "
\n"; - - # query to pull out package info - # -# $q = "SELECT Packages.*, IF(ISNULL(PackageID), 0, COUNT(*)) AS Votes "; -# $q.= "FROM Packages LEFT JOIN PackageVotes "; -# $q.= "ON Packages.ID = PackageVotes.PackageID "; - $q = "SELECT * FROM Packages "; - $has_where = 0; - if ($L) { - $q.= "WHERE LocationID = ".intval($L)." "; - $has_where = 1; - } - if ($C) { - if (!$has_where) { - $q.= "WHERE CategoryID = ".intval($C)." "; - $has_where = 1; - } else { - $q.= "AND CategoryID = ".intval($C)." "; - } - } - if ($K) { - if (!$has_where) { - $q.= "WHERE (Name LIKE '".mysql_escape_string($K)."%' OR "; - $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; - $has_where = 1; - } else { - $q.= "AND (Name LIKE '".mysql_escape_string($K)."%' OR "; - $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; - } - } - if ($M && $SID) { - if ($myuid) { - if (!$has_where) { - $q.= "WHERE MaintainerUID = ".$myuid." "; - $has_where = 1; - } else { - $q.= "AND MaintainerUID = ".$myuid." "; - } - } - } - - switch ($SB) { - case 'c': - $q.= "ORDER BY CategoryID ASC, Name ASC, LocationID ASC "; - break; - case 'l': - $q.= "ORDER BY LocationID ASC, Name ASC, CategoryID ASC "; - break; - case 'v': - $q.= "ORDER BY NumVotes DESC, Name ASC, CategoryID ASC "; - break; - default: - $q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC "; - break; - } - $q.= "LIMIT ".$OFFSET.", ".intval($PP); - - print $q."
\n"; - - $result = db_query($q, $dbh); - if (!$result) { - print __("No packages matched your search criteria."); - - } elseif (!mysql_num_rows($result)) { - print __("No packages matched your search criteria."); - - } else { - # TODO need an "action" table in here like on /devel? It would - # allow the visitor to flag packages out-of-date, vote, adopt/disown? - # Probably need to think about the overall UI of this - the package - # name will be a link that goes to 'details'. There should also be - # a column for 'manage/edit' - - if ($SID) { - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Actions")."\n"; - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print "\n"; - print "
"; - print ""; - print ""; - print ""; - print "
\n"; - print "
\n"; - print "
\n"; - print "
\n"; - } - - # print out package search results - # - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " Package Listing\n"; - print "
\n"; - print "\n"; - print "\n"; - if ($SID) { - print " \n"; - } - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - if ($SID) { - print " \n"; - } - print "\n"; - - for ($i=0; $row = mysql_fetch_assoc($result); $i++) { - (($i % 2) == 0) ? $c = "data1" : $c = "data2"; - print "\n"; - if ($SID) { - print " \n"; - } - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - if ($myuid == $row["MaintainerUID"] || $not_managed) { - $manage_url = "Manage"; - print " \n"; - } else { - print "\n"; - } - - print "\n"; - - } - print "
 ".__("Location")."".__("Category")."".__("Name")."".__("Votes")."".__("Description")."".__("Maintainer")."".__("Manage")."
"; - if ($row["OutOfDate"]) { - print ""; - } - print ""; - if ($i == 0) { - $all_ids = $row["ID"]; - } else { - $all_ids .= ":".$row["ID"]; - } - if ($row["OutOfDate"]) { - print ""; - } - print ""; - print $locs[$row["LocationID"]].""; - print $cats[$row["CategoryID"]].""; - $details_url = "".$row["Name"]; - $details_url.= "-".$row["Version"].""; - print $details_url.""; - print "   ".$row["NumVotes"].""; - print $row["Description"].""; - $not_managed = 0; - if (isset($devs[$row["MaintainerUID"]])) { - print $devs[$row["MaintainerUID"]]["Username"]; - } elseif (isset($tus[$row["MaintainerUID"]])) { - print $tus[$row["MaintainerUID"]]["Username"]; - } else { - print "None"; - $not_managed = 1; - } - print ""; - print $manage_url." 
\n"; - print "
\n"; - print "\n"; - - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print "
"; - print " \n"; - print " "; - print " \n"; - print "
\n"; - print "
\n"; - print "
\n"; - } - print "
\n"; - - return; -} - -# vim: ts=2 sw=2 noet ft=php -?> -- cgit v1.2.3-24-g4f1b