]> git.mxchange.org Git - friendica.git/commitdiff
Better detection for links in the body that can be removed because of added information.
authorMichael Vogel <icarus@dabo.de>
Sun, 27 Jul 2014 19:59:44 +0000 (21:59 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 27 Jul 2014 19:59:44 +0000 (21:59 +0200)
include/items.php

index e9da49982baa5f09d2fccd79ff7843d1fe9ab12e..6a72320cd1edb72b1e7bed6d13233f17ab0f8ac8 100644 (file)
@@ -944,11 +944,12 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
        // Remove the link from the body if the link is attached at the end of the post
        if (isset($footer) AND (trim($footer) != "") AND (strpos($footer, $matches[1]))) {
                $removedlink = trim(str_replace($matches[1], "", $body));
-               if (strstr($body, $removedlink))
+               if (($removedlink == "") OR strstr($body, $removedlink))
                        $body = $removedlink;
 
-               $removedlink = trim(str_replace("[url]".$matches[1]."[/url]", "", $body));
-               if (strstr($body, $removedlink))
+               $url = str_replace(array('/', '.'), array('\/', '\.'), $matches[1]);
+               $removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $body);
+               if (($removedlink == "") OR strstr($body, $removedlink))
                        $body = $removedlink;
        }