From df539d8c0ed82aa45c8fa2026a49f270806989e4 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 5 Feb 2006 20:12:06 +0000 Subject: moved browse class into its rightful place --- download/index.php | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'download/index.php') diff --git a/download/index.php b/download/index.php index 491d570b..e2d86e4f 100644 --- a/download/index.php +++ b/download/index.php @@ -27,12 +27,12 @@ */ require('../modules/init.php'); -require(conf('prefix') . '/lib/Browser.php'); +require(conf('prefix') . '/modules/horde/Browser.php'); $browser = new Browser(); /* If we are running a demo, quick while you still can! */ -if (conf('demo_mode') || !$user->has_access('25')) { +if (conf('demo_mode') || !$GLOBALS['user']->has_access('25') || !$GLOBALS['user']->prefs['download']) { access_denied(); } @@ -52,22 +52,24 @@ if (conf('access_control')) { } // access_control is enabled -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); - } +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); } } - +else { + if (conf('debug')) { + log_event($GLOBALS['user']->username,'download','No Song found, download failed'); + } + echo "Error: No Song found, download failed"; +} -- cgit