diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php
index 486453e..e1189e7 100644
--- a/Rocksolid_Light/rocksolid/lib/message.inc.php
+++ b/Rocksolid_Light/rocksolid/lib/message.inc.php
@@ -702,7 +702,7 @@ function message_show($group,$id,$attachment=0,$article_data=false,$maxlen=false
for($j=@$body[$i]->depth; $j<$depth; $j++)
echo '';
$t = @$body[$i]->text;
- echo $t;
+ echo display_links_in_body($t);
$currentlen+=strlen($t);
echo "\n";
$depth=@$body[$i]->depth;
diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php
index fe0b200..31ce5ae 100644
--- a/Rocksolid_Light/rocksolid/newsportal.php
+++ b/Rocksolid_Light/rocksolid/newsportal.php
@@ -995,32 +995,35 @@ function html_parse($text)
$is_link = 0;
for ($i = 0; $i < $n; $i ++) {
$word = $words[$i];
- if (preg_match('/(https?|ftp|news|gopher|telnet)\:\/\/[^\",]+/i', $word)) {
- $is_link = 1;
- $nlink = trim($word, '().,');
- $nlink = preg_replace('/(\<|\>|\ );/', '', $nlink);
- $nlink = preg_replace('/\[url=/', '', $nlink);
- $bbnlink = explode(']', $nlink);
- $nlink = $bbnlink[0];
- $nword = '' . $nlink . '';
- if (isset($bbnlink[1])) {
- $nword .= ' ' . $bbnlink[1];
- }
- if ($nword != $word && substr($nlink, strlen($nlink) - 3) != "://") {
- $word = $nword;
- }
- }
// add the spaces between the words
if ($i > 0)
$ntext .= " ";
- if ($is_link) {
- $word = preg_replace('/\[\/url\]/', '', $word);
- }
$ntext .= $word;
}
return ($ntext);
}
+function display_links_in_body($text)
+{
+ preg_match_all('/(https?|ftp|scp|news|gopher|telnet):\/\/[a-zA-Z0-9.?%=\-\+\;\:\~\@\!\#&_\/]+/', $text, $matches);
+ $found = array();
+ foreach ($matches[0] as $match) {
+ if (! $match) {
+ continue;
+ }
+ if (in_array($match, $found)) {
+ continue;
+ }
+ $found[] = $match;
+ $linkurl = preg_replace("/(<|>)/", ' ', htmlspecialchars_decode($match));
+ $url = preg_replace("/(<|>)/", ' ', $match);
+ $pattern = preg_quote($url);
+ $pattern = "!$pattern!";
+ $text = preg_replace($pattern, '' . $url . '', $text, 1);
+ }
+ echo $text;
+}
+
/*
* read the header of an article in plaintext into an array
* $articleNumber can be the number of an article or its message-id.