mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge r10551 into 3.0.7: Make the new {INTTEXT} work on pcre installations without utf8 support, it only matches ascii characters & numbers there. [Bug #58055]
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_7@10552 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
33de245e64
commit
cb2d1bd4fc
1 changed files with 20 additions and 9 deletions
|
@ -317,6 +317,17 @@ class acp_bbcodes
|
|||
$bbcode_tpl = trim($bbcode_tpl);
|
||||
$utf8 = strpos($bbcode_match, 'INTTEXT') !== false;
|
||||
|
||||
// make sure we have utf8 support
|
||||
$utf8_pcre_properties = false;
|
||||
if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>=')))
|
||||
{
|
||||
// While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version
|
||||
if (@preg_match('/\p{L}/u', 'a') !== false)
|
||||
{
|
||||
$utf8_pcre_properties = true;
|
||||
}
|
||||
}
|
||||
|
||||
$fp_match = preg_quote($bbcode_match, '!');
|
||||
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
|
||||
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
|
||||
|
@ -344,7 +355,7 @@ class acp_bbcodes
|
|||
'!([a-zA-Z0-9-+.,_ ]+)!' => "$1"
|
||||
),
|
||||
'INTTEXT' => array(
|
||||
'!([\p{L}\p{N}\-+,_. ]+)!u' => "$1"
|
||||
($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u' => "$1"
|
||||
),
|
||||
'IDENTIFIER' => array(
|
||||
'!([a-zA-Z0-9-_]+)!' => "$1"
|
||||
|
@ -363,7 +374,7 @@ class acp_bbcodes
|
|||
'EMAIL' => '(' . get_preg_expression('email') . ')',
|
||||
'TEXT' => '(.*?)',
|
||||
'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
|
||||
'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)',
|
||||
'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)',
|
||||
'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
|
||||
'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
|
||||
'NUMBER' => '([0-9]+)',
|
||||
|
@ -371,7 +382,7 @@ class acp_bbcodes
|
|||
|
||||
$pad = 0;
|
||||
$modifiers = 'i';
|
||||
$modifiers .= ($utf8) ? 'u' : '';
|
||||
$modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : '';
|
||||
|
||||
if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue