complete rearrangement an splitting into functions

This commit is contained in:
Marc Wäckerlin
2015-03-30 11:23:38 +00:00
parent 33120e071b
commit d919552a3e

View File

@@ -77,7 +77,7 @@ function source($dir, $file, $mime=NULL) {
}
/** Output only a part of a file */
function range($path, $size, $mime) {
function fileRange($path, $size, $mime) {
$ranges = array_map('intval', // Parse the parts into integer
explode('-', // The range separator
// Skip the `bytes=` part of the header
@@ -121,7 +121,7 @@ function output($path) {
@ini_set('zlib.output_compression', 'Off');
header('Content-type: ' . $mime);
if (isset($_SERVER['HTTP_RANGE'])) {
range($path, $size, $mime);
fileRange($path, $size, $mime);
} else {
header('Content-Length: ' . $size);
@readfile($file);