summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric <eric>2004-07-02 12:47:16 +0000
committereric <eric>2004-07-02 12:47:16 +0000
commitae26c9ce2a0bfe6ed0f5282f08cb672364de1c19 (patch)
tree875d35581e9b9a5ed0bb309aaf524ee69cf0d9fd
parent23589299786ac249ed16feb28a83f3e3da3d2829 (diff)
downloadaurweb-ae26c9ce2a0bfe6ed0f5282f08cb672364de1c19.tar.xz
baby steps
-rw-r--r--web/html/logout.php1
-rw-r--r--web/html/pkgsearch.php15
-rw-r--r--web/lang/pkgfuncs_po.inc25
-rw-r--r--web/lang/search_po.inc15
-rw-r--r--web/lib/aur.inc3
-rw-r--r--web/lib/pkgfuncs.inc109
6 files changed, 123 insertions, 45 deletions
diff --git a/web/html/logout.php b/web/html/logout.php
index a25da7c..26d6166 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -12,6 +12,7 @@ if (isset($_COOKIE["AURSID"])) {
$dbh = db_connect();
db_query($q, $dbh);
setcookie("AURSID", "", time() - (60*60*24*30), "/");
+ setcookie("AURLANG", "", time() - (60*60*24*30), "/");
}
html_header(); # print out the HTML header
diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php
index 445e776..6524b51 100644
--- a/web/html/pkgsearch.php
+++ b/web/html/pkgsearch.php
@@ -8,22 +8,9 @@ html_header(); # print out the HTML header
# define variables used during pkgsearch
#
-$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP");
+$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP", "do_MyPackages");
-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
#
if (isset($_COOKIE["AURSID"])) {
diff --git a/web/lang/pkgfuncs_po.inc b/web/lang/pkgfuncs_po.inc
index cd96ecb..72a239b 100644
--- a/web/lang/pkgfuncs_po.inc
+++ b/web/lang/pkgfuncs_po.inc
@@ -116,4 +116,29 @@ $_t["en"]["Vote"] = "Vote";
# $_t["fr"]["Vote"] = "--> Traduction française ici. <--";
# $_t["de"]["Vote"] = "--> Deutsche Übersetzung hier. <--";
+$_t["en"]["Error retrieving package details."] = "Error retrieving package details.";
+# $_t["es"]["Error retrieving package details."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Error retrieving package details."] = "--> Traduction française ici. <--";
+# $_t["de"]["Error retrieving package details."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["Package details could not be found."] = "Package details could not be found.";
+# $_t["es"]["Package details could not be found."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Package details could not be found."] = "--> Traduction française ici. <--";
+# $_t["de"]["Package details could not be found."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["Error retrieving package list."] = "Error retrieving package list.";
+# $_t["es"]["Error retrieving package list."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Error retrieving package list."] = "--> Traduction française ici. <--";
+# $_t["de"]["Error retrieving package list."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["Go back to %hsearch results%h."] = "Go back to %hsearch results%h.";
+# $_t["es"]["Go back to %hsearch results%h."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Go back to %hsearch results%h."] = "--> Traduction française ici. <--";
+# $_t["de"]["Go back to %hsearch results%h."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["Manage"] = "Manage";
+# $_t["es"]["Manage"] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Manage"] = "--> Traduction française ici. <--";
+# $_t["de"]["Manage"] = "--> Deutsche Übersetzung hier. <--";
+
?> \ No newline at end of file
diff --git a/web/lang/search_po.inc b/web/lang/search_po.inc
index 01527c4..6714b85 100644
--- a/web/lang/search_po.inc
+++ b/web/lang/search_po.inc
@@ -36,4 +36,19 @@ $_t["en"]["You do not have access to adopt packages."] = "You do not have access
# $_t["fr"]["You do not have access to adopt packages."] = "--> Traduction française ici. <--";
# $_t["de"]["You do not have access to adopt packages."] = "--> Deutsche Übersetzung hier. <--";
+$_t["en"]["You must be logged in before you can disown packages."] = "You must be logged in before you can disown packages.";
+# $_t["es"]["You must be logged in before you can disown packages."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["You must be logged in before you can disown packages."] = "--> Traduction française ici. <--";
+# $_t["de"]["You must be logged in before you can disown packages."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["Error trying to retrieve package details."] = "Error trying to retrieve package details.";
+# $_t["es"]["Error trying to retrieve package details."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["Error trying to retrieve package details."] = "--> Traduction française ici. <--";
+# $_t["de"]["Error trying to retrieve package details."] = "--> Deutsche Übersetzung hier. <--";
+
+$_t["en"]["You must be logged in before you can adopt packages."] = "You must be logged in before you can adopt packages.";
+# $_t["es"]["You must be logged in before you can adopt packages."] = "--> Traducción española aquí. <--";
+# $_t["fr"]["You must be logged in before you can adopt packages."] = "--> Traduction française ici. <--";
+# $_t["de"]["You must be logged in before you can adopt packages."] = "--> Deutsche Übersetzung hier. <--";
+
?> \ No newline at end of file
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index bdec643..26e538a 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -365,7 +365,8 @@ function html_header() {
# XXX Can I scale a PNG like this?
#
- print "<img src='/images/AUR-logo-80.png' width='85' height='45' border='0' /></a></td>\n";
+ print "<img src='/images/AUR-logo-80.png' width='85' height='45' ";
+ print "alt='AUR' border='0' /></a></td>\n";
print " <td class='headerDisplay' valign='top' align='right'>";
print "<span class='preHeader'>ArchLinux User-community Repository</span><br />";
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 15dd2d6..ae30657 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -1,6 +1,49 @@
<?
include_once("pkgfuncs_po.inc");
+# print out the 'return to search results' link
+#
+function pkgsearch_results_link() {
+ global $pkgsearch_vars;
+
+ $url_data = "<a href='/pkgsearch.php?do_Search=1";
+ while (list($k, $var) = each($pkgsearch_vars)) {
+ if ($var == "do_MyPackages") {
+ $url_data.="&".$var."=1";
+ } else {
+ $url_data.="&".$var."=".rawurlencode(stripslashes($_REQUEST[$var]));
+ }
+ }
+ $url_data .= "'>";
+ print __("Go back to %hsearch results%h.",
+ array($url_data, "</a>"));
+
+ return;
+}
+
+
+# see if this Users.ID can manage the package
+#
+function canManagePackage($uid=0,$AURMUID=0, $MUID=0, $SUID=0, $managed=0) {
+ if (!$uid) {return 0;}
+
+ # The uid of the TU/Dev that manages the package
+ #
+ if ($uid == $AURMUID) {return 1;}
+
+ # If the package isn't maintained by a TU/Dev, is this the user-maintainer?
+ #
+ if ($uid == $MUID && !$managed) {return 1;}
+
+ # If the package isn't maintained by a TU/Dev, is this the user-submitter?
+ #
+ if ($uid == $SUID && !$managed) {return 1;}
+
+ # otherwise, no right to manage this package
+ #
+ return 0;
+}
+
# grab the current list of PackageCategories
#
function pkgCategories() {
@@ -197,21 +240,22 @@ function pkg_search_page($SID="") {
# determine paging variables
#
- isset($_REQUEST["PP"]) ? $PP = intval($_REQUEST["PP"]) : $PP = 25;
+ $_REQUEST["PP"] ? $PP = intval($_REQUEST["PP"]) : $PP = 25;
if ($PP < 25) {$PP = 25;}
if ($PP > 100) {$PP = 100;}
- isset($_REQUEST["O"]) ? $O = intval($_REQUEST["O"]) : $O = 0;
- if (isset($_REQUEST["do_More"])) {
+ $_REQUEST["O"] ? $O = intval($_REQUEST["O"]) : $O = 0;
+ if ($_REQUEST["do_More"]) {
$O += $PP;
- } elseif (isset($_REQUEST["do_Less"])) {
+ } elseif ($_REQUEST["do_Less"]) {
$O -= $PP;
}
if ($O < 0) {
$O = 0;
}
- if (isset($_REQUEST["do_Search"]) || isset($_REQUEST["do_MyPackages"])) {
+ if ($_REQUEST["do_Search"]) {
# reset the offset to zero if they hit Go/My Packages
#
+ $_REQUEST["do_MyPackages"] = 0;
$O = 0;
}
@@ -341,11 +385,11 @@ function pkg_search_page($SID="") {
# $q.= "ON Packages.ID = PackageVotes.PackageID ";
$q = "SELECT * FROM Packages ";
$has_where = 0;
- if (isset($_REQUEST["L"]) && intval($_REQUEST["L"])) {
+ if (intval($_REQUEST["L"])) {
$q.= "WHERE LocationID = ".intval($_REQUEST["L"])." ";
$has_where = 1;
}
- if (isset($_REQUEST["C"]) && intval($_REQUEST["C"])) {
+ if (intval($_REQUEST["C"])) {
if (!$has_where) {
$q.= "WHERE CategoryID = ".intval($_REQUEST["C"])." ";
$has_where = 1;
@@ -363,18 +407,18 @@ function pkg_search_page($SID="") {
$q.= "Description LIKE '%".mysql_escape_string($K)."%') ";
}
}
- if (isset($_REQUEST["do_MyPackages"]) && $SID) {
+ if ($_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 (!$has_where) {
$q.= "WHERE (AURMaintainerUID = ".$myuid." OR ";
- $q.= "MaintainerUID = " . $myuid.") ";
+ $q.= "MaintainerUID = ".$myuid." OR SubmitterUID = ".$myuid.") ";
$has_where = 1;
} else {
$q.= "AND (AURMaintainerUID = ".$myuid." OR ";
- $q.= "MaintainerUID = " . $myuid.") ";
+ $q.= "MaintainerUID = ".$myuid." OR SubmitterUID = ".$myuid.") ";
}
}
}
@@ -394,10 +438,10 @@ function pkg_search_page($SID="") {
break;
}
$q.= "LIMIT ".$O.", ".$PP;
- #print $q."<br />\n";
- #print "<pre>\n";
- #print_r($_REQUEST);
- #print "</pre>\n";
+ print $q."<br />\n";
+ print "<pre>\n";
+ print_r($_REQUEST);
+ print "</pre>\n";
$result = db_query($q, $dbh);
if (!$result) {
@@ -502,41 +546,43 @@ function pkg_search_page($SID="") {
print " <td class='".$c."'><span class='f5'><span class='blue'>";
print $cats[$row["CategoryID"]]."</span></span></td>\n";
print " <td class='".$c."'><span class='f4'>";
- $details_url = "<a href='/pkgsearch.php?";
- $url_data = "do_Details=1&ID=";
- $url_data.= $row["ID"];
+ $url = "<a href='/pkgsearch.php?";
+ $url .= "do_Details=1&ID=";
+ $url .= $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]));
+ $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var]));
}
- $details_url.= $url_data;
- $details_url.= "'><span class='black'>".$row["Name"];
- $details_url.= "-".$row["Version"]."</span></a>";
- print $details_url."</span></td>\n";
+ reset($pkgsearch_vars);
+ $url.= "'><span class='black'>".$row["Name"];
+ $url.= "-".$row["Version"]."</span></a>";
+ print $url."</span></td>\n";
print " <td class='".$c."'><span class='f5'><span class='blue'>";
print "&nbsp;&nbsp;&nbsp;".$row["NumVotes"]."</span></span></td>\n";
print " <td class='".$c."'><span class='f4'><span class='blue'>";
print $row["Description"]."</span></span></td>\n";
print " <td class='".$c."'><span class='f5'><span class='blue'>";
- $not_managed = 0;
+
+ # print the package manager, also determine if it is managed
+ #
+ $managed = 1;
if (isset($devs[$row["AURMaintainerUID"]])) {
print $devs[$row["AURMaintainerUID"]]["Username"];
} elseif (isset($tus[$row["AURMaintainerUID"]])) {
print $tus[$row["AURMaintainerUID"]]["Username"];
} else {
print "None";
- $not_managed = 1;
+ $managed = 0;
}
print "</span></span></td>\n";
- 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.
- #
+
+ # print the managed link if applicable
+ #
+ if (canManagePackage($myuid, $row["AURMaintainerUID"],
+ $row["MaintainerUID"], $row["SubmitterUID"], $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'>";
@@ -553,6 +599,9 @@ function pkg_search_page($SID="") {
print "</tr>\n";
print "</table>\n";
print "<input type='hidden' name='All_IDs' value='".$all_ids."'>\n";
+ if ($_REQUEST["do_MyPackages"]) {
+ print "<input type='hidden' name='do_MyPackages' value='1'>\n";
+ }
print "<table width='90%' cellspacing='0' cellpadding='2'>\n";
print "<tr>\n";