\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"; print "\n"; 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"; # 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 "; $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)."%') "; } } $q.= "GROUP BY PackageID "; 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 Votes DESC, Name ASC, CategoryID ASC "; break; default: $q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC "; break; } $q.= "LIMIT ".intval($O).", ".intval($PP); $result = db_query($q, $dbh); if (!$result) { print $q."
\n"; print __("No packages matched your search criteria."); } else { # 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"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; for ($i=0; $row = mysql_fetch_assoc($result); $i++) { (($i % 2) == 0) ? $c = "data1" : $c = "data2"; print "\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; } print "
".__("Location")."".__("Category")."".__("Name")."".__("Votes")."".__("Description")."".__("Maintainer")."
"; print $locs[$row["LocationID"]].""; print $cats[$row["CategoryID"]].""; print $row["Name"]."-".$row["Version"].""; print "   ".$row["Votes"].""; print $row["Description"].""; if (isset($devs[$row["MaintainerUID"]])) { print $devs[$row["MaintainerUID"]]["Username"]; } elseif (isset($tus[$row["MaintainerUID"]])) { print $tus[$row["MaintainerUID"]]["Username"]; } else { print "None"; } print "
\n"; print "
\n"; print "
\n"; } return; } # vim: ts=2 sw=2 noet ft=php ?>