From 7d803142353fdb82fd027a29b9e4072b7bf57d60 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Fri, 24 Jan 2020 02:53:40 +0100 Subject: [ticket/16337] Fix Emoji in BBcode Helpline PHPBB3-16337 --- phpBB/includes/acp/acp_bbcodes.php | 2 +- phpBB/includes/functions_display.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index bd8df6a63b..d5d601a163 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -231,7 +231,7 @@ class acp_bbcodes 'bbcode_match' => $bbcode_match, 'bbcode_tpl' => $bbcode_tpl, 'display_on_posting' => $display_on_posting, - 'bbcode_helpline' => $bbcode_helpline, + 'bbcode_helpline' => utf8_encode_ucr($bbcode_helpline), 'first_pass_match' => $data['first_pass_match'], 'first_pass_replace' => $data['first_pass_replace'], 'second_pass_match' => $data['second_pass_match'], diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e4adce14fc..34e2d4cc78 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1119,7 +1119,7 @@ function display_custom_bbcodes() 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), 'BBCODE_TAG' => $row['bbcode_tag'], 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']), - 'BBCODE_HELPLINE' => $row['bbcode_helpline'], + 'BBCODE_HELPLINE' => utf8_decode_ncr($row['bbcode_helpline']), ); /** -- cgit v1.2.3-65-gdbad From f7797b89ed605812769e51afc8c529259bbf1b9d Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Fri, 24 Jan 2020 04:37:32 +0100 Subject: [ticket/16337] Fix Emoji in BBcode Helpline PHPBB3-16337 --- phpBB/includes/acp/acp_bbcodes.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index d5d601a163..a74bf03b1e 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -226,12 +226,18 @@ class acp_bbcodes trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + */ + $bbcode_helpline = utf8_encode_ucr($bbcode_helpline); + $sql_ary = array_merge($sql_ary, array( 'bbcode_tag' => $data['bbcode_tag'], 'bbcode_match' => $bbcode_match, 'bbcode_tpl' => $bbcode_tpl, 'display_on_posting' => $display_on_posting, - 'bbcode_helpline' => utf8_encode_ucr($bbcode_helpline), + 'bbcode_helpline' => $bbcode_helpline, 'first_pass_match' => $data['first_pass_match'], 'first_pass_replace' => $data['first_pass_replace'], 'second_pass_match' => $data['second_pass_match'], -- cgit v1.2.3-65-gdbad From 11e2cd925ba8f86afb3fa3afaea8ee15c2df7798 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Fri, 24 Jan 2020 04:46:37 +0100 Subject: [ticket/16337] Fix Emoji in BBcode Helpline PHPBB3-16337 --- phpBB/includes/functions_display.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 34e2d4cc78..0f6efca34e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1114,12 +1114,15 @@ function display_custom_bbcodes() $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; } + // Convert Numeric Character References to UTF-8 chars. + $row['bbcode_helpline'] = utf8_decode_ncr($row['bbcode_helpline']); + $custom_tags = array( 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), 'BBCODE_TAG' => $row['bbcode_tag'], 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']), - 'BBCODE_HELPLINE' => utf8_decode_ncr($row['bbcode_helpline']), + 'BBCODE_HELPLINE' => $row['bbcode_helpline'], ); /** -- cgit v1.2.3-65-gdbad