1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-20 07:42:09 +02:00

[ticket/14168] Use attachment upload class in message_parser

PHPBB3-14168
This commit is contained in:
Marc Alexander 2015-09-20 12:36:52 +02:00
parent a60beb6f2f
commit 16d5208d9a
2 changed files with 7 additions and 21 deletions

View File

@ -1140,12 +1140,6 @@ class parse_message extends bbcode_firstpass
*/
protected $plupload;
/**
* The mimetype guesser object used for attachment mimetypes
* @var \phpbb\mimetype\guesser
*/
protected $mimetype_guesser;
/**
* Init - give message here or manually
*/
@ -1541,6 +1535,7 @@ class parse_message extends bbcode_firstpass
function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)
{
global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request;
global $phpbb_container;
$error = array();
@ -1576,7 +1571,9 @@ class parse_message extends bbcode_firstpass
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id))
{
$filedata = upload_attachment($form_name, $forum_id, false, '', $is_message);
/** @var \phpbb\attachment\upload $attachment_upload */
$attachment_upload = $phpbb_container->get('attachment.upload');
$filedata = $attachment_upload->upload($form_name, $forum_id, false, '', $is_message);
$error = $filedata['error'];
if ($filedata['post_attach'] && !sizeof($error))
@ -1692,7 +1689,9 @@ class parse_message extends bbcode_firstpass
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id))
{
$filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->mimetype_guesser, $this->plupload);
/** @var \phpbb\attachment\upload $attachment_upload */
$attachment_upload = $phpbb_container->get('attachment.upload');
$filedata = $attachment_upload->upload($form_name, $forum_id, false, '', $is_message);;
$error = array_merge($error, $filedata['error']);
if (!sizeof($error))
@ -1980,18 +1979,6 @@ class parse_message extends bbcode_firstpass
$this->plupload = $plupload;
}
/**
* Setter function for passing the mimetype_guesser object
*
* @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype_guesser object
*
* @return null
*/
public function set_mimetype_guesser(\phpbb\mimetype\guesser $mimetype_guesser)
{
$this->mimetype_guesser = $mimetype_guesser;
}
/**
* Function to perform custom bbcode validation by extensions
* can be used in bbcode_init() to assign regexp replacement

View File

@ -571,7 +571,6 @@ $plupload = $phpbb_container->get('plupload');
/* @var $mimetype_guesser \phpbb\mimetype\guesser */
$mimetype_guesser = $phpbb_container->get('mimetype.guesser');
$message_parser->set_plupload($plupload);
$message_parser->set_mimetype_guesser($mimetype_guesser);
if (isset($post_data['post_text']))
{