/** * Constructor for the class. * * @author Ross Carlson * @version 2/9/05 * @since 2/9/05 */ function jzJukebox() { global $include_path, $jbArr; jzJukebox::getJbArr(); // Ok, now we need to include the right subclass for this player // TODO: make getting jukebox by description the only available method. if (isset($_SESSION['jb_id']) && !is_numeric($_SESSION['jb_id'])) { foreach ($jbArr as $id => $jb) { if ($jb['description'] == $_SESSION['jb_id']) { $_SESSION['jb_id'] = $id; $this->id = $id; break; } } } if (!isset($_SESSION['jb_id']) || $_SESSION['jb_id'] >= sizeof($jbArr)) { $_SESSION['jb_id'] = 0; } if ($this->id === false) { $this->id = $_SESSION['jb_id']; } // Now let's make sure they have installed the jukebox if (!isset($jbArr[0]['type'])) { // Let's take them through the installer $this->install(); } writeLogData("messages", "Jukebox: building the jukebox object of type " . $this->getSetting('type')); include_once $include_path . "jukebox/jukeboxes/" . $this->getSetting('type') . ".php"; }
/** * Returns the AJAX code for the small jukebox * * @author Ben Dodson * @since 8/21/05 * @param new_jb: the jukebox to change to. **/ function ajaxSmallJukebox($new_jb = false, $text = false, $buttons = false, $linebreaks = false) { global $include_path; writeLogData("messages", "Jukebox: Displaying the small jukebox interface"); $blocks = new jzBlocks(); if ($new_jb !== false) { // Change the jukebox include_once $include_path . "jukebox/class.php"; $jbArr = jzJukebox::getJbArr(); for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $new_jb) { $_SESSION['jb_id'] = $i; } } $_POST['jbplaywhere'] = $new_jb; ajaxJukeboxRequest('playwhere'); } $blocks->smallJukebox($text, $buttons, $linebreaks); }
<?php if (!defined(JZ_SECURE_ACCESS)) { die('Security breach detected.'); } include_once $include_path . "jukebox/class.php"; ?> <script> var jb_types = ["stream"]; <?php $jbArr = jzJukebox::getJbArr(); for ($i = 0; $i < count($jbArr); $i++) { echo 'jb_types.push("' . $jbArr[$i]['type'] . "\");\n"; } ?> function setJbFormCommand(cmd) { document.getElementById('jbPlaylistForm').elements['command'].value = cmd; } function setPlayback(obj) { playback = obj.options[obj.selectedIndex].value; if (playback != "stream") { playback = "jukebox"; } else { playback = streamto; } // javascript hook for a jukebox if (playback == "jukebox" && jb_types[obj.selectedIndex] == "junction") {
function jukebox() { global $jzUSER; if (!isset($_REQUEST['jb_id']) && $_REQUEST['action'] != 'list') { return; } $_SESSION['jb_id'] = $_REQUEST['jb_id']; if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'list') { if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) { echo ""; return; } @(include_once 'jukebox/class.php'); $jbArr = jzJukebox::getJbArr(); foreach ($jbArr as $key => $val) { echo $key . ':' . $val['description'] . "\n"; } } } // Do we need to use the standard jukebox or not? // Now did they have a subcommand? if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) { echo 'insufficient permissions.'; exit; } if (isset($_REQUEST['external_playlist'])) { require_once 'playlists/class.php'; $pl = new JzPlaylist(); $pl->addFromExternal($_REQUEST['external_player']); $pl->jukebox(); // Questions: how to handle addwhere param; // how to bring in media as JzObject (without breaking built-in calls) return; } // Jukebox commands: if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; // Let's include the Jukebox classes writeLogData("messages", "API: Passing command: " . $command . " to the jukebox"); include_once "jukebox/class.php"; $jb = new jzJukebox(); $jb->passCommand($command); } }