From 1778e4a315dd386911d12513d6aa7dc569782f13 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 14 Sep 2011 20:47:49 -0700 Subject: [PATCH] bloody ampersands --- include/bbcode.php | 5 +++-- include/text.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index af6c10c442..3886af37dc 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -43,7 +43,7 @@ function bbcode($Text,$preserve_nl = false) { // Perform URL Search - $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\%\$\!\+\,]+)/", '$1$2', $Text); + $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/", '$1$2', $Text); $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/m", '$1', $Text); $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/m", '$2', $Text); @@ -159,7 +159,8 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); } - + // fix any escaped ampersands that may have been converted into links + $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text); call_hooks('bbcode',$Text); diff --git a/include/text.php b/include/text.php index 2d65b681db..501121c802 100644 --- a/include/text.php +++ b/include/text.php @@ -635,7 +635,8 @@ function valid_email($x){ if(! function_exists('linkify')) { function linkify($s) { - $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+]*)/", ' $1', $s); + $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' $1', $s); + $s = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$s); return($s); }}