From: Michael Vogel Date: Tue, 23 Aug 2016 05:40:16 +0000 (+0200) Subject: Bugfix: Handle attachments with bbcode inside/handle the [p] bbcode X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=50dc7a6047c9bdf10d83970d5a624829e4c2eb1d;p=friendica.git Bugfix: Handle attachments with bbcode inside/handle the [p] bbcode --- diff --git a/include/bbcode.php b/include/bbcode.php index c22813922b..ed23253648 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -34,7 +34,6 @@ function bb_map_location($match) { function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { $data = get_attachment_data($Text); - if (!$data) return $Text; @@ -85,7 +84,7 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { $text .= $oembed; if (trim($data["description"]) != "") - $text .= sprintf('
%s
', trim($data["description"])); + $text .= sprintf('
%s
', trim(bbcode($data["description"]))); } } return $data["text"].$text.$data["after"]; @@ -921,6 +920,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal $Text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'
$1
',$Text); $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'
$1
',$Text); + // Check for paragraph + $Text = preg_replace("(\[p\](.*?)\[\/p\])ism",'

$1

',$Text); + // Check for bold text $Text = preg_replace("(\[b\](.*?)\[\/b\])ism",'$1',$Text); diff --git a/include/plaintext.php b/include/plaintext.php index 793f9935a7..539ef020df 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -82,7 +82,7 @@ function get_attachment_data($body) { $data = array(); - if (!preg_match("/(.*)\[attachment(.*)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) + if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) return get_old_attachment_data($body); $attributes = $match[2];