mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 23:25:30 +02:00
fix custom bbcode html replacement to correctly replace references
It failed if there was a number directly after the token, resulting in $12345, where $1 was needed. Fixed by using ${x} also made sure that newlines within the html replacement are not replaced with <br />. git-svn-id: file:///svn/phpbb/trunk@6391 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d62e93ee30
commit
70dffaacbd
@ -290,7 +290,7 @@ class acp_bbcodes
|
|||||||
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
|
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
|
||||||
{
|
{
|
||||||
$repad = $pad + sizeof(array_unique($repad[0]));
|
$repad = $pad + sizeof(array_unique($repad[0]));
|
||||||
$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\$' . (\$1 + \$pad)", $replace);
|
$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\${' . (\$1 + \$pad) . '}'", $replace);
|
||||||
$pad = $repad;
|
$pad = $repad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ class acp_bbcodes
|
|||||||
$fp_replace = str_replace($token, $replace, $fp_replace);
|
$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_match);
|
||||||
$sp_replace = str_replace($token, '$' . ($n + 1), $sp_replace);
|
$sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fp_match = '!' . $fp_match . '!' . $modifiers;
|
$fp_match = '!' . $fp_match . '!' . $modifiers;
|
||||||
|
@ -155,6 +155,12 @@ class bbcode
|
|||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
// To circumvent replacing newlines with <br /> for the generated html,
|
||||||
|
// we just remove newlines here. We do not do this within the admin panel to
|
||||||
|
// let the admin lay out his html code nicely
|
||||||
|
$row['bbcode_tpl'] = str_replace(array("\n", "\r"), '', $row['bbcode_tpl']);
|
||||||
|
$row['second_pass_replace'] = str_replace(array("\n", "\r"), '', $row['second_pass_replace']);
|
||||||
|
|
||||||
$rowset[$row['bbcode_id']] = $row;
|
$rowset[$row['bbcode_id']] = $row;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user