mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-04 21:44:57 +02:00
Merge pull request #5802 from 3D-I/ticket/16279
[ticket/16279] Add permission for Emoji in topic title
This commit is contained in:
commit
db5121511d
@ -156,6 +156,7 @@ $u_permissions = array(
|
|||||||
'u_download' => array(0, 1),
|
'u_download' => array(0, 1),
|
||||||
'u_attach' => array(0, 1),
|
'u_attach' => array(0, 1),
|
||||||
'u_sig' => array(0, 1),
|
'u_sig' => array(0, 1),
|
||||||
|
'u_emoji' => array(0, 1),
|
||||||
'u_pm_attach' => array(0, 1),
|
'u_pm_attach' => array(0, 1),
|
||||||
'u_pm_bbcode' => array(0, 1),
|
'u_pm_bbcode' => array(0, 1),
|
||||||
'u_pm_smilies' => array(0, 1),
|
'u_pm_smilies' => array(0, 1),
|
||||||
|
@ -420,6 +420,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1);
|
|||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
||||||
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_emoji', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm', 1);
|
||||||
|
@ -79,6 +79,7 @@ $lang = array_merge($lang, array(
|
|||||||
'ACL_U_SAVEDRAFTS' => 'Can save drafts',
|
'ACL_U_SAVEDRAFTS' => 'Can save drafts',
|
||||||
'ACL_U_CHGCENSORS' => 'Can disable word censors',
|
'ACL_U_CHGCENSORS' => 'Can disable word censors',
|
||||||
'ACL_U_SIG' => 'Can use signature',
|
'ACL_U_SIG' => 'Can use signature',
|
||||||
|
'ACL_U_EMOJI' => 'Can use emoji and rich text characters in topic title',
|
||||||
|
|
||||||
'ACL_U_SENDPM' => 'Can send private messages',
|
'ACL_U_SENDPM' => 'Can send private messages',
|
||||||
'ACL_U_MASSPM' => 'Can send private messages to multiple users',
|
'ACL_U_MASSPM' => 'Can send private messages to multiple users',
|
||||||
|
44
phpBB/phpbb/db/migration/data/v32x/user_emoji_permission.php
Normal file
44
phpBB/phpbb/db/migration/data/v32x/user_emoji_permission.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\db\migration\data\v32x;
|
||||||
|
|
||||||
|
class user_emoji_permission extends \phpbb\db\migration\migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT auth_option_id
|
||||||
|
FROM ' . ACL_OPTIONS_TABLE . "
|
||||||
|
WHERE auth_option = 'u_emoji'";
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$auth_option_id = $this->db->sql_fetchfield('auth_option_id');
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
return $auth_option_id !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function depends_on()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'\phpbb\db\migration\data\v32x\v329rc1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_data()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['permission.add', ['u_emoji']],
|
||||||
|
['permission.permission_set', ['REGISTERED', 'u_emoji', 'group']],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -234,6 +234,7 @@ class permissions
|
|||||||
'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'),
|
'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'),
|
||||||
'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'),
|
'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'),
|
||||||
'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'),
|
'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'),
|
||||||
|
'u_emoji' => array('lang' => 'ACL_U_EMOJI', 'cat' => 'post'),
|
||||||
|
|
||||||
'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'),
|
'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'),
|
||||||
'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'),
|
'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'),
|
||||||
|
@ -1184,21 +1184,24 @@ if ($submit || $preview || $refresh)
|
|||||||
/**
|
/**
|
||||||
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR.
|
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR.
|
||||||
* Using their Numeric Character Reference's Hexadecimal notation.
|
* Using their Numeric Character Reference's Hexadecimal notation.
|
||||||
|
* Check the permissions for posting Emojis first.
|
||||||
*/
|
*/
|
||||||
$post_data['post_subject'] = utf8_encode_ucr($post_data['post_subject']);
|
if ($auth->acl_get('u_emoji'))
|
||||||
|
|
||||||
/**
|
|
||||||
* 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]);
|
$post_data['post_subject'] = utf8_encode_ucr($post_data['post_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', $post_data['post_subject'], $matches))
|
||||||
|
{
|
||||||
|
$character_list = implode('<br>', $matches[0]);
|
||||||
|
|
||||||
$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);
|
$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0;
|
$post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user