From 8f97330100af0baa89e635046bc97554782ec571 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 29 Dec 2008 22:36:06 -0600 Subject: Store account type in local var when possible No need to call this function way too often, especially when on the package list page where it could be called up to once per row. Signed-off-by: Dan McGee Signed-off-by: Loui Chang --- web/lib/pkgfuncs.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'web/lib/pkgfuncs.inc') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 0c0b56c..2ebae89 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -271,6 +271,7 @@ function pkgname_from_id($id="") { function package_details($id=0, $SID="") { global $_REQUEST; global $pkgsearch_vars; + $atype = account_from_sid($SID); $q = "SELECT Packages.*,Location,Category "; $q.= "FROM Packages,PackageLocations,PackageCategories "; $q.= "WHERE Packages.LocationID = PackageLocations.ID "; @@ -304,8 +305,8 @@ function package_details($id=0, $SID="") { echo " "; if ($row["Location"] == "unsupported" and ( uid_from_sid($SID) == $row["MaintainerUID"] or - (account_from_sid($SID) == "Developer" or - account_from_sid($SID) == "Trusted User"))) { + ($atype == "Developer" or + $atype == "Trusted User"))) { $edit_cat = "".$row["Category"].""; $edit_cat .= "  ("; @@ -511,14 +512,12 @@ function package_details($id=0, $SID="") { echo "\n"; } else if ($row["MaintainerUID"] == uid_from_sid($SID) || - account_from_sid($SID) == "Trusted User" || - account_from_sid($SID) == "Developer") { + $atype == "Trusted User" || $atype == "Developer") { echo "\n"; } - if (account_from_sid($SID) == "Trusted User" || - account_from_sid($SID) == "Developer") { + if ($atype == "Trusted User" || $atype == "Developer") { echo "\n"; } @@ -554,7 +553,7 @@ function package_details($id=0, $SID="") { echo " \n"; echo " \n"; echo "
"; - if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { + if (canDeleteComment($carr["ID"], $atype, $SID)) { $durl = "