From d16b2407497e2c5afdfd451f0772b1294c04908b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Thu, 30 Aug 2018 20:45:24 +0200 Subject: [PATCH 1/2] [ticket/15300] Show maximum attachment filesize PHPBB3-15300 --- phpBB/includes/functions_posting.php | 9 +++++---- phpBB/language/en/posting.php | 1 + phpBB/styles/prosilver/template/posting_attach_body.html | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 9b51cf5fd1..01630b3d0c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -726,10 +726,11 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a // Some default template variables $template->assign_vars(array( - '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'] : '', + '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' => $user->lang('MAX_ATTACHMENT_FILESIZE', get_formatted_filesize($config['max_filesize'])), )); if (count($attachment_data)) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 639b8d8370..1a6866d535 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -151,6 +151,7 @@ $lang = array_merge($lang, array( 'LOGIN_EXPLAIN_QUOTE' => 'You need to login in order to quote posts within this forum.', 'LOGIN_EXPLAIN_REPLY' => 'You need to login in order to reply to topics within this forum.', + 'MAX_ATTACHMENT_FILESIZE' => 'Maximum filesize per attachment: %s.', '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 0363fe0f05..0d169f7f1a 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -2,6 +2,7 @@

{L_ADD_ATTACHMENT_EXPLAIN}

+

{MAX_ATTACHMENT_FILESIZE}

From 7870c48cedc2a582add7fd16e1647653fb083859 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 29 Aug 2020 13:56:25 +0200 Subject: [PATCH 2/2] [ticket/15300] Only display max filesize if it's not zero PHPBB3-15300 --- phpBB/includes/functions_posting.php | 2 +- phpBB/styles/prosilver/template/posting_attach_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 01630b3d0c..01ceae1cb2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -730,7 +730,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a 'S_HAS_ATTACHMENTS' => count($attachment_data), 'FILESIZE' => $config['max_filesize'], 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', - 'MAX_ATTACHMENT_FILESIZE' => $user->lang('MAX_ATTACHMENT_FILESIZE', get_formatted_filesize($config['max_filesize'])), + 'MAX_ATTACHMENT_FILESIZE' => $config['max_filesize'] > 0 ? $user->lang('MAX_ATTACHMENT_FILESIZE', get_formatted_filesize($config['max_filesize'])) : '', )); if (count($attachment_data)) diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index 0d169f7f1a..f304d727f2 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -2,7 +2,7 @@

{L_ADD_ATTACHMENT_EXPLAIN}

-

{MAX_ATTACHMENT_FILESIZE}

+ {% if MAX_ATTACHMENT_FILESIZE is not empty %}

{{ MAX_ATTACHMENT_FILESIZE }}

{% endif %}