diff options
-rw-r--r-- | include/bbcode.php | 8 | ||||
-rw-r--r-- | include/text.php | 2 | ||||
-rw-r--r-- | include/zid.php | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 340fe6b25..345b5b025 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -85,12 +85,14 @@ function tryoembed($match) { function nakedoembed($match) { $url = ((count($match) == 2) ? $match[1] : $match[2]); - $o = oembed_fetch_url($url); + $strip_url = strip_escaped_zids($url); + + $o = oembed_fetch_url($strip_url); if ($o['type'] == 'error') - return $match[0]; + return str_replace($url,$strip_url,$match[0]); - return '[embed]' . $url . '[/embed]'; + return '[embed]' . $strip_url . '[/embed]'; } function tryzrlaudio($match) { diff --git a/include/text.php b/include/text.php index ede62f582..24f8e1623 100644 --- a/include/text.php +++ b/include/text.php @@ -3307,6 +3307,7 @@ function cleanup_bbcode($body) { * First protect any url inside certain bbcode tags so we don't double link it. */ + $body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body); @@ -3336,7 +3337,6 @@ function cleanup_bbcode($body) { $body = scale_external_images($body,false); - return $body; } diff --git a/include/zid.php b/include/zid.php index 5275c6d5a..fe06948ba 100644 --- a/include/zid.php +++ b/include/zid.php @@ -60,7 +60,7 @@ function zid($s, $address = '') { $url_match = true; if ($mine && $myaddr && (! $url_match)) - $zurl = $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); + $zurl = $s . (($num_slashes >= 3) ? '' : '/') . (($achar === '?') ? '?f=&' : '&') . 'zid=' . urlencode($myaddr); else $zurl = $s; @@ -103,6 +103,10 @@ function strip_zats($s) { return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s); } +function strip_escaped_zids($s) { + $x = preg_replace('/&\;zid=(.*?)(&|$)/ism','$2',$s); + return strip_query_param($x,'f'); +} function clean_query_string($s = '') { |