aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/download/file.php2
-rw-r--r--phpBB/includes/functions_download.php12
-rw-r--r--tests/download/http_byte_range.php8
3 files changed, 11 insertions, 11 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index f5dd7c7d39..68a4afe03c 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -275,7 +275,7 @@ if ($thumbnail)
{
$attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename'];
}
-else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'] && !http_byte_range($attachment['filesize']))
+else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'] && !phpbb_http_byte_range($attachment['filesize']))
{
// Update download count
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index ad0c7f1cff..94d851e383 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -237,7 +237,7 @@ function send_file_to_browser($attachment, $upload_dir, $category)
if ($fp !== false)
{
// Deliver file partially if requested
- if ($range = http_byte_range($size))
+ if ($range = phpbb_http_byte_range($size))
{
fseek($fp, $range['byte_pos_start']);
@@ -439,7 +439,7 @@ function file_gc()
* @return mixed false if the whole file has to be delivered
* associative array on success
*/
-function http_byte_range($filesize)
+function phpbb_http_byte_range($filesize)
{
// Only call find_range_request() once.
static $request_array;
@@ -451,10 +451,10 @@ function http_byte_range($filesize)
if (!isset($request_array))
{
- $request_array = find_range_request();
+ $request_array = phpbb_find_range_request();
}
- return (empty($request_array)) ? false : parse_range_request($request_array, $filesize);
+ return (empty($request_array)) ? false : phpbb_parse_range_request($request_array, $filesize);
}
/**
@@ -464,7 +464,7 @@ function http_byte_range($filesize)
* array of strings containing the requested ranges otherwise
* e.g. array(0 => '0-0', 1 => '123-125')
*/
-function find_range_request()
+function phpbb_find_range_request()
{
$globals = array(
array('_SERVER', 'HTTP_RANGE'),
@@ -505,7 +505,7 @@ function find_range_request()
* bytes_requested the number of bytes requested
* bytes_total the full size of the file
*/
-function parse_range_request($request_array, $filesize)
+function phpbb_parse_range_request($request_array, $filesize)
{
// Go through all ranges
foreach ($request_array as $range_string)
diff --git a/tests/download/http_byte_range.php b/tests/download/http_byte_range.php
index 075311a47c..cc42dee353 100644
--- a/tests/download/http_byte_range.php
+++ b/tests/download/http_byte_range.php
@@ -16,15 +16,15 @@ class phpbb_download_http_byte_range_test extends phpbb_test_case
{
// Missing 'bytes=' prefix
$_SERVER['HTTP_RANGE'] = 'bztes=';
- $this->assertEquals(false, find_range_request());
+ $this->assertEquals(false, phpbb_find_range_request());
unset($_SERVER['HTTP_RANGE']);
$_ENV['HTTP_RANGE'] = 'bztes=';
- $this->assertEquals(false, find_range_request());
+ $this->assertEquals(false, phpbb_find_range_request());
unset($_ENV['HTTP_RANGE']);
$_SERVER['HTTP_RANGE'] = 'bytes=0-0,123-125';
- $this->assertEquals(array('0-0', '123-125'), find_range_request());
+ $this->assertEquals(array('0-0', '123-125'), phpbb_find_range_request());
unset($_SERVER['HTTP_RANGE']);
}
@@ -33,7 +33,7 @@ class phpbb_download_http_byte_range_test extends phpbb_test_case
*/
public function test_parse_range_request($request_array, $filesize, $expected)
{
- $this->assertEquals($expected, parse_range_request($request_array, $filesize));
+ $this->assertEquals($expected, phpbb_parse_range_request($request_array, $filesize));
}
public function parse_range_request_data()