From 3cbdc0d8754f41f037855589bb8d503a368fca53 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Wed, 16 Jun 2021 09:04:22 +0000 Subject: [PATCH] Cleanup creating links and add protocols --- Rocksolid_Light/rocksolid/newsportal.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index c60cfbb..e0fd040 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -883,11 +883,11 @@ function html_parse($text) { $n=count($words); for($i=0; $i<$n; $i++) { $word=$words[$i]; - if(preg_match('/https?\:\/\/[^\",]+/i', $word)) { - $nlink = preg_replace('/(\<|\>);/', '', $word); - $nlink = rtrim($nlink, '.'); + if(preg_match('/(https?|ftp|news|gopher|telnet)\:\/\/[^\",]+/i', $word)) { + $nlink = trim($word, '().'); + $nlink = preg_replace('/(\<|\>|\ );/', '', $nlink); $nword = ''.$word.''; - if($nword!=$word) { + if($nword!=$word && substr($nlink, strlen($nlink) - 3) != "://") { $word=$nword; } }