diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/files/filespec.php | 31 | ||||
-rw-r--r-- | phpBB/phpbb/files/upload.php | 9 |
2 files changed, 25 insertions, 15 deletions
diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php index e07aef9892..34d86116c2 100644 --- a/phpBB/phpbb/files/filespec.php +++ b/phpBB/phpbb/files/filespec.php @@ -74,6 +74,15 @@ class filespec */ protected $filesystem; + /** @var \phpbb\php\ini ini_get() wrapper class */ + protected $php_ini; + + /** @var language Language class */ + protected $language; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + /** * The plupload object * @var \phpbb\plupload\plupload @@ -86,28 +95,24 @@ class filespec */ protected $mimetype_guesser; - /** @var language Language class */ - protected $language; - - /** @var string phpBB root path */ - protected $phpbb_root_path; - /** * File upload class * * @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem + * @param \phpbb\php\ini $php_ini ini_get() wrapper * @param language $language Language - * @param string $phpbb_root_path phpBB root path - * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser - * @param \phpbb\plupload\plupload $plupload Plupload + * @param string $phpbb_root_path phpBB root path + * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser + * @param \phpbb\plupload\plupload $plupload Plupload */ - public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, \phpbb\php\ini $php_ini, language $language, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) { - $this->plupload = $plupload; - $this->mimetype_guesser = $mimetype_guesser; $this->filesystem = $phpbb_filesystem; + $this->php_ini = $php_ini; $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; + $this->plupload = $plupload; + $this->mimetype_guesser = $mimetype_guesser; } /** @@ -420,7 +425,7 @@ class filespec return false; } - $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy'; + $upload_mode = ($this->php_ini->get_bool('open_basedir') || $this->php_ini->get_bool('safe_mode')) ? 'move' : 'copy'; $upload_mode = ($this->local) ? 'local' : $upload_mode; $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php index 397eb5af36..35107ccb45 100644 --- a/phpBB/phpbb/files/upload.php +++ b/phpBB/phpbb/files/upload.php @@ -56,6 +56,9 @@ class upload /** @var \phpbb\files\factory Files factory */ protected $factory; + /** @var \phpbb\php\ini ini_get() wrapper */ + protected $php_ini; + /** @var \phpbb\language\language Language class */ protected $language; @@ -70,14 +73,16 @@ class upload * * @param filesystem_interface $filesystem * @param factory $factory Files factory + * @param \phpbb\php\ini $php_ini ini_get() wrapper * @param language $language Language class * @param request_interface $request Request class * @param string $phpbb_root_path phpBB root path */ - public function __construct(filesystem_interface $filesystem, factory $factory, language $language, request_interface $request, $phpbb_root_path) + public function __construct(filesystem_interface $filesystem, factory $factory, \phpbb\php\ini $php_ini, language $language, request_interface $request, $phpbb_root_path) { $this->filesystem = $filesystem; $this->factory = $factory; + $this->php_ini = $php_ini; $this->language = $language; $this->request = $request; $this->phpbb_root_path = $phpbb_root_path; @@ -211,7 +216,7 @@ class upload switch ($errorcode) { case UPLOAD_ERR_INI_SIZE: - $max_filesize = @ini_get('upload_max_filesize'); + $max_filesize = $this->php_ini->get_string('upload_max_filesize'); $unit = 'MB'; if (!empty($max_filesize)) |