diff options
author | Nils Adermann <naderman@naderman.de> | 2007-08-19 13:40:53 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2007-08-19 13:40:53 +0000 |
commit | d104d3d969d2fbc77f1004e0e5369e8c0c15738f (patch) | |
tree | 188b373ce8876398477e517f242a29ae72cab23e /phpBB/includes/functions.php | |
parent | b8b85e5aca616c1e4b43246daa97a11881fb218d (diff) | |
download | forums-d104d3d969d2fbc77f1004e0e5369e8c0c15738f.tar forums-d104d3d969d2fbc77f1004e0e5369e8c0c15738f.tar.gz forums-d104d3d969d2fbc77f1004e0e5369e8c0c15738f.tar.bz2 forums-d104d3d969d2fbc77f1004e0e5369e8c0c15738f.tar.xz forums-d104d3d969d2fbc77f1004e0e5369e8c0c15738f.zip |
- 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
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ab30aba48d..0f92a2f8ba 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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; @@ -2814,6 +2813,17 @@ function censor_text($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 */ function smiley_text($text, $force_option = false) @@ -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, |