summaryrefslogtreecommitdiffstats
path: root/lib/class/stream.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-26 08:28:09 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-26 08:28:09 +0000
commit97bcd214044e30b5078052ee0c523b63966d6833 (patch)
tree3710825f857adcb0d1926c9063bbc11adb678dc4 /lib/class/stream.class.php
parent13ae6a0371ae26023880a0ad69b3b1587db8dd76 (diff)
downloadampache-97bcd214044e30b5078052ee0c523b63966d6833.tar.gz
ampache-97bcd214044e30b5078052ee0c523b63966d6833.tar.bz2
ampache-97bcd214044e30b5078052ee0c523b63966d6833.zip
added direct links back in, added batch download to single artist view, removed useless cruft
Diffstat (limited to 'lib/class/stream.class.php')
-rw-r--r--lib/class/stream.class.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 7582b9e2..dece1a7b 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -39,6 +39,9 @@ class Stream {
// Generate once an object is constructed
public static $session;
+ // Let's us tell if the session has been activated
+ private static $session_inserted;
+
/**
* Constructor for the stream class takes a type and an array
* of song ids
@@ -69,7 +72,7 @@ class Stream {
}
// We're starting insert the session into session_stream
- if (!$this->insert_session()) {
+ if (!self::insert_session()) {
debug_event('stream','Session Insertion failure, aborting','3');
return false;
}
@@ -106,6 +109,10 @@ class Stream {
*/
public static function get_session() {
+ if (!self::$session_inserted) {
+ self::insert_session(self::$session);
+ }
+
return self::$session;
} // get_session
@@ -114,18 +121,21 @@ class Stream {
* insert_session
* This inserts a row into the session_stream table
*/
- public function insert_session($sid='') {
+ public static function insert_session($sid='',$uid='') {
$sid = $sid ? Dba::escape($sid) : Dba::escape(self::$session);
+ $uid = $uid ? Dba::escape($uid) : Dba::escape($GLOBALS['user']->id);
$expire = time() + Config::get('stream_length');
$sql = "INSERT INTO `session_stream` (`id`,`expire`,`user`) " .
- "VALUES('$sid','$expire','$this->user_id')";
+ "VALUES('$sid','$expire','$uid')";
$db_results = Dba::query($sql);
if (!$db_results) { return false; }
+ self::$session_inserted = true;
+
return true;
} // insert_session
@@ -679,7 +689,6 @@ class Stream {
} // clear_now_playing
-
/**
* auto_init
* This is called on class load it sets the session