From 1063a67ae26be8fcd251eb8498a70f2163ebb094 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 9 Nov 2023 21:37:28 +0000 Subject: a possible fix for issue #1816 --- include/text.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/text.php b/include/text.php index 4088e85e1..27dd94bc5 100644 --- a/include/text.php +++ b/include/text.php @@ -894,6 +894,7 @@ function get_tags($s) { // ignore anything in [style= ] $s = preg_replace('/\[style=(.*?)\]/sm','',$s); + // ignore anything in [color= ], because it may contain color codes which are mistaken for tags $s = preg_replace('/\[color=(.*?)\]/sm','',$s); @@ -3061,7 +3062,10 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $bb_tag = (($xc['xchan_network'] === 'zot6') ? 'zrl' : 'url'); $newtag = '@' . (($exclusive) ? '!' : '') . '[' . $bb_tag . '=' . $profile . ']' . $newname . '[/' . $bb_tag . ']'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + + // Replace tag but make sure to not replace something in the middle of a word + $body = preg_replace('/(?