summaryrefslogtreecommitdiffstats
path: root/lib/class/tmpplaylist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-11 08:24:05 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-11 08:24:05 +0000
commit05c406e1f751ece06a7d54bc636275837f9f0169 (patch)
tree4bb73b8d560c1ad0d0ff6c14f2607251280ce79b /lib/class/tmpplaylist.class.php
parent689517e332c874ac09bb41398602622a1fc36af8 (diff)
downloadampache-05c406e1f751ece06a7d54bc636275837f9f0169.tar.gz
ampache-05c406e1f751ece06a7d54bc636275837f9f0169.tar.bz2
ampache-05c406e1f751ece06a7d54bc636275837f9f0169.zip
added in user profile, did a little work on the preferences and session, something is fishy with session and tmp_playlist stuff will look into it tomorrow
Diffstat (limited to 'lib/class/tmpplaylist.class.php')
-rw-r--r--lib/class/tmpplaylist.class.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/class/tmpplaylist.class.php b/lib/class/tmpplaylist.class.php
index b59417d5..a9110098 100644
--- a/lib/class/tmpplaylist.class.php
+++ b/lib/class/tmpplaylist.class.php
@@ -98,6 +98,28 @@ class tmpPlaylist {
} // get_from_session
/**
+ * get_from_userid
+ * This returns a tmp playlist object based on a userid passed
+ * this is used for the user profiles page
+ */
+ public static function get_from_userid($user_id) {
+
+ // This is a little stupid, because we don't have the user_id in the session or
+ // in the tmp_playlist table we have to do it this way.
+ $client = new User($user_id);
+ $username = Dba::escape($client->username);
+
+ $sql = "SELECT `tmp_playlist`.`id` FROM `tmp_playlist` LEFT JOIN `session` ON `session`.`id`=`tmp_playlist`.`session` " .
+ " WHERE `session`.`username`='$username' ORDER BY `session`.`expire` DESC";
+ $db_results = Dba::query($sql);
+
+ $data = Dba::fetch_assoc($db_results);
+
+ return $data['id'];
+
+ } // get_from_userid
+
+ /**
* get_items
* This returns an array of all object_ids currently in this tmpPlaylist
*/