summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r--web/lib/pkgfuncs.inc.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index 0d4fe8c8..5696321f 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -948,6 +948,31 @@ function pkg_vote ($atype, $ids, $action=true, $dbh=NULL) {
}
}
+# Get all usernames and ids for a specifc package id
+function getvotes($pkgid, $dbh=NULL) {
+ if(!$dbh) {
+ $dbh = db_connect();
+ }
+
+ $pkgid = db_escape_string($pkgid);
+
+ $q = "SELECT UsersID,Username FROM PackageVotes ";
+ $q.= "LEFT JOIN Users on (UsersID = ID) ";
+ $q.= "WHERE PackageID = ". $pkgid . " ";
+ $q.= "ORDER BY Username";
+ $result = db_query($q, $dbh);
+
+ if (!$result) {
+ return;
+ }
+
+ while ($row = mysql_fetch_assoc($result)) {
+ $votes[] = $row;
+ }
+
+ return $votes;
+}
+
/**
* Toggle notification of packages
*