mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
slow going - work has been insane
This commit is contained in:
parent
761ddc3ddc
commit
edabcc0beb
4 changed files with 115 additions and 37 deletions
Binary file not shown.
BIN
web/html/images/pad.gif
Normal file
BIN
web/html/images/pad.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 B |
|
@ -5,7 +5,24 @@ include("search_po.inc"); # use some form of this for i18n support
|
||||||
set_lang(); # this sets up the visitor's language
|
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
|
||||||
|
|
||||||
|
# define variables used during pkgsearch
|
||||||
|
#
|
||||||
|
$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP");
|
||||||
|
|
||||||
|
|
||||||
|
function pkgsearch_results_link() {
|
||||||
|
global $pkgsearch_vars;
|
||||||
|
|
||||||
|
print "Go back to <a href='/pkgsearch.php?";
|
||||||
|
$url_data = "do_Search=1";
|
||||||
|
while (list($k, $var) = each($pkgsearch_vars)) {
|
||||||
|
$url_data.="&".$var."=".rawurlencode(stripslashes($_REQUEST[$var]));
|
||||||
|
}
|
||||||
|
print $url_data . "'>search results</a>.<br />\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# get login privileges
|
# get login privileges
|
||||||
#
|
#
|
||||||
|
@ -35,18 +52,14 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
#
|
#
|
||||||
print "flagging<br />\n";
|
print "flagging<br />\n";
|
||||||
|
|
||||||
# After flagging, show the search page again (or maybe print out
|
pkgsearch_results_link();
|
||||||
# a message and give the user a link to resume where they were
|
|
||||||
# in the search
|
|
||||||
#
|
|
||||||
pkg_search_page($_COOKIE["AURSID"]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} elseif (isset($_REQUEST["do_Disown"])) {
|
} elseif (isset($_REQUEST["do_Disown"])) {
|
||||||
if ($atype == "User" || $atype == "") {
|
if (!$atype) {
|
||||||
print __("You do not have access to disown packages.");
|
print __("You must be logged in before you can disown packages.");
|
||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,18 +67,14 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
#
|
#
|
||||||
print "disowning<br />\n";
|
print "disowning<br />\n";
|
||||||
|
|
||||||
# After disowning, show the search page again (or maybe print out
|
pkgsearch_results_link();
|
||||||
# a message and give the user a link to resume where they were
|
|
||||||
# in the search
|
|
||||||
#
|
|
||||||
pkg_search_page($_COOKIE["AURSID"]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} elseif (isset($_REQUEST["do_Adopt"])) {
|
} elseif (isset($_REQUEST["do_Adopt"])) {
|
||||||
if ($atype == "User" || $atype == "") {
|
if (!$atype) {
|
||||||
print __("You do not have access to adopt packages.");
|
print __("You must be logged in before you can adopt packages.");
|
||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,11 +82,7 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
#
|
#
|
||||||
print "adopting<br />\n";
|
print "adopting<br />\n";
|
||||||
|
|
||||||
# After adopting, show the search page again (or maybe print out
|
pkgsearch_results_link();
|
||||||
# a message and give the user a link to resume where they were
|
|
||||||
# in the search
|
|
||||||
#
|
|
||||||
pkg_search_page($_COOKIE["AURSID"]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,20 +98,24 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
#
|
#
|
||||||
print "voting<br />\n";
|
print "voting<br />\n";
|
||||||
|
|
||||||
# After voting, show the search page again (or maybe print out
|
pkgsearch_results_link();
|
||||||
# a message and give the user a link to resume where they were
|
|
||||||
# in the search
|
|
||||||
#
|
|
||||||
pkg_search_page($_COOKIE["AURSID"]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} elseif (isset($_REQUEST["do_Details"])) {
|
} elseif (isset($_REQUEST["do_Details"])) {
|
||||||
# give a link to 'manage', and another to return to search
|
|
||||||
# results.
|
if (!isset($_REQUEST["ID"]) || !intval($_REQUEST["ID"])) {
|
||||||
#
|
print __("Error trying to retrieve package details.")."<br />\n";
|
||||||
print "details for package<br />\n";
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<br />\n";
|
||||||
|
pkgsearch_results_link();
|
||||||
|
print "</center>\n";
|
||||||
|
print "<br />\n";
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,10 +33,56 @@ function pkgLocations() {
|
||||||
return $locs;
|
return $locs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# display package details
|
||||||
|
#
|
||||||
|
function package_details($id=0) {
|
||||||
|
$q = "SELECT * FROM Packages WHERE ID = ".intval($_REQUEST["ID"]);
|
||||||
|
$dbh = db_connect();
|
||||||
|
$results = db_query($q, $dbh);
|
||||||
|
if (!$results) {
|
||||||
|
print __("Error retrieving package details.")."<br />\n";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$row = mysql_fetch_assoc($results);
|
||||||
|
if (empty($row)) {
|
||||||
|
print __("Package details could not be found.")."<br />\n";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# print out package details
|
||||||
|
#
|
||||||
|
print "<br />\n";
|
||||||
|
print "<center>\n";
|
||||||
|
print "<table cellspacing='3' class='boxSoft'>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td class='boxSoftTitle' align='right'>";
|
||||||
|
print "<span class='f3'>Package Details</span></td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td class='boxSoft'>\n";
|
||||||
|
print "<center>\n";
|
||||||
|
print "<table>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td colspan='2'><span class='f2'>NAME</span></td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
print "</center>\n";
|
||||||
|
print " </td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# display the search form in a boxSoft style
|
# display the search form in a boxSoft style
|
||||||
#
|
#
|
||||||
function pkg_search_page($SID="") {
|
function pkg_search_page($SID="") {
|
||||||
global $_REQUEST;
|
global $_REQUEST;
|
||||||
|
global $pkgsearch_vars;
|
||||||
# SID: session id cookie
|
# SID: session id cookie
|
||||||
|
|
||||||
$locs = pkgLocations();
|
$locs = pkgLocations();
|
||||||
|
@ -215,12 +261,17 @@ function pkg_search_page($SID="") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($_REQUEST["do_MyPackages"]) && $SID) {
|
if (isset($_REQUEST["do_MyPackages"]) && $SID) {
|
||||||
|
# list packages that the user is a AUR Maintainer of, or if it the
|
||||||
|
# vistior is a registered user, if they are the Maintainer.
|
||||||
|
#
|
||||||
if ($myuid) {
|
if ($myuid) {
|
||||||
if (!$has_where) {
|
if (!$has_where) {
|
||||||
$q.= "WHERE MaintainerUID = ".$myuid." ";
|
$q.= "WHERE (AURMaintainerUID = ".$myuid." OR ";
|
||||||
|
$q.= "MaintainerUID = " . $myuid.") ";
|
||||||
$has_where = 1;
|
$has_where = 1;
|
||||||
} else {
|
} else {
|
||||||
$q.= "AND MaintainerUID = ".$myuid." ";
|
$q.= "AND (AURMaintainerUID = ".$myuid." OR ";
|
||||||
|
$q.= "MaintainerUID = " . $myuid.") ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,6 +292,9 @@ function pkg_search_page($SID="") {
|
||||||
}
|
}
|
||||||
$q.= "LIMIT ".$O.", ".$PP;
|
$q.= "LIMIT ".$O.", ".$PP;
|
||||||
print $q."<br />\n";
|
print $q."<br />\n";
|
||||||
|
print "<pre>\n";
|
||||||
|
print_r($_REQUEST);
|
||||||
|
print "</pre>\n";
|
||||||
|
|
||||||
$result = db_query($q, $dbh);
|
$result = db_query($q, $dbh);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
@ -345,8 +399,18 @@ function pkg_search_page($SID="") {
|
||||||
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'>";
|
print " <td class='".$c."'><span class='f4'>";
|
||||||
$details_url = "<a href='/pkgsearch.php?do_Details=1&ID=";
|
$details_url = "<a href='/pkgsearch.php?";
|
||||||
$details_url.= $row["ID"]."'><span class='black'>".$row["Name"];
|
$url_data = "do_Details=1&ID=";
|
||||||
|
$url_data.= $row["ID"];
|
||||||
|
while (list($k, $var) = each($pkgsearch_vars)) {
|
||||||
|
# I'm never convinced how to do this encoding/decoding properly.
|
||||||
|
# php.net recommends htmlentities(urlencode(data)), but that
|
||||||
|
# doesn't work!
|
||||||
|
#
|
||||||
|
$url_data .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var]));
|
||||||
|
}
|
||||||
|
$details_url.= $url_data;
|
||||||
|
$details_url.= "'><span class='black'>".$row["Name"];
|
||||||
$details_url.= "-".$row["Version"]."</span></a>";
|
$details_url.= "-".$row["Version"]."</span></a>";
|
||||||
print $details_url."</span></td>\n";
|
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'>";
|
||||||
|
@ -355,16 +419,21 @@ function pkg_search_page($SID="") {
|
||||||
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;
|
$not_managed = 0;
|
||||||
if (isset($devs[$row["MaintainerUID"]])) {
|
if (isset($devs[$row["AURMaintainerUID"]])) {
|
||||||
print $devs[$row["MaintainerUID"]]["Username"];
|
print $devs[$row["AURMaintainerUID"]]["Username"];
|
||||||
} elseif (isset($tus[$row["MaintainerUID"]])) {
|
} elseif (isset($tus[$row["AURMaintainerUID"]])) {
|
||||||
print $tus[$row["MaintainerUID"]]["Username"];
|
print $tus[$row["AURMaintainerUID"]]["Username"];
|
||||||
} else {
|
} else {
|
||||||
print "None";
|
print "None";
|
||||||
$not_managed = 1;
|
$not_managed = 1;
|
||||||
}
|
}
|
||||||
print "</span></span></td>\n";
|
print "</span></span></td>\n";
|
||||||
if ($myuid == $row["MaintainerUID"] || $not_managed) {
|
if ($myuid == $row["AURMaintainerUID"] || $not_managed ||
|
||||||
|
($myuid == $row["MaintainerUID"] && $not_managed)) {
|
||||||
|
# Only allow TUs/Devs to manage packages, or if it is a regular
|
||||||
|
# user and the package has not been adopted by a TU/Dev, then the
|
||||||
|
# regular user (most likely the submitter) can manage it.
|
||||||
|
#
|
||||||
$manage_url = "<a href='/pkgmgmnt.php?ID=";
|
$manage_url = "<a href='/pkgmgmnt.php?ID=";
|
||||||
$manage_url.= $row["ID"]."'><span class='black'>Manage</span></a>";
|
$manage_url.= $row["ID"]."'><span class='black'>Manage</span></a>";
|
||||||
print " <td class='".$c."'><span class='f4'>";
|
print " <td class='".$c."'><span class='f4'>";
|
||||||
|
|
Loading…
Add table
Reference in a new issue