aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2014-07-21 23:40:04 +0800
committerrxu <rxu@mail.ru>2014-07-23 00:31:15 +0800
commit9485f59c6182c087f32159b123a458813541449e (patch)
tree36ee973d306f5d5e10f6c8052d3850060ad5a32b /phpBB/includes/functions_posting.php
parent449ffbe7992bcda2f28ceaf861329e913575149a (diff)
downloadforums-9485f59c6182c087f32159b123a458813541449e.tar
forums-9485f59c6182c087f32159b123a458813541449e.tar.gz
forums-9485f59c6182c087f32159b123a458813541449e.tar.bz2
forums-9485f59c6182c087f32159b123a458813541449e.tar.xz
forums-9485f59c6182c087f32159b123a458813541449e.zip
[ticket/12884] Add core event to the function upload_attachment()
Add core event to the function upload_attachment() in functions_posting.php to provide ability for extensions to perform additional actions on uploaded files, like resizing etc. PHPBB3-12884
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 0b37af0ee0..04e28fb865 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -405,7 +405,7 @@ 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\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
$filedata = array(
'error' => array()
@@ -506,6 +506,20 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$filedata['real_filename'] = $file->get('uploadname');
$filedata['filetime'] = time();
+ /**
+ * Event to modify uploaded file before submit to the post
+ *
+ * @event core.modify_uploaded_file
+ * @var array filedata Array containing uploaded file data
+ * @var bool is_image Flag indicating if the file is an image
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'filedata',
+ 'is_image',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars)));
+
// Check our complete quota
if ($config['attachment_quota'])
{