diff options
author | 3D-I <480857+3D-I@users.noreply.github.com> | 2020-01-02 20:34:42 +0100 |
---|---|---|
committer | 3D-I <480857+3D-I@users.noreply.github.com> | 2020-01-02 20:35:48 +0100 |
commit | 0f3dbe1a30fa0ff6abe05bf0cad081a23a1ff131 (patch) | |
tree | 4c4ab7bda0933aec28db6d91447b0ca055474fe6 /phpBB/posting.php | |
parent | Merge branch 'prep-release-3.2.9' into 3.2.x (diff) | |
download | phpbb-0f3dbe1a30fa0ff6abe05bf0cad081a23a1ff131.tar.gz phpbb-0f3dbe1a30fa0ff6abe05bf0cad081a23a1ff131.tar.bz2 phpbb-0f3dbe1a30fa0ff6abe05bf0cad081a23a1ff131.zip |
[ticket/15079] Fix Emoji and rich text in Draft subject
PHPBB3-15079
Diffstat (limited to 'phpBB/posting.php')
-rw-r--r-- | phpBB/posting.php | 23 |
1 files changed, 23 insertions, 0 deletions
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('<br>', $matches[0]); + + trigger_error($user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list)); + } + } + if ($subject && $message) { if (confirm_box(true)) |