From 9f09d90c6dc49df74faa6e7184184f64fe541c94 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 27 Jul 2014 21:59:44 +0200 Subject: [PATCH] Better detection for links in the body that can be removed because of added information. --- include/items.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/items.php b/include/items.php index e9da49982..6a72320cd 100644 --- a/include/items.php +++ b/include/items.php @@ -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; }