diff options
Diffstat (limited to 'web/lib/pkgfuncs.inc')
-rw-r--r-- | web/lib/pkgfuncs.inc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 6ce96159..056552b9 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -8,13 +8,11 @@ $pkgsearch_vars = array("O", "L", "C", "K", "SB", "SO", "PP", "do_Orphans", "SeB # Make sure this visitor can delete the requested package comment # They can delete if they were the comment submitter, or if they are a TU/Dev # -function canDeleteComment($comment_id=0, $atype="", $SID="") { +function canDeleteComment($comment_id=0, $atype="", $uid=0) { if ($atype == "Trusted User" || $atype == "Developer") { # A TU/Dev can delete any comment - # return TRUE; } - $uid = uid_from_sid($SID); $dbh = db_connect(); $q = "SELECT COUNT(ID) AS CNT "; $q.= "FROM PackageComments "; @@ -30,6 +28,20 @@ function canDeleteComment($comment_id=0, $atype="", $SID="") { return FALSE; } +# Make sure this visitor can delete the requested package comment +# They can delete if they were the comment submitter, or if they are a TU/Dev +# +function canDeleteCommentArray($comment, $atype="", $uid=0) { + if ($atype == "Trusted User" || $atype == "Developer") { + # A TU/Dev can delete any comment + return TRUE; + } else if ($comment['UsersID'] == $uid) { + # User's own comment + return TRUE; + } + return FALSE; +} + # see if this Users.ID can manage the package # function canManagePackage($uid=0,$AURMUID=0, $MUID=0, $SUID=0, $managed=0) { |