From be52a823f871682a7740ca3c8207ac7f88f181f5 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 10 Nov 2013 18:27:13 -0800 Subject: [ticket/11915] Provide the attachment file size to the template. PHPBB3-11915 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 0d2cff40bc..192fc69f47 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -484,7 +484,7 @@ $message_parser->get_submitted_attachment_data($post_data['poster_id']); if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') { // Do not change to SELECT * - $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize FROM ' . ATTACHMENTS_TABLE . " WHERE post_msg_id = $post_id AND in_message = 0 -- cgit v1.2.1 From 0ea110292b31bff28cced69dc066cc62ed09d208 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 10 Nov 2013 18:29:49 -0800 Subject: [ticket/11915] Provide some additional info about limits to the uploader. PHPBB3-11915 --- phpBB/posting.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 192fc69f47..1711b91093 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1464,6 +1464,7 @@ $template->assign_vars(array( '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_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_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']) : '', @@ -1487,6 +1488,8 @@ $template->assign_vars(array( '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"), '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_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false, -- cgit v1.2.1 From 2719a18f7fc6ee3112c3ebc73d50e7c4d2f9d57f Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 10 Nov 2013 18:31:58 -0800 Subject: [ticket/11915] Make it possible to display trigger_error() messages to user. PHPBB3-11915 --- phpBB/posting.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 1711b91093..6066511d1c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -255,8 +255,18 @@ if (!$auth->acl_get('f_read', $forum_id)) { trigger_error('USER_CANNOT_READ'); } + $message = $user->lang['LOGIN_EXPLAIN_POST']; - login_box('', $user->lang['LOGIN_EXPLAIN_POST']); + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); } // Permission to do the action asked? @@ -326,8 +336,18 @@ if (!$is_authed) { trigger_error('USER_CANNOT_' . strtoupper($check_auth)); } + $message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]; + + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } - login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); + login_box('', $message); } // Is the user able to post within this forum? -- cgit v1.2.1 From ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 18 Dec 2013 19:23:14 -0800 Subject: [ticket/11915] Pass the data to the template instead of scraping HTML for it. PHPBB3-11915 --- phpBB/posting.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 6066511d1c..902f1b2175 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1548,8 +1548,9 @@ $template->assign_vars(array( 'S_BBCODE_QUOTE' => $quote_status, 'S_POST_ACTION' => $s_action, - 'S_HIDDEN_FIELDS' => $s_hidden_fields) -); + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), +)); /** * This event allows you to modify template variables for the posting screen -- cgit v1.2.1