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

- Match custom BBCodes in the same way during first and second pass - patch provided by IBBoard [Bug #14268]

git-svn-id: file:///svn/phpbb/trunk@8153 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2007-10-07 10:34:45 +00:00
parent 26cb825314
commit ff509e3a03
3 changed files with 22 additions and 1 deletions

View File

@ -115,6 +115,7 @@
<li>[Change] Allow years in future be selected for date custom profile field (Bug#14519)</li>
<li>[Fix] Don't display &quot;Avatars Disabled&quot; message on edit groups in UCP (Bug #14636)</li>
<li>[Change] Require confirm for deleting inactive users. (Bug #14641)</li>
<li>[Fix] Match custom BBCodes in the same way during first and second pass - patch provided by IBBoard (Bug #14268)</li>
</ul>
<a name="v30rc4"></a><h3>1.ii. Changes since 3.0.RC4</h3>

View File

@ -331,6 +331,17 @@ class acp_bbcodes
)
);
$sp_tokens = array(
'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)',
'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
'EMAIL' => '([a-zA-Z0-9]+[a-zA-Z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-zA-Z0-9]+[a-zA-Z0-9\-\._]*\.[a-zA-Z]+))',
'TEXT' => '(.*?)',
'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
'NUMBER' => '([0-9]+)',
);
$pad = 0;
$modifiers = 'i';
@ -376,7 +387,7 @@ class acp_bbcodes
$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
$fp_replace = str_replace($token, $replace, $fp_replace);
$sp_match = str_replace(preg_quote($token, '!'), '(.*?)', $sp_match);
$sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);
$sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace);
}

View File

@ -80,6 +80,7 @@ class bbcode
$bitfield = new bitfield($this->bbcode_bitfield);
$bbcodes_set = $bitfield->get_all_set();
$undid_bbcode_specialchars = false;
foreach ($bbcodes_set as $bbcode_id)
{
if (!empty($this->bbcode_cache[$bbcode_id]))
@ -100,6 +101,14 @@ class bbcode
if (sizeof($preg['search']))
{
// we need to turn the entities back into their original form to allow the
// search patterns to work properly
if (!$undid_bbcode_specialchars)
{
$message = str_replace(array('&#58;', '&#46;'), array(':', '.'), $message);
$undid_bbcode_specialchars = true;
}
$message = preg_replace($preg['search'], $preg['replace'], $message);
$preg = array('search' => array(), 'replace' => array());
}