aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2013-10-13 16:01:00 -0700
committerNils Adermann <naderman@naderman.de>2013-10-13 16:01:00 -0700
commit40932c26eaa7cddd0731b136a77c9bad704b69e0 (patch)
tree35dc039190cbb9cc20bbc6577a303cd3ddc1d328 /phpBB/includes/functions_posting.php
parent5927f0dbf2cd6bfe2db19f5703703af43cea64c8 (diff)
parent9f1c6279882e34df5b328680029d16b7e91ec126 (diff)
downloadforums-40932c26eaa7cddd0731b136a77c9bad704b69e0.tar
forums-40932c26eaa7cddd0731b136a77c9bad704b69e0.tar.gz
forums-40932c26eaa7cddd0731b136a77c9bad704b69e0.tar.bz2
forums-40932c26eaa7cddd0731b136a77c9bad704b69e0.tar.xz
forums-40932c26eaa7cddd0731b136a77c9bad704b69e0.zip
Merge pull request #1772 from bantu/feature/plupload/integration
[ticket/10929] Integration of Plupload
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php19
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']);