summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--democratic.php24
-rw-r--r--lib/class/democratic.class.php27
-rw-r--r--lib/class/stream.class.php1
3 files changed, 26 insertions, 26 deletions
diff --git a/democratic.php b/democratic.php
index 04755def..ab997f02 100644
--- a/democratic.php
+++ b/democratic.php
@@ -64,21 +64,6 @@ switch ($_REQUEST['action']) {
Democratic::create($_POST);
header("Location: " . Config::get('web_path') . "/democratic.php?action=manage_playlists");
break;
- case 'create_playlist':
- /* Only Admins Here */
- if (!$GLOBALS['user']->has_access(100)) {
- access_denied();
- break;
- }
- /* We need to make ourselfs a new tmp playlist */
- $tmp_playlist = new tmpPlaylist();
- $id = $tmp_playlist->create('-1','vote','song',$_REQUEST['playlist_id']);
-
- /* Re-generate the playlist */
- $tmp_playlist = new tmpPlaylist($id);
- $songs = $tmp_playlist->get_items();
- require_once(conf('prefix') . '/templates/show_tv.inc.php');
- break;
case 'manage_playlists':
if (!Access::check('interface','75')) {
access_denied();
@@ -90,17 +75,10 @@ switch ($_REQUEST['action']) {
require_once Config::get('prefix') . '/templates/show_manage_democratic.inc.php';
break;
- case 'update_playlist':
- /* Only Admins Here */
- if (!Access::check('interface','100')) {
- access_denied();
- break;
- }
- $tmp_playlist = new tmpPlaylist($_REQUEST['tmp_playlist_id']);
- $tmp_playlist->update_playlist($_REQUEST['playlist_id']);
case 'show_playlist':
default:
$democratic = Democratic::get_current_playlist();
+ $democratic->set_parent();
$objects = $democratic->get_items();
require_once Config::get('prefix') . '/templates/show_democratic.inc.php';
break;
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
index df323f62..af1be060 100644
--- a/lib/class/democratic.class.php
+++ b/lib/class/democratic.class.php
@@ -26,6 +26,9 @@
*/
class Democratic extends tmpPlaylist {
+ // Build local, buy local
+ public $tmp_playlist;
+
/**
* constructor
* We need a constructor for this class. It does it's own thing now
@@ -61,6 +64,24 @@ class Democratic extends tmpPlaylist {
} // get_info
/**
+ * set_parent
+ * This returns the tmpPlaylist for this democratic play instance
+ */
+ public function set_parent() {
+
+ $demo_id = Dba::escape($this->id);
+
+ $sql = "SELECT * FROM `tmp_playlist` WHERE `session`='$demo_id'";
+ $db_results = Dba::query($sql);
+
+ $row = Dba::fetch_assoc($db_results);
+
+ $this->tmp_playlist = $row['id'];
+
+
+ } // set_parent
+
+ /**
* format
* This makes the objects variables all purrty so that they can be displayed
*/
@@ -160,7 +181,7 @@ class Democratic extends tmpPlaylist {
/* Select all objects from this playlist */
$sql = "SELECT `tmp_playlist_data`.`id`,`tmp_playlist_data`.`object_type`, `user_vote`.`date`, `tmp_playlist_data`.`object_id` " .
"FROM `tmp_playlist_data` $vote_join " .
- "WHERE `tmp_playlist_data`.`tmp_playlist`='" . Dba::escape($this->id) . "' $order";
+ "WHERE `tmp_playlist_data`.`tmp_playlist`='" . Dba::escape($this->tmp_playlist) . "' $order";
$db_results = Dba::query($sql);
/* Define the array */
@@ -300,7 +321,7 @@ class Democratic extends tmpPlaylist {
*/
public function has_vote($object_id,$type='') {
- $tmp_id = Dba::escape($this->id);
+ $tmp_id = Dba::escape($this->tmp_playlist);
$object_id = Dba::escape($object_id);
$type = $type ? Dba::escape($type) : 'song';
$user_id = Dba::escape($GLOBALS['user']->id);
@@ -329,7 +350,7 @@ class Democratic extends tmpPlaylist {
public function add_vote($object_id,$object_type='') {
$object_id = Dba::escape($object_id);
- $tmp_playlist = Dba::escape($this->id);
+ $tmp_playlist = Dba::escape($this->tmp_playlist);
$object_type = $object_type ? Dba::escape($object_type) : 'song';
/* If it's on the playlist just vote */
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 10ad2044..87d34d2d 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -470,6 +470,7 @@ class Stream {
public function create_democratic() {
$democratic = Democratic::get_current_playlist();
+ $democratic->set_parent();
$democratic->vote($this->songs);
} // create_democratic