fixed multiple maintainer mess

This commit is contained in:
pjmattal 2005-04-06 03:25:28 +00:00
parent 71b5b9e6b7
commit 20c02507ab
3 changed files with 49 additions and 28 deletions

View file

@ -133,14 +133,16 @@ if (isset($_REQUEST["do_Flag"])) {
$disown .= ", ".$pid; $disown .= ", ".$pid;
} }
} }
if ($atype == "Trusted User" || $atype == "Developer") { # Removed for now since we will have 1 maintainer
$field = "AURMaintainerUID"; # PJM - 5 April 2005
} elseif ($atype == "User") { # if ($atype == "Trusted User" || $atype == "Developer") {
# $field = "AURMaintainerUID";
# } elseif ($atype == "User") {
# $field = "MaintainerUID";
# } else {
# $field = "";
# }
$field = "MaintainerUID"; $field = "MaintainerUID";
} else {
$field = "";
}
if ($field) { if ($field) {
$q = "UPDATE Packages "; $q = "UPDATE Packages ";
$q.= "SET ".$field." = 0 "; $q.= "SET ".$field." = 0 ";
@ -184,13 +186,14 @@ if (isset($_REQUEST["do_Flag"])) {
$delete .= ", ".$pid; $delete .= ", ".$pid;
} }
} }
if ($atype == "Trusted User" || $atype == "Developer") { # if ($atype == "Trusted User" || $atype == "Developer") {
$field = "AURMaintainerUID"; # $field = "AURMaintainerUID";
} elseif ($atype == "User") { # } elseif ($atype == "User") {
# $field = "MaintainerUID";
# } else {
# $field = "";
# }
$field = "MaintainerUID"; $field = "MaintainerUID";
} else {
$field = "";
}
if ($field) { if ($field) {
# Only grab Unsupported packages that "we" own or are not owned at all # Only grab Unsupported packages that "we" own or are not owned at all
# #
@ -199,7 +202,7 @@ if (isset($_REQUEST["do_Flag"])) {
$q.= "WHERE Packages.ID IN (" . $delete . ") "; $q.= "WHERE Packages.ID IN (" . $delete . ") ";
$q.= "AND Packages.LocationID = PackageLocations.ID "; $q.= "AND Packages.LocationID = PackageLocations.ID ";
$q.= "AND PackageLocations.Location = 'unsupported' "; $q.= "AND PackageLocations.Location = 'unsupported' ";
$q.= "AND AURMaintainerUID IN (0, " . uid_from_sid($_COOKIE["AURSID"]) . ")"; $q.= "AND $field IN (0, " . uid_from_sid($_COOKIE["AURSID"]) . ")";
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
if ($result != Null && mysql_num_rows($result) > 0) { if ($result != Null && mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) { while ($row = mysql_fetch_assoc($result)) {
@ -280,14 +283,14 @@ if (isset($_REQUEST["do_Flag"])) {
$adopt .= ", ".$pid; $adopt .= ", ".$pid;
} }
} }
if ($atype == "Trusted User" || $atype == "Developer") { # if ($atype == "Trusted User" || $atype == "Developer") {
$field = "AURMaintainerUID"; # $field = "AURMaintainerUID";
} elseif ($atype == "User") { # } elseif ($atype == "User") {
#$field = "MaintainerUID";
#} else {
# $field = "";
# }
$field = "MaintainerUID"; $field = "MaintainerUID";
} else {
$field = "";
}
if ($field) { if ($field) {
# NOTE: Only "orphaned" packages can be adopted at a particular # NOTE: Only "orphaned" packages can be adopted at a particular
# user class (TU/Dev or User). # user class (TU/Dev or User).

View file

@ -56,6 +56,20 @@ function getDevelopers() {
return $devs; return $devs;
} }
# return an array of info for each user
function getUsers() {
$users = array();
$dbh = db_connect();
$q = "SELECT * FROM Users ORDER BY Username ASC";
$result = db_query($q, $dbh);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$users[$row["ID"]] = $row;
}
}
return $users;
}
# see if the visitor is already logged in # see if the visitor is already logged in
# #
function check_sid() { function check_sid() {

View file

@ -444,6 +444,7 @@ function pkg_search_page($SID="") {
$cats = pkgCategories(); $cats = pkgCategories();
$devs = getDevelopers(); $devs = getDevelopers();
$tus = getTrustedUsers(); $tus = getTrustedUsers();
$users = getUsers();
$dbh = db_connect(); $dbh = db_connect();
@ -827,10 +828,13 @@ function pkg_search_page($SID="") {
# print the package manager, also determine if it is managed # print the package manager, also determine if it is managed
# #
$managed = 1; $managed = 1;
if (isset($devs[$row["AURMaintainerUID"]])) { # if (isset($devs[$row["AURMaintainerUID"]])) {
print $devs[$row["AURMaintainerUID"]]["Username"]; # print $devs[$row["AURMaintainerUID"]]["Username"];
} elseif (isset($tus[$row["MaintainerUID"]])) { # } else
print $tus[$row["MaintainerUID"]]["Username"]; # if (isset($tus[$row["MaintainerUID"]])) {
# print $tus[$row["MaintainerUID"]]["Username"];
if (isset($users[$row["MaintainerUID"]])) {
print $users[$row["MaintainerUID"]]["Username"];
} else { } else {
print __("None"); print __("None");
$managed = 0; $managed = 0;