]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: Handle attachments with bbcode inside/handle the [p] bbcode
authorMichael Vogel <icarus@dabo.de>
Tue, 23 Aug 2016 05:40:16 +0000 (07:40 +0200)
committerMichael Vogel <icarus@dabo.de>
Tue, 23 Aug 2016 05:40:16 +0000 (07:40 +0200)
include/bbcode.php
include/plaintext.php

index c22813922bee6fcc8965802ed26e5bfb07e11ac1..ed23253648e615e5613893409d24a4865582891a 100644 (file)
@@ -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('<blockquote>%s</blockquote></span>', trim($data["description"]));
+                               $text .= sprintf('<blockquote>%s</blockquote></span>', 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",'<h5>$1</h5>',$Text);
        $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$Text);
 
+       // Check for paragraph
+       $Text = preg_replace("(\[p\](.*?)\[\/p\])ism",'<p>$1</p>',$Text);
+
        // Check for bold text
        $Text = preg_replace("(\[b\](.*?)\[\/b\])ism",'<strong>$1</strong>',$Text);
 
index 793f9935a74ba061ce1b5b5ba4c8af7e90838dbf..539ef020df8571a7e49a8ec0b48b19a311bf061c 100644 (file)
@@ -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];