diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-02-05 20:12:06 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-02-05 20:12:06 +0000 |
commit | df539d8c0ed82aa45c8fa2026a49f270806989e4 (patch) | |
tree | bf5b7d36c517a1c8124bbda572bb721139ad69c3 | |
parent | 475f809d6c7d0c32fad01780aa9c8018705fd390 (diff) | |
download | ampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.tar.gz ampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.tar.bz2 ampache-df539d8c0ed82aa45c8fa2026a49f270806989e4.zip |
moved browse class into its rightful place
-rw-r--r-- | download/index.php | 40 | ||||
-rw-r--r-- | lib/class/playlist.class.php | 1 | ||||
-rw-r--r-- | modules/horde/Browser.php (renamed from lib/Browser.php) | 0 | ||||
-rw-r--r-- | play/index.php | 2 | ||||
-rw-r--r-- | play/pupload.php | 2 |
5 files changed, 24 insertions, 21 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"; +} diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 8a82e9c9..ece5439a 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -410,6 +410,7 @@ class Playlist { $db_results = mysql_query($sql, dbh()); $i = 1; + $results = array(); while ($r = mysql_fetch_assoc($db_results)) { $new_data = array(); diff --git a/lib/Browser.php b/modules/horde/Browser.php index cf97dc41..cf97dc41 100644 --- a/lib/Browser.php +++ b/modules/horde/Browser.php diff --git a/play/index.php b/play/index.php index c6414357..cc230bc2 100644 --- a/play/index.php +++ b/play/index.php @@ -29,7 +29,7 @@ $no_session = true; require_once('../modules/init.php'); -require_once(conf('prefix') . '/lib/Browser.php'); +require_once(conf('prefix') . '/modules/horde/Browser.php'); /* These parameters had better come in on the url. */ diff --git a/play/pupload.php b/play/pupload.php index df3a87a0..192c8709 100644 --- a/play/pupload.php +++ b/play/pupload.php @@ -29,7 +29,7 @@ $no_session = true;
require_once('../modules/init.php');
-require_once(conf('prefix') . '/lib/Browser.php');
+require_once(conf('prefix') . '/modules/horde/Browser.php');
$browser = new Browser();
|