diff options
author | Dan McGee <dan@archlinux.org> | 2008-12-30 05:36:06 +0100 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2009-01-04 20:09:53 +0100 |
commit | 8f97330100af0baa89e635046bc97554782ec571 (patch) | |
tree | 733f27f5072e6dae661d2bf31fb9051d17ea088a /web/lib/pkgfuncs.inc | |
parent | bf4fe7f47c7ee110ec67803c77eb95870cde7c60 (diff) | |
download | aur-8f97330100af0baa89e635046bc97554782ec571.tar.gz aur-8f97330100af0baa89e635046bc97554782ec571.tar.xz |
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 <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.inc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 0c0b56c0..2ebae895 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 " <tr><td class='boxSoft' colspan='2'><span class='f3'>"; 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 = "<a href='pkgedit.php?change_Category=1&ID="; $edit_cat .= intval($_REQUEST["ID"])."'>".$row["Category"]."</a>"; $edit_cat .= " <span class='fix'>("; @@ -511,14 +512,12 @@ function package_details($id=0, $SID="") { echo "<input type='submit' class='button' name='do_Adopt'"; echo " value='".__("Adopt Packages")."'>\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 "<input type='submit' class='button' name='do_Disown'"; echo " value='".__("Disown Packages")."'>\n"; } - if (account_from_sid($SID) == "Trusted User" || - account_from_sid($SID) == "Developer") { + if ($atype == "Trusted User" || $atype == "Developer") { echo "<input type='submit' class='button' name='do_Delete'"; echo " value='".__("Delete Packages")."'>\n"; } @@ -554,7 +553,7 @@ function package_details($id=0, $SID="") { echo " <table class='boxSoft' width='100%'>\n"; echo " <tr>\n"; echo " <td class='boxSoftTitle'><span class='f3'>"; - if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { + if (canDeleteComment($carr["ID"], $atype, $SID)) { $durl = "<a href='pkgedit.php?del_Comment=1"; $durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"]; $durl.= "'><img src='/images/x.png' border='0'"; |