re-working pkgsearch, NumVotes add to Packages table

This commit is contained in:
eric 2004-06-28 19:37:02 +00:00
parent efcca46f26
commit 4b80bc34ff
7 changed files with 216 additions and 112 deletions

View file

@ -110,6 +110,7 @@ CREATE TABLE Packages (
URL CHAR(255) NOT NULL DEFAULT "http://www.archlinux.org", URL CHAR(255) NOT NULL DEFAULT "http://www.archlinux.org",
Source CHAR(255) NOT NULL DEFAULT "/dev/null", Source CHAR(255) NOT NULL DEFAULT "/dev/null",
LocationID TINYINT UNSIGNED NOT NULL, LocationID TINYINT UNSIGNED NOT NULL,
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
OutOfDate TINYINT UNSIGNED DEFAULT 0, OutOfDate TINYINT UNSIGNED DEFAULT 0,
SubmittedTS BIGINT UNSIGNED NOT NULL, SubmittedTS BIGINT UNSIGNED NOT NULL,
SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0,
@ -119,6 +120,7 @@ CREATE TABLE Packages (
INDEX (CategoryID), INDEX (CategoryID),
INDEX (LocationID), INDEX (LocationID),
INDEX (OutOfDate), INDEX (OutOfDate),
INDEX (NumVotes),
INDEX (SubmitterUID), INDEX (SubmitterUID),
INDEX (MaintainerUID), INDEX (MaintainerUID),
FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION, FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,

View file

@ -15,12 +15,12 @@ DB_USER = "aur"
DB_PASS = "aur" DB_PASS = "aur"
USER_ID = 5 # Users.ID of first user USER_ID = 5 # Users.ID of first user
PKG_ID = 1 # Packages.ID of first package PKG_ID = 1 # Packages.ID of first package
MAX_USERS = 200 # how many users to 'register' MAX_USERS = 1000 # how many users to 'register'
MAX_DEVS = .1 # what percentage of MAX_USERS are Developers MAX_DEVS = .1 # what percentage of MAX_USERS are Developers
MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users
MAX_PKGS = 2500 # how many packages to load MAX_PKGS = 2500 # how many packages to load
PKG_FILES = (8, 30) # min/max number of files in a package PKG_FILES = (8, 30) # min/max number of files in a package
VOTING = (.3, .8) # percentage range for package voting VOTING = (.1, .4) # percentage range for package voting
RANDOM_PATHS = [ # random path locations for package files RANDOM_PATHS = [ # random path locations for package files
"/usr/bin", "/usr/lib", "/etc", "/etc/rc.d", "/usr/share", "/lib", "/usr/bin", "/usr/lib", "/etc", "/etc/rc.d", "/usr/share", "/lib",
"/var/spool", "/var/log", "/usr/sbin", "/opt", "/usr/X11R6/bin", "/var/spool", "/var/log", "/usr/sbin", "/opt", "/usr/X11R6/bin",
@ -299,22 +299,32 @@ if DBUG: print "."
# Cast votes # Cast votes
# #
track_votes = {}
if DBUG: print "Casting votes for packages.", if DBUG: print "Casting votes for packages.",
count = 0 count = 0
for u in user_keys: for u in user_keys:
num_votes = random.randrange(len(seen_pkgs)*VOTING[0], num_votes = random.randrange(int(len(seen_pkgs)*VOTING[0]),
len(seen_pkgs)*VOTING[1]) int(len(seen_pkgs)*VOTING[1]))
pkgvote = {} pkgvote = {}
for v in range(num_votes): for v in range(num_votes):
pkg = random.randrange(0, len(seen_pkgs)) pkg = random.randrange(0, len(seen_pkgs))
if not pkgvote.has_key(pkg): if not pkgvote.has_key(pkg):
s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg) s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg)
pkgvote[pkg] = 1 pkgvote[pkg] = 1
if not track_votes.has_key(pkg):
track_votes[pkg] = 0
track_votes[pkg] += 1
out.write(s) out.write(s)
if count % 100 == 0: if count % 100 == 0:
if DBUG: print ".", if DBUG: print ".",
count += 1 count += 1
# Update statements for package votes
#
for p in track_votes.keys():
s = "UPDATE Packages SET NumVotes = %d WHERE ID = %d;\n" % (track_votes[p], p)
out.write(s)
# close output file # close output file
# #
out.write("\n") out.write("\n")

View file

@ -25,11 +25,14 @@ if (isset($_REQUEST["user"]) || isset($_REQUEST["pass"])) {
$q.= "AND Passwd = '" . mysql_escape_string($_REQUEST["pass"]) . "'"; $q.= "AND Passwd = '" . mysql_escape_string($_REQUEST["pass"]) . "'";
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
if (!$result) { if (!$result) {
$login_error = __("Incorrect password for username, %s.", $login_error = __("Error looking up username, %s.",
array($_REQUEST["user"])); array($_REQUEST["user"]));
} else { } else {
$row = mysql_fetch_row($result); $row = mysql_fetch_row($result);
if ($row[1]) { if (empty($row)) {
$login_error = __("Incorrect password for username, %s.",
array($_REQUEST["user"]));
} elseif ($row[1]) {
$login_error = __("Your account has been suspended."); $login_error = __("Your account has been suspended.");
} }
} }

View file

@ -6,10 +6,12 @@ check_sid(); # see if they're still logged in
html_header(); # print out the HTML header html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function # vistor has requested package management for a specific package
# for i18n support. See 'testpo.php' for more details. #
print __("Manage package ID: %s", array($_REQUEST["ID"])) . "<br />\n";
# NOTE: managing an orphaned package will automatically force adoption
# #
print __("Under construction...")."<br />\n";
html_footer("\$Id$"); html_footer("\$Id$");

View file

@ -6,14 +6,6 @@ set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in check_sid(); # see if they're still logged in
html_header(); # print out the HTML header html_header(); # print out the HTML header
# TODO Maybe pkgsearch, pkgvote can be consolidated? This script can
# provide a search form. In the results, it can contain a checkbox
# for 'flag out of date', 'vote', 'details' link, and a link to 'pkgmgmnt'.
#
# the results page should have columns for,
# pkg name/ver, location, maintainer, description, O-O-D, Vote, details, mgmnt
#
# get login privileges # get login privileges
# #
@ -25,30 +17,110 @@ if (isset($_COOKIE["AURSID"])) {
$atype = ""; $atype = "";
} }
# grab the list of Package IDs to be operated on
#
isset($_REQUEST["IDs"]) ? $ids = $_REQUEST["IDs"] : $ids = array();
if ($atype && $_REQUEST["Action"] == "Something") {
# do something based on what the user specifies # determine what button the visitor clicked
#
if (isset($_REQUEST["do_Flag"])) {
if (!$atype) {
print __("You must be logged in before you can flag packages.");
print "<br />\n";
} else {
# Flag the packages in $ids array, and unflag any other
# packages listed in $_REQUEST["All_IDs"]
#
print "flagging<br />\n";
# After flagging, 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"]);
}
} elseif (isset($_REQUEST["do_Disown"])) {
if ($atype != "User" && $atype != "") {
print __("You do not have access to disown packages.");
print "<br />\n";
} else {
# Disown the packages in $ids array
#
print "disowning<br />\n";
# After disowning, 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"]);
}
} elseif (isset($_REQUEST["do_Adopt"])) {
if ($atype != "User" && $atype != "") {
print __("You do not have access to adopt packages.");
print "<br />\n";
} else {
# Adopt the packages in $ids array
#
print "adopting<br />\n";
# After adopting, 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"]);
}
} elseif (isset($_REQUEST["do_Vote"])) {
if (!$atype) {
print __("You must be logged in before you can vote for packages.");
print "<br />\n";
} else {
# vote on the packages in $ids array. 'unvote' for any packages
# listed in the $_REQUEST["All_IDs"] array.
#
print "adopting<br />\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"]);
}
} elseif (isset($_REQUEST["do_Details"])) {
# give a link to 'manage', and another to return to search
# results.
# #
print "details for package<br />\n";
} elseif ($atype && $_REQUEST["Action"] == "SomethingElse") {
# do something else based on what the user specifies
#
} elseif ($_REQUEST["Action"] == "SearchPkgs") { } else {
# the visitor has requested search options and/or hit the less/more button # do_More/do_Less/do_Search/do_MyPackages - just do a search
# #
pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"],
$_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"],
$_REQUEST["PP"]); $_REQUEST["PP"]);
} else {
# do the default thing - give the user a search form that they
# can specify: location, category, maintainer, name, 'my pkgs'
# and display a list of packages based on no search options.
#
pkg_search_page($_COOKIE["AURSID"]);
} }
html_footer("\$Id$"); html_footer("\$Id$");
?> ?>

