summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/class/tmp_playlist.class.php2
-rw-r--r--lib/democratic.lib.php44
-rw-r--r--lib/localplay.lib.php4
-rw-r--r--templates/show_modules.inc.php2
-rw-r--r--templates/show_tv.inc.php6
-rw-r--r--templates/show_tv_adminctl.inc.php11
-rw-r--r--tv.php22
7 files changed, 68 insertions, 23 deletions
diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php
index acd78329..0e52aac9 100644
--- a/lib/class/tmp_playlist.class.php
+++ b/lib/class/tmp_playlist.class.php
@@ -114,7 +114,7 @@ class tmpPlaylist {
$id = mysql_insert_id(dbh());
- /* Clean any other playlists assoicated with this sessoin */
+ /* Clean any other playlists assoicated with this session */
$this->delete($sessid,$id);
return $id;
diff --git a/lib/democratic.lib.php b/lib/democratic.lib.php
new file mode 100644
index 00000000..f027a5dc
--- /dev/null
+++ b/lib/democratic.lib.php
@@ -0,0 +1,44 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2006 Ampache.org
+ All Rights Reserved
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/**
+ * get_democratic_playlist
+ * This retrives the tmpPlaylist->id based on our cheating
+ * use of the -1 session value. We still pass a value just
+ * incase we want to support multiple 'voting' queues later
+ * in life
+ */
+function get_democratic_playlist($session_id) {
+
+ $session_id = sql_escape($session_id);
+
+ $sql = "SELECT id FROM tmp_playlist WHERE session='$session_id'";
+ $db_results = mysql_query($sql, dbh());
+
+ $results = mysql_fetch_assoc($db_results);
+
+ $tmp_playlist = new tmpPlaylist($results['id']);
+
+ return $tmp_playlist;
+
+} //get_democratic_playlist
+
+?>
diff --git a/lib/localplay.lib.php b/lib/localplay.lib.php
index bd73853b..72807e91 100644
--- a/lib/localplay.lib.php
+++ b/lib/localplay.lib.php
@@ -141,7 +141,7 @@ function remove_localplay_preferences($type=0) {
* This returns an array of the localplay controllers filenames
* as well as a 'semi-cleaned' name
*/
-function get_localplay_controllers() {
+function get_localplay_controllers($disabled='') {
/* First get a list of the files */
$handle = opendir(conf('prefix') . '/modules/localplay');
@@ -161,7 +161,7 @@ function get_localplay_controllers() {
/* Get the base name, then get everything before .controller.php */
$filename = basename($file,'.controller.php');
/* Make sure that it's currently enabled */
- if (verify_localplay_preferences($filename)) {
+ if (verify_localplay_preferences($filename) || $disabled) {
$results[] = $filename;
}
}
diff --git a/templates/show_modules.inc.php b/templates/show_modules.inc.php
index 4530b75e..5f735b61 100644
--- a/templates/show_modules.inc.php
+++ b/templates/show_modules.inc.php
@@ -27,7 +27,7 @@
*/
/* Get Localplay Modules */
-$localplay_modules = get_localplay_controllers();
+$localplay_modules = get_localplay_controllers('disabled');
$web_path = conf('web_path');
?>
<?php show_box_top(_('Modules')); ?>
diff --git a/templates/show_tv.inc.php b/templates/show_tv.inc.php
index ddd0beea..b891a2ae 100644
--- a/templates/show_tv.inc.php
+++ b/templates/show_tv.inc.php
@@ -5,9 +5,8 @@
All rights reserved.
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -48,7 +47,6 @@ if ($GLOBALS['user']->has_access(100)) {
else {
}
-
?>
</div>
<!-- End Control Div -->
diff --git a/templates/show_tv_adminctl.inc.php b/templates/show_tv_adminctl.inc.php
index d3bbcf5e..f2c383f1 100644
--- a/templates/show_tv_adminctl.inc.php
+++ b/templates/show_tv_adminctl.inc.php
@@ -21,14 +21,13 @@
*/
?>
<h3><?php echo _('Admin Controls'); ?></h3>
-<?php if (!$playlist->vote_active()) { ?>
-<form id="form_playlist">
+<?php if (!$tmp_playlist->vote_active()) { ?>
+<form id="form_playlist" method="post" action="<?php echo conf('web_path'); ?>/tv.php" enctype="multipart/form-data" >
<?php echo _('Base Playlist'); ?>:
<?php show_playlist_dropdown(); ?>
-<input type="button" onclick="ajaxPost('<?php conf('ajax_url'); ?>?action=tv_activate<?php echo conf('ajax_info'); ?>','form_playlist');return true;" value="<?php echo _('Activate'); ?>" />
+<input type="hidden" name="action" value="create_playlist" />
+<input type="submit" value="<?php echo _('Activate'); ?>" />
</form>
-
<?php } else { ?>
-
-
+<?php echo _('Democratic Play Active'); ?>
<?php } ?>
diff --git a/tv.php b/tv.php
index 48a679ea..77a69e99 100644
--- a/tv.php
+++ b/tv.php
@@ -5,9 +5,8 @@
All rights reserved.
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,6 +21,8 @@
require_once('lib/init.php');
+/* Additional Library for tv stuff */
+require_once (conf('prefix') . '/lib/democratic.lib.php');
$dbh = dbh();
$web_path = conf('web_path');
@@ -32,19 +33,22 @@ if (!conf('allow_democratic_playback') || $GLOBALS['user']->prefs['play_type'] !
exit;
}
-/* Attempt to build the temp playlist */
-$playlist = new tmpPlaylist('-1');
+/* Clean up the stuff we need */
$action = scrub_in($_REQUEST['action']);
-
switch ($action) {
case 'create_playlist':
-
+ /* 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);
+ require_once(conf('prefix') . '/templates/show_tv.inc.php');
break;
default:
-
+ $tmp_playlist = get_democratic_playlist('-1');
require_once(conf('prefix') . '/templates/show_tv.inc.php');
-
break;
} // end switch on action