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

@ -25,11 +25,14 @@ if (isset($_REQUEST["user"]) || isset($_REQUEST["pass"])) {
$q.= "AND Passwd = '" . mysql_escape_string($_REQUEST["pass"]) . "'";
$result = db_query($q, $dbh);
if (!$result) {
$login_error = __("Incorrect password for username, %s.",
$login_error = __("Error looking up username, %s.",
array($_REQUEST["user"]));
} else {
$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.");
}
}

View file

@ -6,10 +6,12 @@ check_sid(); # see if they're still logged in
html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function
# for i18n support. See 'testpo.php' for more details.
# vistor has requested package management for a specific package
#
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$");

View file

@ -6,14 +6,6 @@ set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
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
#
@ -25,30 +17,110 @@ if (isset($_COOKIE["AURSID"])) {
$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") {
# the visitor has requested search options and/or hit the less/more button
} 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"]);
} 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$");
?>