mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
- BBCode parsing order should ALWAYS be censor_text(), bbcode_secon_pass(), bbcode_nl2br(), smiley_text(), parse_attachments()
- using \r on custom bbcodes to allow line breaks [Bug #10758] git-svn-id: file:///svn/phpbb/trunk@8050 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -2571,8 +2571,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags)
|
||||
$bbcode->bbcode_second_pass($text, $uid);
|
||||
}
|
||||
|
||||
$text = str_replace("\n", '<br />', $text);
|
||||
|
||||
$text = bbcode_nl2br($text);
|
||||
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
|
||||
|
||||
return $text;
|
||||
@@ -2813,6 +2812,17 @@ function censor_text($text)
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* custom version of nl2br which takes custom BBCodes into account
|
||||
*/
|
||||
function bbcode_nl2br($text)
|
||||
{
|
||||
// custom BBCodes might contain carriage returns so they
|
||||
// are not converted into <br /> so now revert that
|
||||
$text = str_replace(array("\n", "\r"), array('<br />', "\n"), $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Smiley processing
|
||||
*/
|
||||
@@ -2955,7 +2965,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
$size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] );
|
||||
$filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize);
|
||||
|
||||
$comment = str_replace("\n", '<br />', censor_text($attachment['attach_comment']));
|
||||
$comment = bbcode_nl2br(censor_text($attachment['attach_comment']));
|
||||
|
||||
$block_array += array(
|
||||
'UPLOAD_ICON' => $upload_icon,
|
||||
|
Reference in New Issue
Block a user