aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_posting.php21
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php8
-rw-r--r--phpBB/posting.php9
3 files changed, 16 insertions, 22 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 4ce5fbd133..eaa3ab0cd3 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -765,20 +765,20 @@ function posting_gen_inline_attachments(&$attachment_data)
/**
* Generate inline attachment entry
*/
-function posting_gen_attachment_entry($attachment_data, &$filename_data)
+function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true)
{
- global $template, $config, $phpbb_root_path, $phpEx, $user;
+ global $template, $config, $phpbb_root_path, $phpEx, $user, $auth;
+ // Some default template variables
$template->assign_vars(array(
- 'S_SHOW_ATTACH_BOX' => true)
- );
+ 'S_SHOW_ATTACH_BOX' => $show_attach_box,
+ 'S_HAS_ATTACHMENTS' => sizeof($attachment_data),
+ 'FILESIZE' => $config['max_filesize'],
+ 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '',
+ ));
if (sizeof($attachment_data))
{
- $template->assign_vars(array(
- 'S_HAS_ATTACHMENTS' => true)
- );
-
// We display the posted attachments within the desired order.
($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data);
@@ -808,11 +808,6 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data)
}
}
- $template->assign_vars(array(
- 'FILE_COMMENT' => $filename_data['filecomment'],
- 'FILESIZE' => $config['max_filesize'])
- );
-
return sizeof($attachment_data);
}
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 1418d386e8..9ff473a66c 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -1036,11 +1036,11 @@ function compose_pm($id, $mode, $action)
// Build custom bbcodes array
display_custom_bbcodes();
+ // Show attachment box for adding attachments if true
+ $allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype);
+
// Attachment entry
- if ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype)
- {
- posting_gen_attachment_entry($attachment_data, $filename_data);
- }
+ posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);
// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward')
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 4cfd1d7d72..a3dcc27d44 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1354,12 +1354,11 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_
);
}
+// Show attachment box for adding attachments if true
+$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);
+
// Attachment entry
-// Not using acl_gets here, because it is using OR logic
-if ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype)
-{
- posting_gen_attachment_entry($attachment_data, $filename_data);
-}
+posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);
// Output page ...
page_header($page_title);