]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
When converting to HTML, hashtag addresses are now removed (only when the message...
[friendica.git] / include / bbcode.php
index ebed0dbb255b60da06dd387f907de0c693193736..d16dcb6a7fcf7417a1b3ad9d168ccf10854c52af 100644 (file)
@@ -643,7 +643,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
 
        // fix any escaped ampersands that may have been converted into links
        $Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
-       $Text = preg_replace("/\<([^>]*?)(src|href)=\"[^hfm](.*?)\>/ism",'<$1$2="">',$Text);
+       $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
 
        if($saved_image)
                $Text = bb_replace_images($Text, $saved_image);
@@ -668,6 +668,12 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
 //             $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES');
        //}
 
+       // Remove all hashtag addresses
+       if (!$tryoembed) {
+               $pattern = '/#<a.*?href="(.*?)".*?>(.*?)<\/a>/is';
+               $Text = preg_replace($pattern, '#$2', $Text);
+       }
+
        call_hooks('bbcode',$Text);
 
        $a->save_timestamp($stamp1, "parser");