1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 06:51:33 +02:00

[ticket/16345] Small improvements

PHPBB3-16346
This commit is contained in:
rubencm
2020-06-07 02:15:35 +00:00
parent 3cceeb45bf
commit 774c609c4a
284 changed files with 1380 additions and 835 deletions

View File

@@ -13,7 +13,6 @@
namespace phpbb\files;
use phpbb\filesystem\filesystem_interface;
use phpbb\language\language;
use phpbb\request\request_interface;
@@ -50,9 +49,6 @@ class upload
/** @var int Timeout for remote upload */
public $upload_timeout = 6;
/** @var filesystem_interface */
protected $filesystem;
/** @var \phpbb\files\factory Files factory */
protected $factory;
@@ -68,15 +64,13 @@ class upload
/**
* Init file upload class.
*
* @param filesystem_interface $filesystem
* @param factory $factory Files factory
* @param language $language Language class
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param request_interface $request Request class
*/
public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request)
public function __construct(factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request)
{
$this->filesystem = $filesystem;
$this->factory = $factory;
$this->language = $language;
$this->php_ini = $php_ini;
@@ -98,13 +92,13 @@ class upload
/**
* Set allowed extensions
*
* @param array $allowed_extensions Allowed file extensions
* @param array|bool $allowed_extensions Allowed file extensions
*
* @return \phpbb\files\upload This instance of upload
*/
public function set_allowed_extensions($allowed_extensions)
{
if ($allowed_extensions !== false && is_array($allowed_extensions))
if ($allowed_extensions !== false)
{
$this->allowed_extensions = $allowed_extensions;
}
@@ -152,13 +146,13 @@ class upload
/**
* Set disallowed strings
*
* @param array $disallowed_content Disallowed content
* @param array|bool $disallowed_content Disallowed content
*
* @return \phpbb\files\upload This instance of upload
*/
public function set_disallowed_content($disallowed_content)
{
if ($disallowed_content !== false && is_array($disallowed_content))
if ($disallowed_content !== false)
{
$this->disallowed_content = array_diff($disallowed_content, array(''));
}
@@ -185,7 +179,7 @@ class upload
*
* @param string $type Upload type
*
* @return \phpbb\files\filespec|bool A filespec instance if upload was
* @return \phpbb\files\filespec_storage|bool A filespec instance if upload was
* successful, false if there were issues or the type is not supported
*/
public function handle_upload($type)
@@ -259,7 +253,7 @@ class upload
/**
* Perform common file checks
*
* @param filespec $file Instance of filespec class
* @param filespec_storage $file Instance of filespec class
*/
public function common_checks($file)
{
@@ -293,7 +287,7 @@ class upload
/**
* Check for allowed extension
*
* @param filespec $file Instance of filespec class
* @param filespec_storage $file Instance of filespec class
*
* @return bool True if extension is allowed, false if not
*/
@@ -305,7 +299,7 @@ class upload
/**
* Check for allowed dimension
*
* @param filespec $file Instance of filespec class
* @param filespec_storage $file Instance of filespec class
*
* @return bool True if dimensions are valid or no constraints set, false
* if not
@@ -346,7 +340,7 @@ class upload
/**
* Check for bad content (IE mime-sniffing)
*
* @param filespec $file Instance of filespec class
* @param filespec_storage $file Instance of filespec class
*
* @return bool True if content is valid, false if not
*/