complete rearrangement an splitting into functions
This commit is contained in:
@@ -77,7 +77,7 @@ function source($dir, $file, $mime=NULL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Output only a part of a file */
|
/** 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
|
$ranges = array_map('intval', // Parse the parts into integer
|
||||||
explode('-', // The range separator
|
explode('-', // The range separator
|
||||||
// Skip the `bytes=` part of the header
|
// Skip the `bytes=` part of the header
|
||||||
@@ -121,7 +121,7 @@ function output($path) {
|
|||||||
@ini_set('zlib.output_compression', 'Off');
|
@ini_set('zlib.output_compression', 'Off');
|
||||||
header('Content-type: ' . $mime);
|
header('Content-type: ' . $mime);
|
||||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||||
range($path, $size, $mime);
|
fileRange($path, $size, $mime);
|
||||||
} else {
|
} else {
|
||||||
header('Content-Length: ' . $size);
|
header('Content-Length: ' . $size);
|
||||||
@readfile($file);
|
@readfile($file);
|
||||||
|
Reference in New Issue
Block a user