summaryrefslogtreecommitdiffstats
path: root/lib/class/tmp_playlist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-12 21:56:58 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-12 21:56:58 +0000
commit4feee9e40a198046a87be105d70caea6b6a9fb6f (patch)
tree85af88470b3d0ccad8dd4983cf10014044b33c6b /lib/class/tmp_playlist.class.php
parent71febbd440d5d1a3d980891af5ca9e093d79d10e (diff)
downloadampache-4feee9e40a198046a87be105d70caea6b6a9fb6f.tar.gz
ampache-4feee9e40a198046a87be105d70caea6b6a9fb6f.tar.bz2
ampache-4feee9e40a198046a87be105d70caea6b6a9fb6f.zip
wowow
Diffstat (limited to 'lib/class/tmp_playlist.class.php')
-rw-r--r--lib/class/tmp_playlist.class.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php
index 4172583a..f903f1ef 100644
--- a/lib/class/tmp_playlist.class.php
+++ b/lib/class/tmp_playlist.class.php
@@ -135,10 +135,19 @@ class tmpPlaylist {
/* If nothing was found and this is a voting playlist then get from base_playlist */
if ($this->type == 'vote' AND !$results) {
- /* We need to pull a random one from the base_playlist */
- $base_playlist = new playlist($this->base_playlist);
- $data = $base_playlist->get_random_songs(1);
- $results['object_id'] = $data['0'];
+
+ /* Check for a playlist */
+ if ($this->base_playlist != '0') {
+ /* We need to pull a random one from the base_playlist */
+ $base_playlist = new playlist($this->base_playlist);
+ $data = $base_playlist->get_random_songs(1);
+ $results['object_id'] = $data['0'];
+ }
+ else {
+ $sql = "SELECT id as `object_id` FROM song WHERE disabled='0' ORDER BY RAND()";
+ $db_results = mysql_query($sql, dbh());
+ $results = mysql_fetch_assoc($db_results);
+ }
}
return $results['object_id'];