From 98f446df67161cb7fbc4af95060d7998625f9eb0 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Sun, 10 Oct 2021 07:05:43 +0200 Subject: [PATCH] [ticket/16888] Add the list of allowed files in the attachment tab PHPBB3-16888 --- phpBB/includes/functions_posting.php | 5 +++++ phpBB/language/en/posting.php | 1 + phpBB/styles/prosilver/template/posting_attach_body.html | 1 + 3 files changed, 7 insertions(+) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 5c62378a06..f885934ea8 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -818,6 +818,10 @@ function posting_gen_inline_attachments(&$attachment_data) function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) { global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; + global $cache, $request; + + $forum_id = $request->variable('f', 0); + $allowed_attachments = array_keys($cache->obtain_attach_extensions($forum_id)['_allowed_']); // Some default template variables $template->assign_vars(array( @@ -826,6 +830,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a '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' => implode(', ', $allowed_attachments), )); if (count($attachment_data)) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 1a6866d535..901cd0dad6 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -152,6 +152,7 @@ $lang = array_merge($lang, array( 'LOGIN_EXPLAIN_REPLY' => 'You need to login in order to reply to topics within this forum.', 'MAX_ATTACHMENT_FILESIZE' => 'Maximum filesize per attachment: %s.', + 'ALLOWED_ATTACHMENTS' => 'Allowed files', 'MAX_FONT_SIZE_EXCEEDED' => 'You may only use fonts up to size %d.', 'MAX_FLASH_HEIGHT_EXCEEDED' => array( 1 => 'Your flash files may only be up to %d pixel high.', diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index f304d727f2..ceb93001c1 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -3,6 +3,7 @@

{L_ADD_ATTACHMENT_EXPLAIN}

{% if MAX_ATTACHMENT_FILESIZE is not empty %}

{{ MAX_ATTACHMENT_FILESIZE }}

{% endif %} + {% if ALLOWED_ATTACHMENTS is not empty %}

{{ lang('ALLOWED_ATTACHMENTS') ~ lang('COLON') }} {{ ALLOWED_ATTACHMENTS }}

{% endif %}