summaryrefslogtreecommitdiffstats
path: root/lib/class/stats.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-03-17 03:29:49 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-03-17 03:29:49 +0000
commitbcc834d7fdabd0f52873a4f7696e065e3cf0f281 (patch)
treee28de4e85f40aaabae0a9263bc37346a8666e915 /lib/class/stats.class.php
parent27437304248e6d8fd44c2b997673ea112e08afa8 (diff)
downloadampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.tar.gz
ampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.tar.bz2
ampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.zip
flush out the democratic mojo, make the cooldown work
Diffstat (limited to 'lib/class/stats.class.php')
-rw-r--r--lib/class/stats.class.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/class/stats.class.php b/lib/class/stats.class.php
index 0c8a69cd..9f5cfdae 100644
--- a/lib/class/stats.class.php
+++ b/lib/class/stats.class.php
@@ -90,6 +90,33 @@ class Stats {
} // get_last_song
/**
+ * get_object_history
+ * This returns the objects that have happened for $user_id sometime after $time
+ * used primarly by the democratic cooldown code
+ */
+ public static function get_object_history($user_id='',$time) {
+
+ $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
+
+ $user_id = Dba::escape($user_id);
+
+ $time = Dba::escape($time);
+
+ $sql = "SELECT * FROM `object_count` WHERE `user`='$user_id' AND `object_type`='song' AND `date`>='$time' " .
+ "ORDER BY `date` DESC";
+ $db_results = Dba::query($sql);
+
+ $results = array();
+
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $results[] = $row['object_id'];
+ }
+
+ return $results;
+
+ } // get_object_history
+
+ /**
* get_top
* This returns the top X for type Y from the
* last conf('stats_threshold') days