diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 5c62378a06a..971bdfe475d 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -813,20 +813,42 @@ function posting_gen_inline_attachments(&$attachment_data) } /** -* Generate inline attachment entry -*/ -function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) + * Generate inline attachment entry + * + * @param array $attachment_data The attachment data + * @param string $filename_data The filename data (filecomment) + * @param bool $show_attach_box Whether to show the attach box + * @param mixed $forum_id The forum id to check or false if private message + * @return int + */ +function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true, $forum_id = false) { - global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; + global $template, $cache, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; + + $allowed_attachments = array_keys($cache->obtain_attach_extensions($forum_id)['_allowed_']); // Some default template variables - $template->assign_vars(array( + $default_vars = [ 'S_SHOW_ATTACH_BOX' => $show_attach_box, 'S_HAS_ATTACHMENTS' => count($attachment_data), 'FILESIZE' => $config['max_filesize'], 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', 'MAX_ATTACHMENT_FILESIZE' => $config['max_filesize'] > 0 ? $user->lang('MAX_ATTACHMENT_FILESIZE', get_formatted_filesize($config['max_filesize'])) : '', - )); + 'ALLOWED_ATTACHMENTS' => !empty($allowed_attachments) ? implode(',', $allowed_attachments) : '', + ]; + + /** + * Modify default attachments template vars + * + * @event core.modify_default_attachments_template_vars + * @var array allowed_attachments Array containing allowed attachments data + * @var array default_vars Array containing default attachments template vars + * @since 3.3.6-RC1 + */ + $vars = ['allowed_attachments', 'default_vars']; + extract($phpbb_dispatcher->trigger_event('core.modify_default_attachments_template_vars', compact($vars))); + + $template->assign_vars($default_vars); if (count($attachment_data)) { diff --git a/phpBB/posting.php b/phpBB/posting.php index 6fc56abdd90..bc3e28ca43e 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -2078,7 +2078,7 @@ } // Attachment entry -posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); +posting_gen_attachment_entry($attachment_data, $filename_data, $allowed, $forum_id); // Output page ... page_header($page_title); diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index f304d727f2b..378fd118ccc 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -8,7 +8,7 @@
- +