summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-28 02:18:08 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-28 02:18:08 +0000
commit705fba8f49faa42ed7f004f67b74a996c29ddb3d (patch)
treee6409a5c1f9106a03e0abbb13cdb92e9c1a0968a /lib/class
parent9030c16466ec16db505d755d9b6405b5a40c897d (diff)
downloadampache-705fba8f49faa42ed7f004f67b74a996c29ddb3d.tar.gz
ampache-705fba8f49faa42ed7f004f67b74a996c29ddb3d.tar.bz2
ampache-705fba8f49faa42ed7f004f67b74a996c29ddb3d.zip
ajax loading thingy added to css, fixed random methods on rightbar and added a default sort to the browse methods
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/browse.class.php15
-rw-r--r--lib/class/random.class.php2
-rw-r--r--lib/class/song.class.php2
-rw-r--r--lib/class/stream.class.php32
4 files changed, 38 insertions, 13 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index fae2670b..89341ec2 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -119,7 +119,7 @@ class Browse {
* set_sort
* This sets the current sort(s)
*/
- public static function set_sort($sort) {
+ public static function set_sort($sort,$order='') {
switch ($_SESSION['browse']['type']) {
case 'song':
@@ -145,9 +145,13 @@ class Browse {
// If it's not in our list, smeg off!
if (!in_array($sort,$valid_array)) {
return false;
- }
-
- if ($_SESSION['browse']['sort'][$sort] == 'DESC') {
+ }
+
+ if ($order) {
+ $_SESSION['browse']['sort'] = array();
+ $_SESSION['browse']['sort'][$sort] = $order;
+ }
+ elseif ($_SESSION['browse']['sort'][$sort] == 'DESC') {
// Reset it till I can figure out how to interface the hotness
$_SESSION['browse']['sort'] = array();
$_SESSION['browse']['sort'][$sort] = 'ASC';
@@ -572,6 +576,9 @@ class Browse {
// First pull the objects
$objects = self::get_saved();
+ // If there's nothing there don't do anything
+ if (!count($objects)) { return false; }
+
foreach ($objects as $object_id) {
$object_id = Dba::escape($object_id);
$where_sql .= "`id`='$object_id' OR";
diff --git a/lib/class/random.class.php b/lib/class/random.class.php
index 4b0efe84..8887bd28 100644
--- a/lib/class/random.class.php
+++ b/lib/class/random.class.php
@@ -98,7 +98,7 @@ class Random {
}
if (Config::get('require_session')) {
- $session_string = '&sid=' . session_id();
+ $session_string = '&sid=' . Stream::get_session();
}
$web_path = Config::get('web_path');
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 98de5616..732a0539 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -793,7 +793,7 @@ class Song {
$session_string = "&sid=" . $session_id;
}
else {
- $session_string = "&sid=" . session_id();
+ $session_string = "&sid=" . Stream::get_session();
}
} // if they are requiring a session
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 7c07b8f3..ffd4be6f 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -53,9 +53,6 @@ class Stream {
if (Config::get('force_http_play')) {
$this->web_path = preg_replace("/https/", "http",$this->web_path);
}
-
- // Generate the session ID
- self::$session = md5(uniqid(rand(), true));;
} // Constructor
@@ -104,6 +101,16 @@ class Stream {
} // manual_url_add
/**
+ * get_session
+ * This returns the current stream session
+ */
+ public static function get_session() {
+
+ return self::$session;
+
+ } // get_session
+
+ /**
* insert_session
* This inserts a row into the session_stream table
*/
@@ -207,7 +214,7 @@ class Stream {
if ($GLOBALS['user']->prefs['play_type'] == 'downsample') {
$ds = $GLOBALS['user']->prefs['sample_rate'];
}
- echo $song->get_url(self::$session);
+ echo $song->get_url();
} // end foreach
/* Foreach the additional URLs */
@@ -443,7 +450,7 @@ class Stream {
// Foreach the stuff we've got and add it
foreach ($this->objects as $object) {
- $localplay->add($object,self::$session);
+ $localplay->add($object);
}
$localplay->play();
@@ -474,7 +481,7 @@ class Stream {
// Build up our object
$song_id = $this->songs['0'];
$song = new Song($song_id);
- $url = $song->get_url(self::$session);
+ $url = $song->get_url();
// Append the fact we are downloading
$url .= '&action=download';
@@ -496,11 +503,22 @@ class Stream {
header("Content-Type: audio/x-pn-realaudio ram;");
foreach ($this->songs as $song_id) {
$song = new Song($song_id);
- echo $song->get_url(self::$session);
+ echo $song->get_url();
} // foreach songs
} // create_ram
+ /**
+ * auto_init
+ * This is called on class load it sets the session
+ */
+ public static function auto_init() {
+
+ // Generate the session ID
+ self::$session = md5(uniqid(rand(), true));;
+
+ } // auto_init
+
} //end of stream class
?>