diff options
author | Nils Adermann <naderman@naderman.de> | 2007-10-07 10:34:45 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2007-10-07 10:34:45 +0000 |
commit | ff509e3a036a75f03c975f5b8adedc0a1f639b4f (patch) | |
tree | 68ae42e486ffc659c8fda4b309e107ff92627042 | |
parent | 26cb8253142997efeaeb6b96d16ec97eb237644f (diff) | |
download | forums-ff509e3a036a75f03c975f5b8adedc0a1f639b4f.tar forums-ff509e3a036a75f03c975f5b8adedc0a1f639b4f.tar.gz forums-ff509e3a036a75f03c975f5b8adedc0a1f639b4f.tar.bz2 forums-ff509e3a036a75f03c975f5b8adedc0a1f639b4f.tar.xz forums-ff509e3a036a75f03c975f5b8adedc0a1f639b4f.zip |
- 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
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_bbcodes.php | 13 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 9 |
3 files changed, 22 insertions, 1 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1c1821fc8b..453d4c1c6d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -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 "Avatars Disabled" 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> diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 1b5de909c3..21370036ee 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -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); } diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 6610a5c441..ef73762582 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -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(':', '.'), array(':', '.'), $message); + $undid_bbcode_specialchars = true; + } + $message = preg_replace($preg['search'], $preg['replace'], $message); $preg = array('search' => array(), 'replace' => array()); } |