diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-10-11 17:40:16 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-10-11 17:40:16 +0200 |
commit | 2050a39da793b9ed219beed868ec86ebade423f6 (patch) | |
tree | 78d20feb7ccc0a0230653aac1518272328d157a5 /phpBB/includes/functions_posting.php | |
parent | 659236a32f58946a501d3fb9f04ba83ed91ef369 (diff) | |
download | forums-2050a39da793b9ed219beed868ec86ebade423f6.tar forums-2050a39da793b9ed219beed868ec86ebade423f6.tar.gz forums-2050a39da793b9ed219beed868ec86ebade423f6.tar.bz2 forums-2050a39da793b9ed219beed868ec86ebade423f6.tar.xz forums-2050a39da793b9ed219beed868ec86ebade423f6.zip |
[feature/plupload/integration] Integration of Plupload
This commit is a highly-refactored and up-to-date version of Fyorl's work
which was part of his Google Summer of Code 2012 project "Attachment
Improvements".
PHPBB3-10929
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r-- | phpBB/includes/functions_posting.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index ce1238d8e0..1bcef7f1f2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -385,8 +385,18 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) /** * Upload Attachment - filedata is generated here * Uses upload class +* +* @param string $form_name The form name of the file upload input +* @param int $forum_id The id of the forum +* @param bool $local Whether the file is local or not +* @param string $local_storage The path to the local file +* @param bool $is_message Whether it is a PM or not +* @param \filespec $local_filedata A filespec object created for the local file +* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used +* +* @return object filespec */ -function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) +function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\plupload\plupload $plupload = null) { global $auth, $user, $config, $db, $cache; global $phpbb_root_path, $phpEx; @@ -414,7 +424,7 @@ 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) : $upload->form_upload($form_name); + $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name, $plupload); if ($file->init_error) { @@ -469,6 +479,11 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage { $file->remove(); + if ($plupload && $plupload->is_active()) + { + $plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE'); + } + // If this error occurs a user tried to exploit an IE Bug by renaming extensions // Since the image category is displaying content inline we need to catch this. trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']); |