[ticket/12356] Assign vars preventing Plupload from loading in PM editor.

PHPBB3-12356
This commit is contained in:
Cesar G 2014-04-09 11:35:19 -07:00
parent 0e3e715a48
commit a8ec1905e1
3 changed files with 10 additions and 6 deletions

View file

@ -1081,6 +1081,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false, 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false,
'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts), 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts),
'S_FORM_ENCTYPE' => $form_enctype, 'S_FORM_ENCTYPE' => $form_enctype,
'S_ATTACH_DATA' => json_encode($message_parser->attachment_data),
'S_BBCODE_IMG' => $img_status, 'S_BBCODE_IMG' => $img_status,
'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_FLASH' => $flash_status,
@ -1104,7 +1105,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
if ($allowed) if ($allowed)
{ {
$plupload->configure($cache, $template, $s_action, false); $max_files = ($auth->acl_gets('a_', 'm_')) ? 0 : (int) $config['max_attachments_pm'];
$plupload->configure($cache, $template, $s_action, false, $max_files);
} }
// Attachment entry // Attachment entry

View file

@ -146,10 +146,11 @@ class plupload
* @param \phpbb\template\template $template * @param \phpbb\template\template $template
* @param string $s_action The URL to submit the POST data to * @param string $s_action The URL to submit the POST data to
* @param int $forum_id The ID of the forum * @param int $forum_id The ID of the forum
* @param int $max_files Maximum number of files allowed. 0 for unlimited.
* *
* @return null * @return null
*/ */
public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id) public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files)
{ {
$filters = $this->generate_filter_string($cache, $forum_id); $filters = $this->generate_filter_string($cache, $forum_id);
$chunk_size = $this->get_chunk_size(); $chunk_size = $this->get_chunk_size();
@ -161,6 +162,9 @@ class plupload
'FILTERS' => $filters, 'FILTERS' => $filters,
'CHUNK_SIZE' => $chunk_size, 'CHUNK_SIZE' => $chunk_size,
'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action),
'MAX_ATTACHMENTS' => $max_files,
'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc',
'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files),
)); ));
$this->user->add_lang('plupload'); $this->user->add_lang('plupload');

View file

@ -1478,7 +1478,6 @@ $template->assign_vars(array(
'L_POST_A' => $page_title, 'L_POST_A' => $page_title,
'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']),
'L_TOO_MANY_ATTACHMENTS' => $user->lang('TOO_MANY_ATTACHMENTS', (int) $config['max_attachments']),
'FORUM_NAME' => $post_data['forum_name'], 'FORUM_NAME' => $post_data['forum_name'],
'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '',
@ -1502,8 +1501,6 @@ $template->assign_vars(array(
'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '',
'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"),
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")),
'ATTACH_ORDER' => ($config['display_order']) ? 'asc' : 'desc',
'MAX_ATTACHMENTS' => ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments'],
'S_PRIVMSGS' => false, 'S_PRIVMSGS' => false,
'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false, 'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false,
@ -1583,7 +1580,8 @@ $allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach')
if ($allowed) if ($allowed)
{ {
$plupload->configure($cache, $template, $s_action, $forum_id); $max_files = ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments'];
$plupload->configure($cache, $template, $s_action, $forum_id, $max_files);
} }
// Attachment entry // Attachment entry