has_access('25')) { access_denied(); } if ($user->prefs['download']) { if ($_REQUEST['song_id']) { if ($_REQUEST['action'] == 'download') { $song = new Song($_REQUEST['song_id']); $song->format_song(); $song->format_type(); $song_name = str_replace('"'," ",$song->f_artist_full . " - " . $song->title . "." . $song->type); // Use Horde's Browser class to send the right headers for different browsers // Should get the mime-type from the song rather than hard-coding it. header("Content-Length: " . $song->size); $browser->downloadHeaders($song_name, $song->mime, false, $song->size); $fp = fopen($song->file, 'r'); fpassthru($fp); fclose($fp); } } }