mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
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() ...
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user