From b0586b4f4d2188eb995aad803722ddb25b4cc842 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 2 Jan 2020 20:07:55 +0100 Subject: [ticket/15712] Add Emoji and rich text in PM subject PHPBB3-15712 --- phpBB/includes/ucp/ucp_pm_compose.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 87a8c91fd2..0a40a74b9f 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -870,6 +870,12 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'address_list' => $address_list ); + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + */ + $subject = utf8_encode_ucr($subject); + // ((!$message_subject) ? $subject : $message_subject) $msg_id = submit_pm($action, $subject, $pm_data); -- cgit v1.2.3-65-gdbad From 0f3dbe1a30fa0ff6abe05bf0cad081a23a1ff131 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 2 Jan 2020 20:34:42 +0100 Subject: [ticket/15079] Fix Emoji and rich text in Draft subject PHPBB3-15079 --- phpBB/posting.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/phpBB/posting.php b/phpBB/posting.php index 57b52320a3..48c2d8da6a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -736,6 +736,29 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; $message = $request->variable('message', '', true); + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + * Check the permissions for posting Emojis first. + */ + if ($auth->acl_get('u_emoji')) + { + $subject = utf8_encode_ucr($subject); + } + else + { + /** + * Check for out-of-bounds characters that are currently + * not supported by utf8_bin in MySQL + */ + if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $subject, $matches)) + { + $character_list = implode('
', $matches[0]); + + trigger_error($user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list)); + } + } + if ($subject && $message) { if (confirm_box(true)) -- cgit v1.2.3-65-gdbad From 9f033cbf6dbd04553384f969fe0eefc61ab60258 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 2 Jan 2020 21:40:36 +0100 Subject: [ticket/15079] Fix Emoji and rich text in Draft subject User can save Emoji in drafts since the topic title is checked on post submission already. Moreover this way the draft can not be lost somehow. PHPBB3-15079 --- phpBB/posting.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 48c2d8da6a..27b75bf56d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -739,25 +739,8 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( /** * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. * Using their Numeric Character Reference's Hexadecimal notation. - * Check the permissions for posting Emojis first. */ - if ($auth->acl_get('u_emoji')) - { - $subject = utf8_encode_ucr($subject); - } - else - { - /** - * Check for out-of-bounds characters that are currently - * not supported by utf8_bin in MySQL - */ - if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $subject, $matches)) - { - $character_list = implode('
', $matches[0]); - - trigger_error($user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list)); - } - } + $subject = utf8_encode_ucr($subject); if ($subject && $message) { -- cgit v1.2.3-65-gdbad From f0ebd6da0f85bda3e468a2dbdf4e69fe8c5f950d Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Fri, 3 Jan 2020 00:05:14 +0100 Subject: [ticket/15712] Add Emoji and rich text in PM Draft subject Extends to Drafts PHPBB3-15712 --- phpBB/includes/ucp/ucp_pm_compose.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 0a40a74b9f..2e1ad3fdcf 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -665,6 +665,12 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $subject = (!$subject && $action != 'post') ? $user->lang['NEW_MESSAGE'] : $subject; $message = $request->variable('message', '', true); + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + */ + $subject = utf8_encode_ucr($subject); + if ($subject && $message) { if (confirm_box(true)) -- cgit v1.2.3-65-gdbad