summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-12-30 05:36:07 +0100
committerLoui Chang <louipc.ist@gmail.com>2009-01-04 20:28:24 +0100
commit207b565f1c05c556f05f4a549afeeb8878a3c372 (patch)
tree0b49734a925b187c906f918f684bfa6292743d0a /web/lib/pkgfuncs.inc
parent8f97330100af0baa89e635046bc97554782ec571 (diff)
downloadaur-207b565f1c05c556f05f4a549afeeb8878a3c372.tar.gz
aur-207b565f1c05c556f05f4a549afeeb8878a3c372.tar.xz
Minimize calls to uid_from_sid()
Just like the previous patch for account_from_sid() over-usage. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/lib/pkgfuncs.inc')
-rw-r--r--web/lib/pkgfuncs.inc9
1 files changed, 5 insertions, 4 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 2ebae895..9535f183 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -272,6 +272,7 @@ function package_details($id=0, $SID="") {
global $_REQUEST;
global $pkgsearch_vars;
$atype = account_from_sid($SID);
+ $uid = uid_from_sid($SID);
$q = "SELECT Packages.*,Location,Category ";
$q.= "FROM Packages,PackageLocations,PackageCategories ";
$q.= "WHERE Packages.LocationID = PackageLocations.ID ";
@@ -304,7 +305,7 @@ function package_details($id=0, $SID="") {
echo " <tr><td class='boxSoft' colspan='2'><img src='/images/pad.gif' height='30'></td></tr>\n";
echo " <tr><td class='boxSoft' colspan='2'><span class='f3'>";
if ($row["Location"] == "unsupported" and (
- uid_from_sid($SID) == $row["MaintainerUID"] or
+ $uid == $row["MaintainerUID"] or
($atype == "Developer" or
$atype == "Trusted User"))) {
$edit_cat = "<a href='pkgedit.php?change_Category=1&ID=";
@@ -479,7 +480,7 @@ function package_details($id=0, $SID="") {
echo " <input type='hidden' name='ID' value='".$row["ID"]."'>\n";
# Voting Button
#
- $q = "SELECT * FROM PackageVotes WHERE UsersID = ".uid_from_sid($SID);
+ $q = "SELECT * FROM PackageVotes WHERE UsersID = ". $uid;
$q.= " AND PackageID = ".$row["ID"];
if (!mysql_num_rows(db_query($q, $dbh))) {
echo " <input type='submit' class='button' name='do_Vote'";
@@ -490,7 +491,7 @@ function package_details($id=0, $SID="") {
}
# Comment Nofify Button
#
- $q = "SELECT * FROM CommentNotify WHERE UserID = ".uid_from_sid($SID);
+ $q = "SELECT * FROM CommentNotify WHERE UserID = ". $uid;
$q.= " AND PkgID = ".$row["ID"];
if (!mysql_num_rows(db_query($q, $dbh))) {
echo "<input type='submit' class='button' name='do_Notify'";
@@ -511,7 +512,7 @@ function package_details($id=0, $SID="") {
if ($row["MaintainerUID"] == 0) {
echo "<input type='submit' class='button' name='do_Adopt'";
echo " value='".__("Adopt Packages")."'>\n";
- } else if ($row["MaintainerUID"] == uid_from_sid($SID) ||
+ } else if ($uid == $row["MaintainerUID"] ||
$atype == "Trusted User" || $atype == "Developer") {
echo "<input type='submit' class='button' name='do_Disown'";
echo " value='".__("Disown Packages")."'>\n";