mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 14:18:24 +01:00
Merge branch '3.3.x'
This commit is contained in:
commit
c0c3486999
@ -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, $phpbb_container;
|
||||
global $template, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container;
|
||||
|
||||
$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))
|
||||
{
|
||||
|
@ -2074,7 +2074,7 @@ if ($allowed)
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
@ -8,7 +8,7 @@
|
||||
<dl>
|
||||
<dt><label for="fileupload">{L_FILENAME}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<input type="file" name="fileupload" id="fileupload" class="inputbox autowidth" />
|
||||
<input type="file" accept="{{ ALLOWED_ATTACHMENTS }}" name="fileupload" id="fileupload" class="inputbox autowidth" />
|
||||
<input type="submit" name="add_file" value="{L_ADD_FILE}" class="button1 button button-form-bold" onclick="upload = true;" />
|
||||
</dd>
|
||||
</dl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user