include_once("pkgs_po.inc");
# grab the current list of PackageCategories
#
function pkgCategories() {
$cats = array();
$dbh = db_connect();
$q = "SELECT * FROM PackageCategories ";
$q.= "ORDER BY Category ASC";
$result = db_query($q, $dbh);
if ($result) {
while ($row = mysql_fetch_row($result)) {
$cats[$row[0]] = $row[1];
}
}
return $cats;
}
# grab the current list of PackageLocations
#
function pkgLocations() {
$locs = array();
$dbh = db_connect();
$q = "SELECT * FROM PackageLocations ";
$q.= "ORDER BY Location ASC";
$result = db_query($q, $dbh);
if ($result) {
while ($row = mysql_fetch_row($result)) {
$locs[$row[0]] = $row[1];
}
}
return $locs;
}
# display the search form in a boxSoft style
#
function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25,
$D="") {
# SID: session id cookie
# L: PackageLocations.ID
# C: PackageCategories.ID
# K: Keywords
# SB: Sort by
# M: search "my packages"
# O: Row offset
# PP: Per page
# D: Direction to advance (Less/More)
$locs = pkgLocations();
$cats = pkgCategories();
$devs = getDevelopers();
$tus = getTrustedUsers();
$dbh = db_connect();
if (!$PP) {$PP = 25;}
if ($O) {
$OFFSET = intval($O);
} else {
$OFFSET = 0;
}
if ($OFFSET < 0) {
$OFFSET = 0;
}
# grab info for user if they're logged in
#
if ($SID) {
$myuid = uid_from_sid($SID);
$acct = account_from_sid($SID);
}
# The search form
#
print "SID=$SID, L=$L, C=$C, K=$K, SB=$SB, M=$M, O=$O, PP=$PP
\n";
print "