From b5544b2f471ce4c93b08d19919ab062725545ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sat, 3 Jan 2015 11:39:29 +0100 Subject: [ticket/13450] Type-hint return value of $phpbb_container->get() PHPBB3-13450 --- phpBB/posting.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 10c3b696e6..b6af63038a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -116,6 +116,7 @@ if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$foru trigger_error('NO_FORUM'); } +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // We need to know some basic information in all cases before we do anything. @@ -561,7 +562,10 @@ if ($mode == 'edit') $orig_poll_options_size = sizeof($post_data['poll_options']); $message_parser = new parse_message(); +/* @var $plupload \phpbb\plupload\plupload */ $plupload = $phpbb_container->get('plupload'); + +/* @var $mimetype_guesser \phpbb\mimetype\guesser */ $mimetype_guesser = $phpbb_container->get('mimetype.guesser'); $message_parser->set_plupload($plupload); $message_parser->set_mimetype_guesser($mimetype_guesser); -- cgit v1.2.1 From 7fc586080bf5e7b6e90dcf44526200d7c9356d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Mon, 5 Jan 2015 22:21:31 +0100 Subject: [ticket/13468] Update calls to `add_log()` PHPBB3-13468 --- phpBB/posting.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 0f2ea303ea..8b90b3b04a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1293,7 +1293,11 @@ if ($submit || $preview || $refresh) $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; - add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); } // Lock/Unlock Post Edit -- cgit v1.2.1 From f6e06da4c68917dafb057bf7fe19f884a3e148c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sun, 4 Jan 2015 20:41:04 +0100 Subject: [ticket/13455] Update calls to `request_var()` PHPBB3-13455 --- phpBB/posting.php | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 8b90b3b04a..a82bd37641 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -29,11 +29,11 @@ $auth->acl($user->data); // Grab only parameters needed here -$post_id = request_var('p', 0); -$topic_id = request_var('t', 0); -$forum_id = request_var('f', 0); -$draft_id = request_var('d', 0); -$lastclick = request_var('lastclick', 0); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$draft_id = $request->variable('d', 0); +$lastclick = $request->variable('lastclick', 0); $submit = (isset($_POST['post'])) ? true : false; $preview = (isset($_POST['preview'])) ? true : false; @@ -43,7 +43,7 @@ $confirm = $request->is_set_post('confirm'); $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; $refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview); -$mode = request_var('mode', ''); +$mode = $request->variable('mode', ''); // If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here. if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id))) @@ -487,7 +487,7 @@ if ($mode == 'delete' || $mode == 'soft_delete') if ($mode == 'bump') { if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) - && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}")) + && check_link_hash($request->variable('hash', ''), "topic_{$post_data['topic_id']}")) { $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); @@ -676,9 +676,9 @@ $quote_status = true; // Save Draft if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) { - $subject = utf8_normalize_nfc(request_var('subject', '', true)); + $subject = utf8_normalize_nfc($request->variable('subject', '', true)); $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; - $message = utf8_normalize_nfc(request_var('message', '', true)); + $message = utf8_normalize_nfc($request->variable('message', '', true)); if ($subject && $message) { @@ -748,11 +748,11 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( if (is_bool($default)) { // Use the string representation - $hidden_fields[$name] = request_var($name, ''); + $hidden_fields[$name] = $request->variable($name, ''); } else { - $hidden_fields[$name] = request_var($name, $default); + $hidden_fields[$name] = $request->variable($name, $default); } } @@ -809,20 +809,20 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_ if ($submit || $preview || $refresh) { - $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0); - $post_data['post_subject'] = utf8_normalize_nfc(request_var('subject', '', true)); - $message_parser->message = utf8_normalize_nfc(request_var('message', '', true)); + $post_data['topic_cur_post_id'] = $request->variable('topic_cur_post_id', 0); + $post_data['post_subject'] = utf8_normalize_nfc($request->variable('subject', '', true)); + $message_parser->message = utf8_normalize_nfc($request->variable('message', '', true)); - $post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true)); - $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : ''; + $post_data['username'] = utf8_normalize_nfc($request->variable('username', $post_data['username'], true)); + $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc($request->variable('edit_reason', '', true)) : ''; $post_data['orig_topic_type'] = $post_data['topic_type']; - $post_data['topic_type'] = request_var('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); - $post_data['topic_time_limit'] = request_var('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); + $post_data['topic_type'] = $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); + $post_data['topic_time_limit'] = $request->variable('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) { - $post_data['icon_id'] = request_var('icon', (int) $post_data['icon_id']); + $post_data['icon_id'] = $request->variable('icon', (int) $post_data['icon_id']); } $post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; @@ -887,10 +887,10 @@ if ($submit || $preview || $refresh) } else { - $post_data['poll_title'] = utf8_normalize_nfc(request_var('poll_title', '', true)); - $post_data['poll_length'] = request_var('poll_length', 0); - $post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true)); - $post_data['poll_max_options'] = request_var('poll_max_options', 1); + $post_data['poll_title'] = utf8_normalize_nfc($request->variable('poll_title', '', true)); + $post_data['poll_length'] = $request->variable('poll_length', 0); + $post_data['poll_option_text'] = utf8_normalize_nfc($request->variable('poll_option_text', '', true)); + $post_data['poll_max_options'] = $request->variable('poll_max_options', 1); $post_data['poll_vote_change'] = ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0; } @@ -959,8 +959,8 @@ if ($submit || $preview || $refresh) // Notify and show user the changed post if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) { - $edit_post_message_checksum = request_var('edit_post_message_checksum', ''); - $edit_post_subject_checksum = request_var('edit_post_subject_checksum', ''); + $edit_post_message_checksum = $request->variable('edit_post_message_checksum', ''); + $edit_post_subject_checksum = $request->variable('edit_post_subject_checksum', ''); // $post_data['post_checksum'] is the checksum of the post submitted in the meantime // $message_md5 is the checksum of the post we're about to submit @@ -1074,9 +1074,9 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $captcha_data = array( - 'message' => utf8_normalize_nfc(request_var('message', '', true)), - 'subject' => utf8_normalize_nfc(request_var('subject', '', true)), - 'username' => utf8_normalize_nfc(request_var('username', '', true)), + 'message' => utf8_normalize_nfc($request->variable('message', '', true)), + 'subject' => utf8_normalize_nfc($request->variable('subject', '', true)), + 'username' => utf8_normalize_nfc($request->variable('username', '', true)), ); $vc_response = $captcha->validate($captcha_data); if ($vc_response) @@ -1701,7 +1701,7 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($c $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '' : ''; $s_hidden_fields .= ''; -$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; +$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; if ($mode == 'edit') { -- cgit v1.2.1 From abcb2680eec86dc8016c489ebc7362e29be9e4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Mon, 2 Feb 2015 21:35:46 +0100 Subject: [ticket/13455] Remove unnecessary calls to `utf8_normalize_nfc()` PHPBB3-13455 --- phpBB/posting.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index a82bd37641..ecd9e9f6c0 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -676,9 +676,9 @@ $quote_status = true; // Save Draft if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) { - $subject = utf8_normalize_nfc($request->variable('subject', '', true)); + $subject = $request->variable('subject', '', true); $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; - $message = utf8_normalize_nfc($request->variable('message', '', true)); + $message = $request->variable('message', '', true); if ($subject && $message) { @@ -810,11 +810,11 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_ if ($submit || $preview || $refresh) { $post_data['topic_cur_post_id'] = $request->variable('topic_cur_post_id', 0); - $post_data['post_subject'] = utf8_normalize_nfc($request->variable('subject', '', true)); - $message_parser->message = utf8_normalize_nfc($request->variable('message', '', true)); + $post_data['post_subject'] = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); - $post_data['username'] = utf8_normalize_nfc($request->variable('username', $post_data['username'], true)); - $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc($request->variable('edit_reason', '', true)) : ''; + $post_data['username'] = $request->variable('username', $post_data['username'], true); + $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? $request->variable('edit_reason', '', true) : ''; $post_data['orig_topic_type'] = $post_data['topic_type']; $post_data['topic_type'] = $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); @@ -887,9 +887,9 @@ if ($submit || $preview || $refresh) } else { - $post_data['poll_title'] = utf8_normalize_nfc($request->variable('poll_title', '', true)); + $post_data['poll_title'] = $request->variable('poll_title', '', true); $post_data['poll_length'] = $request->variable('poll_length', 0); - $post_data['poll_option_text'] = utf8_normalize_nfc($request->variable('poll_option_text', '', true)); + $post_data['poll_option_text'] = $request->variable('poll_option_text', '', true); $post_data['poll_max_options'] = $request->variable('poll_max_options', 1); $post_data['poll_vote_change'] = ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0; } @@ -1074,9 +1074,9 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $captcha_data = array( - 'message' => utf8_normalize_nfc($request->variable('message', '', true)), - 'subject' => utf8_normalize_nfc($request->variable('subject', '', true)), - 'username' => utf8_normalize_nfc($request->variable('username', '', true)), + 'message' => $request->variable('message', '', true), + 'subject' => $request->variable('subject', '', true), + 'username' => $request->variable('username', '', true), ); $vc_response = $captcha->validate($captcha_data); if ($vc_response) -- cgit v1.2.1 From 19a236205f6e0892be4301b422f5da7479e12941 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 22 Feb 2015 22:44:50 +0100 Subject: [ticket/13647] Generate route links for faq PHPBB3-13647 --- phpBB/posting.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index ecd9e9f6c0..9768dc6ea7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1720,6 +1720,8 @@ if (isset($captcha) && $captcha->is_solved() !== false) $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; add_form_key('posting'); +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); // Build array of variables for main posting page $page_data = array( @@ -1734,7 +1736,7 @@ $page_data = array( 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], -- cgit v1.2.1 From 07231e7943e9ffdba08393be56510e682ab7a7e5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 16 May 2015 22:06:37 +0200 Subject: [ticket/13844] FAQ in new controller format PHPBB3-13844 --- 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 2d01922c80..fd09f5e464 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1743,7 +1743,7 @@ $page_data = array( 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], - 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], -- cgit v1.2.1 From c1777f481101c0a311939f83f2afd38a0c09e394 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 18 May 2015 03:57:48 +0200 Subject: [ticket/11530] Remove extra quotes when depth limit is exceeded PHPBB3-11530 --- phpBB/posting.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 2d01922c80..a4fb4d7a8d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1578,11 +1578,22 @@ if (!sizeof($error) && $preview) } } +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0 && preg_match('#^<[rt][ >]#', $message_parser->message)) +{ + $message_parser->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $message_parser->message, + 'quote', + $config['max_quote_depth'] - 1 + ); +} + // Decode text for message display $post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); -if ($mode == 'quote' && !$submit && !$preview && !$refresh) +if ($generate_quote) { if ($config['allow_bbcode']) { -- cgit v1.2.1 From 8a077e0e943d87ee1d26b0501f0b9bcc472ab904 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 17 May 2015 20:15:06 +0200 Subject: [ticket/13847] Move quote generation to text_formatter.utils PHPBB3-13847 --- phpBB/posting.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index a4fb4d7a8d..4d52da2567 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1597,7 +1597,11 @@ if ($generate_quote) { if ($config['allow_bbcode']) { - $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text(trim($message_parser->message)), + array('author' => $post_data['quote_username']) + ); + $message_parser->message .= "\n"; } else { -- cgit v1.2.1 From 2f0d11ba3c28f27e535988de2a8d08f7b17aef92 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sat, 30 May 2015 22:17:14 +0200 Subject: [ticket/13901] Add more whitespace to long quotes for readability PHPBB3-13901 --- phpBB/posting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 1c7b756fc2..4f4c6cd373 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1598,10 +1598,10 @@ if ($generate_quote) if ($config['allow_bbcode']) { $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote( - censor_text(trim($message_parser->message)), + censor_text($message_parser->message), array('author' => $post_data['quote_username']) ); - $message_parser->message .= "\n"; + $message_parser->message .= "\n\n"; } else { -- cgit v1.2.1 From eb227977d27839bb0e2f1826084e00b667659e25 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 1 Jun 2015 02:24:48 +0200 Subject: [ticket/13906] Fixed old signatures in post preview PHPBB3-13906 --- phpBB/posting.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 1c7b756fc2..5b0e3d1da6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1487,14 +1487,11 @@ if (!sizeof($error) && $preview) // Signature if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) { - $parse_sig = new parse_message($preview_signature); - $parse_sig->bbcode_uid = $preview_signature_uid; - $parse_sig->bbcode_bitfield = $preview_signature_bitfield; - - // Not sure about parameters for bbcode/smilies/urls... in signatures - $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']); - $preview_signature = $parse_sig->message; - unset($parse_sig); + $flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0; + $flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0; + + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false); } else { -- cgit v1.2.1 From f02cc27014c27acaf44b27066959426db27b3493 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 16 Jun 2015 08:16:56 +0200 Subject: [ticket/10620] Implemented quote improvements PHPBB3-10620 --- phpBB/posting.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 2f9beefcf9..327004b1bf 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1605,7 +1605,12 @@ if ($generate_quote) { $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote( censor_text($message_parser->message), - array('author' => $post_data['quote_username']) + array( + 'author' => $post_data['quote_username'], + 'post_id' => $post_data['post_id'], + 'time' => $post_data['post_time'], + 'user_id' => $post_data['poster_id'], + ) ); $message_parser->message .= "\n\n"; } -- cgit v1.2.1 From 7d31232846e29311e5b76bf32f41f64da7985a79 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 16 Jul 2014 18:31:12 +0200 Subject: [ticket/8708] Apply permission 'f_announce_global' PHPBB3-8708 --- 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 7f89bdbadf..52cd1093c0 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1202,6 +1202,9 @@ if ($submit || $preview || $refresh) switch ($post_data['topic_type']) { case POST_GLOBAL: + $auth_option = 'f_announce_global'; + break; + case POST_ANNOUNCE: $auth_option = 'f_announce'; break; -- cgit v1.2.1 From 16d5208d9aec0678b3295b0e14042991094197ba Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 20 Sep 2015 12:36:52 +0200 Subject: [ticket/14168] Use attachment upload class in message_parser PHPBB3-14168 --- phpBB/posting.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 47fdb2d378..05a078ea39 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -571,7 +571,6 @@ $plupload = $phpbb_container->get('plupload'); /* @var $mimetype_guesser \phpbb\mimetype\guesser */ $mimetype_guesser = $phpbb_container->get('mimetype.guesser'); $message_parser->set_plupload($plupload); -$message_parser->set_mimetype_guesser($mimetype_guesser); if (isset($post_data['post_text'])) { -- cgit v1.2.1 From 75e5e2471e7b6b9e1d605f0c3cce5f1fbd373ac0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 12 Oct 2015 21:56:09 +0200 Subject: [ticket/14234] Get rid of undefined variables PHPBB3-14234 --- phpBB/posting.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 47fdb2d378..a8e4e4015e 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1256,7 +1256,6 @@ if ($submit || $preview || $refresh) * @var array poll Array with poll data from post (must be used instead of the post_data equivalent) * @var string mode What action to take if the form is submitted * post|reply|quote|edit|delete|bump|smilies|popup - * @var string page_title Title of the mode page * @var int post_id ID of the post * @var int topic_id ID of the topic * @var int forum_id ID of the forum @@ -1265,12 +1264,12 @@ if ($submit || $preview || $refresh) * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 * @change 3.1.5-RC1 Added poll array to the event + * @change 3.2.0-a1 Removed undefined page_title */ $vars = array( 'post_data', 'poll', 'mode', - 'page_title', 'post_id', 'topic_id', 'forum_id', @@ -1383,7 +1382,6 @@ if ($submit || $preview || $refresh) * @var array data Array with post data going to be stored in the database * @var string mode What action to take if the form is submitted * post|reply|quote|edit|delete - * @var string page_title Title of the mode page * @var int post_id ID of the post * @var int topic_id ID of the topic * @var int forum_id ID of the forum @@ -1393,13 +1391,13 @@ if ($submit || $preview || $refresh) * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title */ $vars = array( 'post_data', 'poll', 'data', 'mode', - 'page_title', 'post_id', 'topic_id', 'forum_id', @@ -1421,7 +1419,6 @@ if ($submit || $preview || $refresh) * @var array data Array with post data going to be stored in the database * @var string mode What action to take if the form is submitted * post|reply|quote|edit|delete - * @var string page_title Title of the mode page * @var int post_id ID of the post * @var int topic_id ID of the topic * @var int forum_id ID of the forum @@ -1432,13 +1429,13 @@ if ($submit || $preview || $refresh) * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title */ $vars = array( 'post_data', 'poll', 'data', 'mode', - 'page_title', 'post_id', 'topic_id', 'forum_id', -- cgit v1.2.1 From b0bedce6621bdf0febdac5e267091fe7ebd88dab Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Thu, 10 Mar 2016 06:48:36 -0500 Subject: [ticket/13972] Remove hard coded flood check from posting PHPBB3-13972 --- 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 6cfb877f75..692f3c8092 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -104,7 +104,7 @@ $vars = array( extract($phpbb_dispatcher->trigger_event('core.modify_posting_parameters', compact($vars))); // Was cancel pressed? If so then redirect to the appropriate page -if ($cancel || ($current_time - $lastclick < 2 && $submit)) +if ($cancel) { $f = ($forum_id) ? 'f=' . $forum_id . '&' : ''; $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx"))); -- cgit v1.2.1 From c2836725f9692e907d77edce7c609142661af6c1 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 17:58:59 +0100 Subject: [ticket/13429] Replace @changed with @change in event docblocks PHPBB3-13429 --- phpBB/posting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index db580d926b..6f8225c198 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -373,7 +373,7 @@ switch ($mode) * @var bool is_authed Does the user have the required permissions? * @var array post_data All post data from database * @since 3.1.3-RC1 -* @changed 3.1.10-RC1 Added post_data +* @change 3.1.10-RC1 Added post_data */ $vars = array( 'post_id', @@ -1385,7 +1385,7 @@ if ($submit || $preview || $refresh) * @var bool update_subject Boolean if the post subject was changed * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1424,7 +1424,7 @@ if ($submit || $preview || $refresh) * @var string redirect_url URL the user is going to be redirected to * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', -- cgit v1.2.1 From fbcbd79d79c5510d3943e0e1068801a8ea62146d Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 21 Dec 2016 14:41:53 +0100 Subject: [ticket/14929] Add error to core.posting_modify_message_text PHPBB3-14929 --- 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 db580d926b..90e52b3de8 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -941,7 +941,9 @@ if ($submit || $preview || $refresh) * is posting a new topic or editing a post) * @var bool refresh Whether or not to retain previously submitted data * @var object message_parser The message parser object + * @var array error Array of errors * @since 3.1.2-RC1 + * @changed 3.1.11-RC1 Added error */ $vars = array( 'post_data', @@ -956,6 +958,7 @@ if ($submit || $preview || $refresh) 'cancel', 'refresh', 'message_parser', + 'error', ); extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); -- cgit v1.2.1 From f82299b8e445cccfc8bad8cbe6505f3fb50d0f8f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 6 Jan 2017 19:52:17 +0100 Subject: [ticket/14962] Introduces a new helper to check emptyness of bbcode texts PHPBB3-14962 --- phpBB/posting.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index b0aef2482a..aa10059796 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -816,6 +816,7 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_ load_drafts($topic_id, $forum_id); } +$bbcode_utils = $phpbb_container->get('text_formatter.utils'); if ($submit || $preview || $refresh) { @@ -1178,7 +1179,7 @@ if ($submit || $preview || $refresh) $post_data['poll_title'] = ''; $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; } - else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != '')) + else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && !$bbcode_utils->is_empty($original_poll_data['poll_title'])) { // We have a poll but the editing user is not permitted to create/edit it. // So we just keep the original poll-data. @@ -1601,7 +1602,7 @@ if ($generate_quote) if ($config['allow_bbcode']) { - $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote( + $message_parser->message = $bbcode_utils->generate_quote( censor_text($message_parser->message), array( 'author' => $post_data['quote_username'], @@ -1639,7 +1640,7 @@ $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; $post_data['post_text'] = $message_parser->message; -if (sizeof($post_data['poll_options']) || !empty($post_data['poll_title'])) +if (sizeof($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) { $message_parser->message = $post_data['poll_title']; $message_parser->bbcode_uid = $post_data['bbcode_uid']; -- cgit v1.2.1 From 779758f2195f87868da3694b5ffd00adee1be0b3 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 4 Dec 2016 17:30:42 +0100 Subject: [ticket/13429] Replace @change with @changed PHPBB3-13429 --- phpBB/posting.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 6f8225c198..18d17b8006 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -84,7 +84,7 @@ $current_time = time(); * NOTE: Should be actual language strings, NOT * language keys. * @since 3.1.0-a1 -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist */ $vars = array( 'post_id', @@ -373,7 +373,7 @@ switch ($mode) * @var bool is_authed Does the user have the required permissions? * @var array post_data All post data from database * @since 3.1.3-RC1 -* @change 3.1.10-RC1 Added post_data +* @changed 3.1.10-RC1 Added post_data */ $vars = array( 'post_id', @@ -1261,7 +1261,7 @@ if ($submit || $preview || $refresh) * @var array error Any error strings; a non-empty array aborts form submission. * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @change 3.1.5-RC1 Added poll array to the event + * @changed 3.1.5-RC1 Added poll array to the event */ $vars = array( 'post_data', @@ -1385,7 +1385,7 @@ if ($submit || $preview || $refresh) * @var bool update_subject Boolean if the post subject was changed * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1424,7 +1424,7 @@ if ($submit || $preview || $refresh) * @var string redirect_url URL the user is going to be redirected to * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1869,13 +1869,13 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ * posting page via $template->assign_vars() * @var object message_parser The message parser object * @since 3.1.0-a1 -* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, * s_topic_icons, form_enctype, s_action, s_hidden_fields, * post_id, topic_id, forum_id, submit, preview, save, load, * delete, cancel, refresh, error, page_data, message_parser -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist -* @change 3.1.5-RC1 Added poll variables to the page_data array -* @change 3.1.6-RC1 Added 'draft_id' var +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.5-RC1 Added poll variables to the page_data array +* @changed 3.1.6-RC1 Added 'draft_id' var */ $vars = array( 'post_data', -- cgit v1.2.1