aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author3D-I <480857+3D-I@users.noreply.github.com>2019-09-08 03:29:27 +0200
committer3D-I <480857+3D-I@users.noreply.github.com>2019-09-08 03:29:51 +0200
commit6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e (patch)
tree5303bca669e3d362ed14636101ee0ce9e700ceda
parent4db585a4cb2e5359074a82ef088574609155294b (diff)
downloadforums-6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e.tar
forums-6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e.tar.gz
forums-6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e.tar.bz2
forums-6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e.tar.xz
forums-6600fc6cad5f6d43acdcc9a303be4ce91ed48f2e.zip
[ticket/16151] Enable Emojis and rich text in forum name
PHPBB3-16151
-rw-r--r--phpBB/includes/acp/acp_forums.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index cb0593b14a..0bbaf96dec 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -986,10 +986,30 @@ class acp_forums
$errors[] = $user->lang['FORUM_NAME_EMPTY'];
}
- // No Emojis
+ /**
+ * Replace Emojis and other 4bit UTF-8 chars not allowed by 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', $forum_data_ary['forum_name'], $matches))
+ {
+ foreach ($matches as $key => $emoji)
+ {
+ $forum_data_ary['forum_name'] = str_replace($emoji, utf8_encode_ncr($emoji), $forum_data_ary['forum_name']);
+ }
+ }
+
+ /**
+ * This should never happen again.
+ * Leaving the fallback hre just in case there will be the need of it.
+ */
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $forum_data_ary['forum_name'], $matches))
{
$character_list = implode('<br>', $matches[0]);
+
$errors[] = $user->lang('FORUM_NAME_EMOJI', $character_list);
}