@@ -3943,46 +3943,18 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
39433943 $htmllink .= ($link ? ' '.$link : '');
39443944 }
39453945 } else {
3946- $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($type).'_URL';
3947- if (getDolGlobalString($networkconstname)) {
3948- $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname));
3949- if (preg_match('/^https?:\/\//i', $link)) {
3950- $htmllink .= '<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
3951- } else {
3952- $htmllink .= '<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
3953- }
3954- } elseif (!empty($dictsocialnetworks[$type]['url'])) {
3955- $tmpvirginurl = preg_replace('/\/?{socialid}/', '', $dictsocialnetworks[$type]['url']);
3956- if ($tmpvirginurl) {
3957- $value = preg_replace('/^www\.'.preg_quote($tmpvirginurl, '/').'\/?/', '', $value);
3958- $value = preg_replace('/^'.preg_quote($tmpvirginurl, '/').'\/?/', '', $value);
3959-
3960- $tmpvirginurl3 = preg_replace('/^https:\/\//i', 'https://www.', $tmpvirginurl);
3961- if ($tmpvirginurl3) {
3962- $value = preg_replace('/^www\.'.preg_quote($tmpvirginurl3, '/').'\/?/', '', $value);
3963- $value = preg_replace('/^'.preg_quote($tmpvirginurl3, '/').'\/?/', '', $value);
3964- }
3965-
3966- $tmpvirginurl2 = preg_replace('/^https?:\/\//i', '', $tmpvirginurl);
3967- if ($tmpvirginurl2) {
3968- $value = preg_replace('/^www\.'.preg_quote($tmpvirginurl2, '/').'\/?/', '', $value);
3969- $value = preg_replace('/^'.preg_quote($tmpvirginurl2, '/').'\/?/', '', $value);
3970- }
3971- }
3946+ if (!empty($dictsocialnetworks[$type]['url'])) {
39723947 $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
3973- if (preg_match('/^https?:\/\//i', $link )) {
3974- $htmllink .= '<a href="'.dol_sanitizeUrl($link , 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
3948+ if (preg_match('/^https?:\/\//i', $value )) {
3949+ $htmllink .= '<a href="'.dol_sanitizeUrl($value , 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
39753950 } else {
3976- $htmllink .= '<a href="'.dol_sanitizeUrl($link, 1 ).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
3951+ $htmllink .= '<a href="'.dol_sanitizeUrl($link, 0 ).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
39773952 }
39783953 } else {
39793954 $htmllink .= dol_escape_htmltag($value);
39803955 }
39813956 }
39823957 $htmllink .= '</div>';
3983- } else {
3984- $langs->load("errors");
3985- $htmllink .= img_warning($langs->trans("ErrorBadSocialNetworkValue", $value));
39863958 }
39873959 return $htmllink;
39883960}
0 commit comments