} } 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'); exit; } // If we are running in Legalize mode, don't play medias already playing if (AmpConfig::get('lock_songs')) { if (!Stream::check_lock_media($media->id, $type)) { exit; } } $media = $catalog->prepare_media($media); } else { // No catalog, must be song preview or something like that => just redirect to file if ($type == "song_preview") { $media->stream();
$media = new Song_Preview($oid); $media->format(); } else { $media = new Video($oid); $media->format(); } } if ($media->catalog) { // Build up the catalog for our current object $catalog = Catalog::create_from_id($media->catalog); /* If the song 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, 'song'); } header('HTTP/1.1 404 File Disabled'); exit; } // If we are running in Legalize mode, don't play songs already playing if (AmpConfig::get('lock_songs')) { if (!Stream::check_lock_media($media->id, get_class($media))) { exit; } } $media = $catalog->prepare_media($media); } else { // No catalog, must be song preview or something like that => just redirect to file header('Location: ' . $media->file); $media = null;