1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-23 00:32:57 +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

@@ -18,6 +18,8 @@ use phpbb\language\language;
/**
* Responsible for holding all file relevant information, as well as doing file-specific operations.
* The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on.
*
* @deprecated
*/
class filespec
{
@@ -84,10 +86,10 @@ class filespec
/** @var string phpBB root path */
protected $phpbb_root_path;
/** @var \phpbb\plupload\plupload The plupload object */
/** @var \phpbb\plupload\plupload|null The plupload object */
protected $plupload;
/** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */
/** @var \phpbb\mimetype\guesser|null phpBB Mimetype guesser */
protected $mimetype_guesser;
/**
@@ -98,8 +100,8 @@ class filespec
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param \FastImageSize\FastImageSize $imagesize Imagesize class
* @param string $phpbb_root_path phpBB root path
* @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload $plupload Plupload
* @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload|null $plupload Plupload
*/
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{

View File

@@ -66,34 +66,29 @@ class filespec_storage
/** @var upload Instance of upload class */
public $upload;
/** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */
protected $php_ini;
/** @var \FastImageSize\FastImageSize */
protected $imagesize;
/** @var language Language class */
protected $language;
/** @var \phpbb\plupload\plupload The plupload object */
/** @var \phpbb\plupload\plupload|null The plupload object */
protected $plupload;
/** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */
/** @var \phpbb\mimetype\guesser|null phpBB Mimetype guesser */
protected $mimetype_guesser;
/**
* File upload class
*
* @param language $language Language
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param \FastImageSize\FastImageSize $imagesize Imagesize class
* @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload $plupload Plupload
* @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload|null $plupload Plupload
*/
public function __construct(language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
$this->language = $language;
$this->php_ini = $php_ini;
$this->imagesize = $imagesize;
$this->plupload = $plupload;
$this->mimetype_guesser = $mimetype_guesser;

View File

@@ -99,7 +99,7 @@ class local extends base
* Retrieve upload array
*
* @param string $source_file Source file name
* @param array $filedata File data array
* @param array|bool $filedata File data array
*
* @return array Upload array
*/

View File

@@ -108,7 +108,7 @@ class local_storage extends base
* Retrieve upload array
*
* @param string $source_file Source file name
* @param array $filedata File data array
* @param array|bool $filedata File data array
*
* @return array Upload array
*/

View File

@@ -29,7 +29,7 @@ class remote extends base
/** @var factory Files factory */
protected $factory;
/** @var filesystem Filesystem temp */
/** @var temp Filesystem temp */
protected $temp;
/** @var language */

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
*/