summaryrefslogtreecommitdiffstats
path: root/play/index.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-19 03:42:58 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-19 03:42:58 +0000
commit97469b849f08d985e538379143f729b9c8fa72d4 (patch)
tree448046aa8b3af0365357d8db933f5d2dab2dcabf /play/index.php
parent56c960c34a17746beeec455fc225428360d5d91d (diff)
downloadampache-97469b849f08d985e538379143f729b9c8fa72d4.tar.gz
ampache-97469b849f08d985e538379143f729b9c8fa72d4.tar.bz2
ampache-97469b849f08d985e538379143f729b9c8fa72d4.zip
fixed a typo, and some order issues with the streaming, step 2 fix now playing
Diffstat (limited to 'play/index.php')
-rw-r--r--play/index.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/play/index.php b/play/index.php
index 0df5a879..9b4ee45e 100644
--- a/play/index.php
+++ b/play/index.php
@@ -52,14 +52,26 @@ if (!isset($uid)) {
/* Misc Housework */
$user = new User($uid);
-/* Update the users last seen information */
-$user->update_last_seen();
+/* If the user has been disabled (true value) */
+if (make_bool($GLOBALS['user']->disabled)) {
+ debug_event('user_disabled',"Error $user->username is currently disabled, stream access denied",'3');
+ echo "Error: User Disabled";
+ exit;
+}
+
+/* If we're using auth and we can't find a username for this user */
+if (Config::get('use_auth') AND !$GLOBALS['user']->username AND !$GLOBALS['user']->is_xmlrpc() ) {
+ debug_event('user_not_found',"Error $user->username not found, stream access denied",'3');
+ echo "Error: No User Found";
+ exit;
+}
// If we're doing XML-RPC check _GET
if (Config::get('xml_rpc')) {
$xml_rpc = $_GET['xml_rpc'];
}
+// If require session is set then we need to make sure we're legit
if (Config::get('require_session') OR $xml_rpc) {
if(!session_exists($sid,$xml_rpc)) {
debug_event('session_expired',"Streaming Access Denied: " . $GLOBALS['user']->username . "'s session has expired",'3');
@@ -71,6 +83,10 @@ if (Config::get('require_session') OR $xml_rpc) {
extend_session($sid);
}
+
+/* Update the users last seen information */
+$user->update_last_seen();
+
/* If we are in demo mode.. die here */
if (Config::get('demo_mode') || (!$GLOBALS['user']->has_access('25') && !$xml_rpc) ) {
debug_event('access_denied',"Streaming Access Denied:" .Config::get('demo_mode') . "is the value of demo_mode. Current user level is " . $GLOBALS['user']->access,'3');
@@ -112,13 +128,6 @@ if (!make_bool($song->enabled)) {
exit;
}
-/* If the user has been disabled (true value) */
-if (make_bool($GLOBALS['user']->disabled)) {
- debug_event('user_disabled',"Error $user->username is currently disabled, stream access denied",'3');
- echo "Error: User Disabled";
- exit;
-}
-
/* If we don't have a file, or the file is not readable */
if (!$song->file OR ( !is_readable($song->file) AND $catalog->catalog_type != 'remote' ) ) {
@@ -133,16 +142,14 @@ if (!$song->file OR ( !is_readable($song->file) AND $catalog->catalog_type != 'r
exit;
}
-/* If we're using auth and we can't find a username for this user */
-if (Config::get('use_auth') AND !$GLOBALS['user']->username AND !$GLOBALS['user']->is_xmlrpc() ) {
- debug_event('user_not_found',"Error $user->username not found, stream access denied",'3');
- echo "Error: No User Found";
- exit;
-}
-
/* Run Garbage Collection on Now Playing */
gc_now_playing();
+// If we are running in Legalize mode, don't play songs already playing
+if (Config::get('lock_songs')) {
+ if (!check_lock_songs($song->id)) { exit(); }
+}
+
/* Check to see if this is a 'remote' catalog */
if ($catalog->catalog_type == 'remote') {
// redirect to the remote host's play path
@@ -161,12 +168,6 @@ if ($catalog->catalog_type == 'remote') {
exit;
} // end if remote catalog
-
-// If we are running in Legalize mode, don't play songs already playing
-if (Config::get('lock_songs')) {
- if (!check_lock_songs($song->id)) { exit(); }
-}
-
// Put this song in the now_playing table
$lastid = insert_now_playing($song->id,$uid,$song->time);
@@ -201,8 +202,7 @@ if (Config::get('access_control') AND Config::get('downsample_remote')) {
}
} // if access_control
-
-
+// If they are downsampling, or if the song is not a native stream or it's non-local
if ($GLOBALS['user']->prefs['play_type'] == 'downsample' || !$song->native_stream() || $not_local) {
debug_event('downsample','Starting Downsample...','5');
$results = start_downsample($song,$lastid,$song_name);
@@ -256,7 +256,7 @@ if ($GLOBALS['user']->prefs['rate_limit'] > 0) {
while (!feof($fp) && (connection_status() == 0)) {
$buf = fread($fp, $chunk_size);
print($buf);
- if ($GLOBALS['user']->prefs['rate_limit'] > 0) { slepp (1); }
+ if ($GLOBALS['user']->prefs['rate_limit'] > 0) { sleep (1); }
$bytesStreamed += strlen($buf);
}