]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix DFRN and bookmark detection
authorMichael Vogel <icarus@dabo.de>
Sun, 24 Apr 2016 15:00:19 +0000 (17:00 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 1 May 2016 11:48:52 +0000 (13:48 +0200)
include/bbcode.php
include/dfrn.php
include/plaintext.php
mod/item.php

index 8f19566b587850286e0959769b4b49e87d31dd13..70cd22d5f9c0eaa960c3aad0ac18a8f8e8f7a8e6 100644 (file)
@@ -38,6 +38,11 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
        if (!$data)
                return $Text;
 
+       if (isset($data["title"])) {
+               $data["title"] = strip_tags($data["title"]);
+               $data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
+       }
+
        if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) {
                $data["preview"] = $data["image"];
                $data["image"] = "";
index 14be7473056dbe173b307902ffa478bf570abf66..f6f43660296c39a555cfee7a7150fa37ea013eda 100644 (file)
@@ -1988,7 +1988,7 @@ class dfrn {
 
                $item["extid"] = $xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue;
 
-               if ($xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue == "true")
+               if ($xpath->query("dfrn:bookmark/text()", $entry)->item(0)->nodeValue == "true")
                        $item["bookmark"] = true;
 
                $notice_info = $xpath->query("statusnet:notice_info", $entry);
index 08581cf338f58244a03dd05a79c9e97a113020ac..39eed5111e12abca8523b7e6370b60c9a9a16d07 100644 (file)
@@ -136,29 +136,25 @@ function get_attachment_data($body) {
                $data["title"] = $title;
 
        $image = "";
-       if ($type != "video") {
-               preg_match("/image='(.*?)'/ism", $attributes, $matches);
-               if ($matches[1] != "")
-                       $image = $matches[1];
-
-               preg_match('/image="(.*?)"/ism', $attributes, $matches);
-               if ($matches[1] != "")
-                       $image = $matches[1];
-       }
+       preg_match("/image='(.*?)'/ism", $attributes, $matches);
+       if ($matches[1] != "")
+               $image = $matches[1];
+
+       preg_match('/image="(.*?)"/ism', $attributes, $matches);
+       if ($matches[1] != "")
+               $image = $matches[1];
 
        if ($image != "")
                $data["image"] = $image;
 
        $preview = "";
-       if ($type != "video") {
-               preg_match("/preview='(.*?)'/ism", $attributes, $matches);
-               if ($matches[1] != "")
-                       $preview = $matches[1];
-
-               preg_match('/preview="(.*?)"/ism', $attributes, $matches);
-               if ($matches[1] != "")
-                       $preview = $matches[1];
-       }
+       preg_match("/preview='(.*?)'/ism", $attributes, $matches);
+       if ($matches[1] != "")
+               $preview = $matches[1];
+
+       preg_match('/preview="(.*?)"/ism', $attributes, $matches);
+       if ($matches[1] != "")
+               $preview = $matches[1];
 
        if ($preview != "")
                $data["preview"] = $preview;
index 10877b00ac9e96fee73c623c29498b6d6af60821..86940cd69b9e917eb5eb48c633540d49a6e99500 100644 (file)
@@ -505,10 +505,11 @@ function item_post(&$a) {
                }
        }
 
-       // embedded bookmark in post? set bookmark flag
+       // embedded bookmark or attachment in post? set bookmark flag
 
        $bookmark = 0;
-       if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
+       $data = get_attachment_data($body);
+        if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) OR isset($data["type"])) {
                $objecttype = ACTIVITY_OBJ_BOOKMARK;
                $bookmark = 1;
        }