|
@@ -43,7 +43,7 @@ discard block |
|
|
block discarded – undo |
|
43
|
43
|
]; |
|
44
|
44
|
$options = array_merge($defaut, $options); |
|
45
|
45
|
if (is_numeric($options['expires']) and $options['expires'] > 0) { |
|
46
|
|
- $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
|
46
|
+ $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']).' GMT'; |
|
47
|
47
|
} |
|
48
|
48
|
|
|
49
|
49
|
if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
|
@@ -72,7 +72,7 @@ discard block |
|
|
block discarded – undo |
|
72
|
72
|
function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) { |
|
73
|
73
|
// toujours envoyer un content type, meme vide ! |
|
74
|
74
|
header('Accept-Ranges: bytes'); |
|
75
|
|
- header('Content-Type: ' . $content_type); |
|
|
75
|
+ header('Content-Type: '.$content_type); |
|
76
|
76
|
|
|
77
|
77
|
if ($attachment) { |
|
78
|
78
|
$f = basename($fichier); |
|
@@ -90,7 +90,7 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
else { |
|
91
|
91
|
$f = basename($fichier); |
|
92
|
92
|
header("Content-Disposition: inline; filename=\"$f\";"); |
|
93
|
|
- header('Expires: ' . $expires); // set expiration time |
|
|
93
|
+ header('Expires: '.$expires); // set expiration time |
|
94
|
94
|
} |
|
95
|
95
|
} |
|
96
|
96
|
|
|
@@ -142,12 +142,12 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
// Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
|
143
|
143
|
if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
|
144
|
144
|
### Offset signifies where we should begin to read the file |
|
145
|
|
- $byteOffset = (int)$match[1]; |
|
|
145
|
+ $byteOffset = (int) $match[1]; |
|
146
|
146
|
|
|
147
|
147
|
|
|
148
|
148
|
### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
|
149
|
149
|
if (isset($match[2])) { |
|
150
|
|
- $finishBytes = (int)$match[2]; |
|
|
150
|
+ $finishBytes = (int) $match[2]; |
|
151
|
151
|
$byteLength = $finishBytes + 1; |
|
152
|
152
|
} else { |
|
153
|
153
|
$finishBytes = $fileSize - 1; |
|
@@ -168,7 +168,7 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
|
|
169
|
169
|
// partial content |
|
170
|
170
|
header('HTTP/1.1 206 Partial content'); |
|
171
|
|
- header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
|
171
|
+ header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
172
|
172
|
|
|
173
|
173
|
|
|
174
|
174
|
$byteRange = $byteLength - $byteOffset; |