diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-05-08 04:11:39 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-05-08 04:11:39 +0000 |
commit | 6319e26250e7b63522c397639722b88998807256 (patch) | |
tree | 1d72b81a8c0cc99f1355130cef449b302ed9fda3 /play | |
parent | 7715ec7cf0ec34ef7c540ff9921d2fde4ce7ff9b (diff) | |
download | ampache-6319e26250e7b63522c397639722b88998807256.tar.gz ampache-6319e26250e7b63522c397639722b88998807256.tar.bz2 ampache-6319e26250e7b63522c397639722b88998807256.zip |
renamed tv, fixed up the tmp playlist, added two preferences and corrected some logic in play/index.php
Diffstat (limited to 'play')
-rw-r--r-- | play/index.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/play/index.php b/play/index.php index 895a5de3..0df5a879 100644 --- a/play/index.php +++ b/play/index.php @@ -45,7 +45,7 @@ if (empty($song_id) && empty($tmp_id)) { } if (!isset($uid)) { - debug_event('no_usre','Error: No User specified','2'); + debug_event('no_user','Error: No User specified','2'); exit; } @@ -82,8 +82,8 @@ if (Config::get('demo_mode') || (!$GLOBALS['user']->has_access('25') && !$xml_rp that they have enough access to play this mojo */ if (Config::get('access_control')) { - if (!Access::check_network('stream',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->username,'25') AND - !Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->username,'25')) { + if (!Access::check_network('stream',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'25') AND + !Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'25')) { debug_event('access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access",'3'); access_denied(); exit; @@ -196,7 +196,7 @@ if (Config::get('track_user_ip')) { /* If access control is on and they aren't local, downsample! */ if (Config::get('access_control') AND Config::get('downsample_remote')) { - if (Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->username,'25')) { + if (Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'25')) { $not_local = true; } } // if access_control @@ -244,9 +244,19 @@ else { */ $bytesStreamed = $start; $minBytesStreamed = $song->size / 2; + +// We need to check to see if they are rate limited +$chunk_size = '8192'; + +if ($GLOBALS['user']->prefs['rate_limit'] > 0) { + $chunk_size = $GLOBALS['user']->prefs['rate_limit']; +} + +// Actually do the streaming while (!feof($fp) && (connection_status() == 0)) { - $buf = fread($fp, 8192); + $buf = fread($fp, $chunk_size); print($buf); + if ($GLOBALS['user']->prefs['rate_limit'] > 0) { slepp (1); } $bytesStreamed += strlen($buf); } |