$media = new Song($oid); $media->format(); } else { if ($type == 'song_preview') { $media = new Song_Preview($oid); $media->format(); } else { $type = 'video'; $media = new Video($oid); if (isset($_REQUEST['subtitle'])) { $subtitle = $media->get_subtitle_file($_REQUEST['subtitle']); } $media->format(); } } if (!User::stream_control(array(array('object_type' => $type, 'object_id' => $media->id)))) { debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username . ' on ' . $media->get_stream_name(), 3); UI::access_denied(); exit; } if ($media->catalog) { // Build up the catalog for our current object $catalog = Catalog::create_from_id($media->catalog); /* If the media is disabled */ if (!make_bool($media->enabled)) { debug_event('Play', "Error: {$media->file} is currently disabled, song skipped", '5'); // Check to see if this is a democratic playlist, if so remove it completely if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, $type); } header('HTTP/1.1 404 File Disabled');
// Don't let them loop it // FIXME: This looks hacky if (AmpConfig::get('play_type') == 'democratic') { AmpConfig::set('play_type', 'stream', true); } default: $stream_type = AmpConfig::get('play_type'); if ($stream_type == 'stream') { $stream_type = AmpConfig::get('playlist_type'); } break; } debug_event('stream.php', 'Stream Type: ' . $stream_type . ' Media IDs: ' . json_encode($media_ids), 5); if (count($media_ids) || isset($urls)) { if ($stream_type != 'democratic') { if (!User::stream_control($media_ids)) { debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username, 3); UI::access_denied(); exit; } } if ($GLOBALS['user']->id > -1) { Session::update_username(Stream::get_session(), $GLOBALS['user']->username); } $playlist = new Stream_Playlist(); $playlist->add($media_ids); if (isset($urls)) { $playlist->add_urls($urls); } // Depending on the stream type, will either generate a redirect or actually do the streaming. $playlist->generate_playlist($stream_type, true);