View file

@ -296,6 +296,7 @@ function set_lang() {
$row = mysql_fetch_array($result); $row = mysql_fetch_array($result);
$LANG = $row[0]; $LANG = $row[0];
} }
$update_cookie = 1;
} else { } else {
$LANG = "en"; $LANG = "en";
} }

View file

@ -35,7 +35,8 @@ function pkgLocations() {
# display the search form in a boxSoft style # display the search form in a boxSoft style
# #
function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) { function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25,
$D="") {
# SID: session id cookie # SID: session id cookie
# L: PackageLocations.ID # L: PackageLocations.ID
# C: PackageCategories.ID # C: PackageCategories.ID
@ -44,12 +45,15 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
# M: search "my packages" # M: search "my packages"
# O: Row offset # O: Row offset
# PP: Per page # PP: Per page
# D: Direction to advance (Less/More)
$locs = pkgLocations(); $locs = pkgLocations();
$cats = pkgCategories(); $cats = pkgCategories();
$devs = getDevelopers(); $devs = getDevelopers();
$tus = getTrustedUsers(); $tus = getTrustedUsers();
$dbh = db_connect(); $dbh = db_connect();
if (!$PP) {$PP = 25;}
if ($O) { if ($O) {
$OFFSET = intval($O); $OFFSET = intval($O);
} else { } else {
@ -68,6 +72,17 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
# The search form # The search form
# #
print "SID=$SID, L=$L, C=$C, K=$K, SB=$SB, M=$M, O=$O, PP=$PP<br />\n";
print "<form action='/pkgsearch.php' method='post'>\n";
print "<input type='hidden' name='O' value='".($OFFSET+intval($PP))."'>\n";
print "<input type='hidden' name='L' value='".$L."'>\n";
print "<input type='hidden' name='M' value='".$M."'>\n";
print "<input type='hidden' name='C' value='".$C."'>\n";
print "<input type='hidden' name='K' value='".$K."'>\n";
print "<input type='hidden' name='SB' value='".$SB."'>\n";
print "<input type='hidden' name='PP' value='".$PP."'>\n";
print "<center>\n"; print "<center>\n";
print "<table cellspacing='3' class='boxSoft'>\n"; print "<table cellspacing='3' class='boxSoft'>\n";
print "<tr>\n"; print "<tr>\n";
@ -77,8 +92,6 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print "</tr>\n"; print "</tr>\n";
print "<tr>\n"; print "<tr>\n";
print " <td class='boxSoft'>\n"; print " <td class='boxSoft'>\n";
print "<form action='/pkgsearch.php' method='post'>\n";
print "<input type='hidden' name='Action' value='SearchPkgs'>\n";
print "<table style='width: 100%' align='center'>\n"; print "<table style='width: 100%' align='center'>\n";
print "<tr>\n"; print "<tr>\n";
@ -154,12 +167,13 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print "</td>\n"; print "</td>\n";
print "<td align='right' valign='bottom'>&nbsp;\n"; print "<td align='right' valign='bottom'>&nbsp;\n";
print " <input type='submit' class='button' value='".__("Go")."'>\n"; print " <input type='submit' class='button' name='do_Search'";
print " value='".__("Go")."'>\n";
print "</td>\n"; print "</td>\n";
if ($SID) { if ($SID) {
print "<td align='right' valign='bottom'>&nbsp;\n"; print "<td align='right' valign='bottom'>&nbsp;\n";
print " <input type='submit' class='button' name='M'"; print " <input type='submit' class='button' name='do_MyPackages'";
print " value='".__("My Packages")."'>\n"; print " value='".__("My Packages")."'>\n";
print "</td>\n"; print "</td>\n";
} }
@ -167,61 +181,18 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print "</tr>\n"; print "</tr>\n";
print "</table>\n"; print "</table>\n";
print "</form>\n";
print " </td>\n"; print " </td>\n";
print "</tr>\n"; print "</tr>\n";
print "</table>\n"; print "</table>\n";
print "</center>\n"; print "</center>\n";
print "<br />\n"; print "<br />\n";
# 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 "<center>\n";
print "<form action='/pkgsearch.php' method='post'>\n";
print "<table cellspacing='3' class='boxSoft'>\n";
print "<tr>\n";
print " <td class='boxSoftTitle' align='right'>\n";
print " <span class='f3'>".__("Actions")."</span>\n";
print " </td>\n";
print "</tr>\n";
print "<tr>\n";
print " <td class='boxSoft'>\n";
print "<input type='hidden' name='Action' value='DoSomething'>\n";
print "<table style='width: 100%' align='center'>\n";
print "<tr>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Flag'";
print " value='".__("Flag Out-of-date")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Disown'";
print " value='".__("Disown Packages")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Adopt'";
print " value='".__("Adopt Packages")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Vote'";
print " value='".__("Vote")."'></td>\n";
print "</tr>\n";
print "</table>\n";
print " </td>\n";
print "</tr>\n";
print "</table>\n";
print "</form>\n";
print "</center>\n";
print "<br />\n";
}
# query to pull out package info # query to pull out package info
# #
$q = "SELECT Packages.*, IF(ISNULL(PackageID), 0, COUNT(*)) AS Votes "; # $q = "SELECT Packages.*, IF(ISNULL(PackageID), 0, COUNT(*)) AS Votes ";
$q.= "FROM Packages LEFT JOIN PackageVotes "; # $q.= "FROM Packages LEFT JOIN PackageVotes ";
$q.= "ON Packages.ID = PackageVotes.PackageID "; # $q.= "ON Packages.ID = PackageVotes.PackageID ";
$q = "SELECT * FROM Packages ";
$has_where = 0; $has_where = 0;
if ($L) { if ($L) {
$q.= "WHERE LocationID = ".intval($L)." "; $q.= "WHERE LocationID = ".intval($L)." ";
@ -256,7 +227,6 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
} }
} }
$q.= "GROUP BY PackageID ";
switch ($SB) { switch ($SB) {
case 'c': case 'c':
$q.= "ORDER BY CategoryID ASC, Name ASC, LocationID ASC "; $q.= "ORDER BY CategoryID ASC, Name ASC, LocationID ASC ";
@ -265,7 +235,7 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
$q.= "ORDER BY LocationID ASC, Name ASC, CategoryID ASC "; $q.= "ORDER BY LocationID ASC, Name ASC, CategoryID ASC ";
break; break;
case 'v': case 'v':
$q.= "ORDER BY Votes DESC, Name ASC, CategoryID ASC "; $q.= "ORDER BY NumVotes DESC, Name ASC, CategoryID ASC ";
break; break;
default: default:
$q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC "; $q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC ";
@ -273,6 +243,8 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
} }
$q.= "LIMIT ".$OFFSET.", ".intval($PP); $q.= "LIMIT ".$OFFSET.", ".intval($PP);
print $q."<br />\n";
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
if (!$result) { if (!$result) {
print __("No packages matched your search criteria."); print __("No packages matched your search criteria.");
@ -281,6 +253,45 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print __("No packages matched your search criteria."); print __("No packages matched your search criteria.");
} else { } 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 "<center>\n";
print "<table cellspacing='3' class='boxSoft'>\n";
print "<tr>\n";
print " <td class='boxSoftTitle' align='right'>\n";
print " <span class='f3'>".__("Actions")."</span>\n";
print " </td>\n";
print "</tr>\n";
print "<tr>\n";
print " <td class='boxSoft'>\n";
print "<table style='width: 100%' align='center'>\n";
print "<tr>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Flag'";
print " value='".__("Flag Out-of-date")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Adopt'";
print " value='".__("Adopt Packages")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Disown'";
print " value='".__("Disown Packages")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Vote'";
print " value='".__("Vote")."'></td>\n";
print "</tr>\n";
print "</table>\n";
print " </td>\n";
print "</tr>\n";
print "</table>\n";
print "</center>\n";
print "<br />\n";
}
# print out package search results # print out package search results
# #
print "<center>\n"; print "<center>\n";
@ -310,6 +321,10 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print " bottom'><span class='f2'>".__("Description")."</span></th>\n"; print " bottom'><span class='f2'>".__("Description")."</span></th>\n";
print " <th style='border-bottom: #666 1px solid; vertical-align:"; print " <th style='border-bottom: #666 1px solid; vertical-align:";
print " bottom'><span class='f2'>".__("Maintainer")."</span></th>\n"; print " bottom'><span class='f2'>".__("Maintainer")."</span></th>\n";
if ($SID) {
print " <th style='border-bottom: #666 1px solid; vertical-align:";
print " bottom'><span class='f2'>".__("Manage")."</span></th>\n";
}
print "</tr>\n"; print "</tr>\n";
for ($i=0; $row = mysql_fetch_assoc($result); $i++) { for ($i=0; $row = mysql_fetch_assoc($result); $i++) {
@ -320,7 +335,12 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
if ($row["OutOfDate"]) { if ($row["OutOfDate"]) {
print "<span style='background-color: red'>"; print "<span style='background-color: red'>";
} }
print "<input type='checkbox' name='PIDs[]' value='".$row["ID"]."'>"; print "<input type='checkbox' name='IDs[]' value='".$row["ID"]."'>";
if ($i == 0) {
$all_ids = $row["ID"];
} else {
$all_ids .= ":".$row["ID"];
}
if ($row["OutOfDate"]) { if ($row["OutOfDate"]) {
print "</span>"; print "</span>";
} }
@ -330,21 +350,34 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print $locs[$row["LocationID"]]."</span></span></td>\n"; print $locs[$row["LocationID"]]."</span></span></td>\n";
print " <td class='".$c."'><span class='f5'><span class='blue'>"; print " <td class='".$c."'><span class='f5'><span class='blue'>";
print $cats[$row["CategoryID"]]."</span></span></td>\n"; print $cats[$row["CategoryID"]]."</span></span></td>\n";
print " <td class='".$c."'><span class='f4'><span class='blue'>"; print " <td class='".$c."'><span class='f4'>";
print $row["Name"]."-".$row["Version"]."</span></span></td>\n"; $details_url = "<a href='/pkgsearch.php?do_Details=1&ID=";
$details_url.= $row["ID"]."'><span class='black'>".$row["Name"];
$details_url.= "-".$row["Version"]."</span></a>";
print $details_url."</span></td>\n";
print " <td class='".$c."'><span class='f5'><span class='blue'>"; print " <td class='".$c."'><span class='f5'><span class='blue'>";
print "&nbsp;&nbsp;&nbsp;".$row["Votes"]."</span></span></td>\n"; print "&nbsp;&nbsp;&nbsp;".$row["NumVotes"]."</span></span></td>\n";
print " <td class='".$c."'><span class='f4'><span class='blue'>"; print " <td class='".$c."'><span class='f4'><span class='blue'>";
print $row["Description"]."</span></span></td>\n"; print $row["Description"]."</span></span></td>\n";
print " <td class='".$c."'><span class='f5'><span class='blue'>"; print " <td class='".$c."'><span class='f5'><span class='blue'>";
$not_managed = 0;
if (isset($devs[$row["MaintainerUID"]])) { if (isset($devs[$row["MaintainerUID"]])) {
print $devs[$row["MaintainerUID"]]["Username"]; print $devs[$row["MaintainerUID"]]["Username"];
} elseif (isset($tus[$row["MaintainerUID"]])) { } elseif (isset($tus[$row["MaintainerUID"]])) {
print $tus[$row["MaintainerUID"]]["Username"]; print $tus[$row["MaintainerUID"]]["Username"];
} else { } else {
print "None"; print "None";
$not_managed = 1;
} }
print "</span></span></td>\n"; print "</span></span></td>\n";
if ($myuid == $row["MaintainerUID"] || $not_managed) {
$manage_url = "<a href='/pkgmgmnt.php?ID=";
$manage_url.= $row["ID"]."'><span class='black'>Manage</span></a>";
print " <td class='".$c."'><span class='f4'>";
print $manage_url."</span></td>\n";
} else {
print "<td class='".$c."'><span class='f4'>&nbsp;</span></td>\n";
}
print "</tr>\n"; print "</tr>\n";
@ -353,40 +386,20 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print " </td>\n"; print " </td>\n";
print "</tr>\n"; print "</tr>\n";
print "</table>\n"; print "</table>\n";
print "<input type='hidden' name='All_IDs' value='".$all_ids."'>\n";
print "<br />\n";
print "<table width='90%' cellspacing='0' cellpadding='2'>\n"; print "<table width='90%' cellspacing='0' cellpadding='2'>\n";
print "<tr>\n"; print "<tr>\n";
print " <td>\n"; print " <td>\n";
print " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n"; print " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
print " <tr>\n"; print " <tr>\n";
print " <td align='left'>"; print " <td align='left'>";
print " <form action='/pkgsearch.php' method='post'>\n"; print " <input type='submit' class='button' name='do_Less'";
print " <input type='hidden' name='Action' value='SearchPkgs'>\n";
print " <input type='hidden' name='O' value='".($OFFSET-intval($PP))."'>\n";
print " <input type='hidden' name='L' value='".$L."'>\n";
print " <input type='hidden' name='M' value='".$M."'>\n";
print " <input type='hidden' name='C' value='".$C."'>\n";
print " <input type='hidden' name='K' value='".$K."'>\n";
print " <input type='hidden' name='SB' value='".$SB."'>\n";
print " <input type='hidden' name='PP' value='".$PP."'>\n";
print " <input type='submit' class='button'";
print " value='&lt;-- ".__("Less")."'>\n"; print " value='&lt;-- ".__("Less")."'>\n";
print " </form>\n";
print " </td>\n"; print " </td>\n";
print " <td align='right'>"; print " <td align='right'>";
print " <form action='/pkgsearch.php' method='post'>\n"; print " <input type='submit' class='button' name='do_More'";
print " <input type='hidden' name='Action' value='SearchPkgs'>\n";
print " <input type='hidden' name='O' value='".($OFFSET+intval($PP))."'>\n";
print " <input type='hidden' name='L' value='".$L."'>\n";
print " <input type='hidden' name='M' value='".$M."'>\n";
print " <input type='hidden' name='C' value='".$C."'>\n";
print " <input type='hidden' name='K' value='".$K."'>\n";
print " <input type='hidden' name='SB' value='".$SB."'>\n";
print " <input type='hidden' name='PP' value='".$PP."'>\n";
print " <input type='submit' class='button'";
print " value='".__("More")." --&gt;'>\n"; print " value='".__("More")." --&gt;'>\n";
print " </form>\n";
print " </td>\n"; print " </td>\n";
print " </tr>\n"; print " </tr>\n";
print " </table>\n"; print " </table>\n";
@ -395,6 +408,7 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
print "</table>\n"; print "</table>\n";
print "</center>\n"; print "</center>\n";
} }
print "</form>\n";
return; return;
} }