diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-16 11:55:13 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-16 11:55:13 +0200 |
commit | a562fea2306c8ba5b47a161568bea5fbe2ffd19f (patch) | |
tree | fcab88a3a5dd5f05c77934eef0983793f2e2bd6a /phpBB/includes/functions_posting.php | |
parent | d4a47409f7da09790f38d3418401cbe34f8c3703 (diff) | |
parent | 6651c1d8f4aead15f4750989670f75721390ee21 (diff) | |
download | forums-a562fea2306c8ba5b47a161568bea5fbe2ffd19f.tar forums-a562fea2306c8ba5b47a161568bea5fbe2ffd19f.tar.gz forums-a562fea2306c8ba5b47a161568bea5fbe2ffd19f.tar.bz2 forums-a562fea2306c8ba5b47a161568bea5fbe2ffd19f.tar.xz forums-a562fea2306c8ba5b47a161568bea5fbe2ffd19f.zip |
Merge pull request #3727 from marc1706/ticket/13904
[ticket/13904] Refactor attachments functions into service
* marc1706/ticket/13904: (66 commits)
[ticket/13904] Use filespec's get_filesize instead of calling filesize()
[ticket/13904] Set properties to protected where possible in filespec
[ticket/13904] Fix tests after changes to factory
[ticket/13904] Minor coding style fixes
[ticket/13904] Add language entries for error messages in upload class
[ticket/13904] Modify files for updated fast-image-size library
[ticket/13904] Update composer.lock
[ticket/13904] Improve code coverage
[ticket/13904] Add unit tests for local upload type
[ticket/13904] Minor coding style fixes
[ticket/13904] Improve test coverage of base upload type class
[ticket/13904] Improve test coverage of remote upload type
[ticket/13904] Improve test coverage of form upload type
[ticket/13904] Improve test coverage of filespec class
[ticket/13904] Add back tests for retrieving floats
[ticket/13904] Use ini_get() wrapper in file upload types
[ticket/13904] Modify files for changes in ini wrapper
[ticket/13904] Add bantu/ini-get-wrapper to composer.json
[ticket/13904] Switch around constructor arguments
[ticket/13904] Use \phpbb\php\ini class for ini_get()
...
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r-- | phpBB/includes/functions_posting.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4206c87eb9..8b17dba534 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -405,14 +405,13 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) { global $auth, $user, $config, $db, $cache; - global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_filesystem; + global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container; $filedata = array( 'error' => array() ); - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); - $upload = new fileupload($phpbb_filesystem); + $upload = $phpbb_container->get('files.upload'); if ($config['check_attachment_content'] && isset($config['mime_triggers'])) { @@ -434,9 +433,10 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id)); $upload->set_allowed_extensions(array_keys($extensions['_allowed_'])); - $file = ($local) ? $upload->local_upload($local_storage, $local_filedata, $mimetype_guesser) : $upload->form_upload($form_name, $mimetype_guesser, $plupload); + /** @var \phpbb\files\filespec $file */ + $file = ($local) ? $upload->handle_upload('files.types.local', $local_storage, $local_filedata) : $upload->handle_upload('files.types.form', $form_name); - if ($file->init_error) + if ($file->init_error()) { $filedata['post_attach'] = false; return $filedata; |