diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-11-05 16:08:18 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-11-05 16:08:18 -0800 |
commit | 001e4276d31149e07cef31e468dcc1e227e0eda9 (patch) | |
tree | 8663bc99a62f28e810566130418b0174c65cce77 /include | |
parent | 0db5a8673d57088ab394cdaf372fb81dbd78bcbb (diff) | |
download | volse-hubzilla-001e4276d31149e07cef31e468dcc1e227e0eda9.tar.gz volse-hubzilla-001e4276d31149e07cef31e468dcc1e227e0eda9.tar.bz2 volse-hubzilla-001e4276d31149e07cef31e468dcc1e227e0eda9.zip |
first cut at some much better hook documentation derived from bamfic's automated list (doc/hooks.html)
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 517f22bee..05802aa57 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -599,6 +599,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1" target="_newwin" >$2</a>', $Text); } + // leave open the posibility of [map=something] // this is replaced in prepare_body() which has knowledge of the item location @@ -983,7 +984,12 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace('/\[\&\;([#a-z0-9]+)\;\]/', '&$1;', $Text); // fix any escaped ampersands that may have been converted into links - $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism", '<$1$2=$3&$4>', $Text); + + if(strpos($Text,'&') !== false) + $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism", '<$1$2=$3&$4>', $Text); + + // This is subtle - it's an XSS filter. It only accepts links with a protocol scheme and where + // the scheme begins with z (zhttp), h (http(s)), f (ftp), m (mailto), and named anchors. $Text = preg_replace("/\<(.*?)(src|href)=\"[^zhfm#](.*?)\>/ism", '<$1$2="">', $Text); |