]> git.mxchange.org Git - friendica.git/commitdiff
bloody ampersands
authorFriendika <info@friendika.com>
Thu, 15 Sep 2011 03:47:49 +0000 (20:47 -0700)
committerFriendika <info@friendika.com>
Thu, 15 Sep 2011 03:47:49 +0000 (20:47 -0700)
include/bbcode.php
include/text.php

index af6c10c4422daaf77180597cdc7883369e1cb3f4..3886af37dc29fde761d3a1f055b4fc590486446d 100644 (file)
@@ -43,7 +43,7 @@ function bbcode($Text,$preserve_nl = false) {
        // Perform URL Search
 
 
-       $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
+       $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
 
        $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/m", '<a href="$1" target="external-link">$1</a>', $Text);
        $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/m", '<a href="$1" target="external-link">$2</a>', $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)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
        
        call_hooks('bbcode',$Text);
 
index 2d65b681db4ed35c917e5978745a594f4836dc8a..501121c80227418a21f641d363754be8a5112ce4 100644 (file)
@@ -635,7 +635,8 @@ function valid_email($x){
 
 if(! function_exists('linkify')) {
 function linkify($s) {
-       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+       $s = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$s);
        return($s);
 }}