mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-23 17:10:53 +01:00
[ticket/16153] Enable Emojis and rich text in Topic title
PHPBB3-16153
This commit is contained in:
parent
4db585a4cb
commit
78c1957e48
@ -539,7 +539,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
{
|
||||
if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post']))
|
||||
{
|
||||
$last_post_subject = censor_text($row['forum_last_post_subject']);
|
||||
$last_post_subject = utf8_decode_ncr(censor_text($row['forum_last_post_subject']));
|
||||
|
||||
$last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);
|
||||
}
|
||||
else
|
||||
|
@ -1178,11 +1178,33 @@ if ($submit || $preview || $refresh)
|
||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||
}
|
||||
|
||||
// Check for out-of-bounds characters that are currently
|
||||
// not supported by utf8_bin in MySQL
|
||||
/**
|
||||
* Replace Emojis and other 4bit UTF-8 chars, not allowed by utf8_bin MySql, to NCR.
|
||||
* Using their Numeric Character Reference's Hexadecimal notation.
|
||||
* Doesn't interfere with Japanese or Cyrillic etc.
|
||||
*
|
||||
* @see https://www.w3.org/TR/xml11/
|
||||
* @see https://www.opentag.com/xfaq_charrep.htm
|
||||
*/
|
||||
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
|
||||
{
|
||||
$character_list = implode('<br />', $matches[0]);
|
||||
foreach ($matches as $key => $emoji)
|
||||
{
|
||||
$post_data['post_subject'] = str_replace($emoji, utf8_encode_ncr($emoji), $post_data['post_subject']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This should never happen again.
|
||||
* Leaving the fallback here just in case there will be the need of it.
|
||||
*
|
||||
* 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', $post_data['post_subject'], $matches))
|
||||
{
|
||||
$character_list = implode('<br>', $matches[0]);
|
||||
|
||||
$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user