summaryrefslogtreecommitdiffstats
path: root/download/index.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-02-05 20:12:06 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-02-05 20:12:06 +0000
commitdf539d8c0ed82aa45c8fa2026a49f270806989e4 (patch)
treebf5b7d36c517a1c8124bbda572bb721139ad69c3 /download/index.php
parent475f809d6c7d0c32fad01780aa9c8018705fd390 (diff)
downloadampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.tar.gz
ampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.tar.bz2
ampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.zip
moved browse class into its rightful place
Diffstat (limited to 'download/index.php')
-rw-r--r--download/index.php40
1 files changed, 21 insertions, 19 deletions
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";
+}