From 5ada47195a49c29be7d732ff5b05205de3cc25b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 May 2022 15:48:50 +0200 Subject: [PATCH] FIX Link to social network --- htdocs/core/lib/functions.lib.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 299dacd91d6..7454923f94a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3012,8 +3012,16 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor } } else { if (!empty($dictsocialnetworks[$type]['url'])) { + $tmpvirginurl = preg_replace('/\/?{socialid}/', '', $dictsocialnetworks[$type]['url']); + if ($tmpvirginurl) { + $value = preg_replace('/'.preg_quote($tmpvirginurl, '/').'\/?/', '', $value); + } $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']); - $htmllink .= ' '.dol_escape_htmltag($value).''; + if (preg_match('/^https?:\/\//i', $link)) { + $htmllink .= ' '.dol_escape_htmltag($value).''; + } else { + $htmllink .= ' '.dol_escape_htmltag($value).''; + } } else { $htmllink .= dol_escape_htmltag($value); }