1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/16524] Remove u_emoji permission checks

PHPBB3-16524
This commit is contained in:
rxu
2020-06-19 17:22:34 +07:00
committed by Marc Alexander
parent b1c6b3bc94
commit befab4f3c1
8 changed files with 7 additions and 122 deletions

View File

@@ -256,14 +256,10 @@ class manager
$cp_data['pf_' . $row['field_ident']] = $profile_field->get_profile_field($row);
/**
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL with UCR/NCR
* using their Numeric Character Reference's Hexadecimal notation.
* Check the permissions for using Emojis first.
* Replace Emoji and other 4bit UTF-8 chars not allowed by MySQL
* with their Numeric Character Reference's Hexadecimal notation.
*/
if ($this->auth->acl_get('u_emoji'))
{
$cp_data['pf_' . $row['field_ident']] = utf8_encode_ucr($cp_data['pf_' . $row['field_ident']]);
}
$cp_data['pf_' . $row['field_ident']] = utf8_encode_ucr($cp_data['pf_' . $row['field_ident']]);
$check_value = $cp_data['pf_' . $row['field_ident']];

View File

@@ -15,12 +15,6 @@ namespace phpbb\profilefields\type;
class type_string extends type_string_common
{
/**
* Auth object
* @var \phpbb\auth\auth
*/
protected $auth;
/**
* Request object
* @var \phpbb\request\request
@@ -42,14 +36,12 @@ class type_string extends type_string_common
/**
* Construct
*
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
{
$this->auth = $auth;
$this->request = $request;
$this->template = $template;
$this->user = $user;
@@ -107,17 +99,6 @@ class type_string extends type_string_common
*/
public function validate_profile_field(&$field_value, $field_data)
{
/**
* Check for out-of-bounds characters that are currently
* not supported by utf8_bin in MySQL if Emoji are not allowed
*/
if (!$this->auth->acl_get('u_emoji'))
{
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $field_value))
{
return $this->user->lang('FIELD_INVALID_CHARS_INVALID', $this->get_field_name($field_data['lang_name']));
}
}
return $this->validate_string_profile_field('string', $field_value, $field_data);
}

View File

@@ -15,12 +15,6 @@ namespace phpbb\profilefields\type;
class type_text extends type_string_common
{
/**
* Auth object
* @var \phpbb\auth\auth
*/
protected $auth;
/**
* Request object
* @var \phpbb\request\request
@@ -42,14 +36,12 @@ class type_text extends type_string_common
/**
* Construct
*
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
{
$this->auth = $auth;
$this->request = $request;
$this->template = $template;
$this->user = $user;
@@ -107,17 +99,6 @@ class type_text extends type_string_common
*/
public function validate_profile_field(&$field_value, $field_data)
{
/**
* Check for out-of-bounds characters that are currently
* not supported by utf8_bin in MySQL if Emoji are not allowed
*/
if (!$this->auth->acl_get('u_emoji'))
{
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $field_value))
{
return $this->user->lang('FIELD_INVALID_CHARS_INVALID', $this->get_field_name($field_data['lang_name']));
}
}
return $this->validate_string_profile_field('text', $field_value, $field_data);
}