diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-18 16:41:43 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-29 13:56:31 +0200 |
commit | d5525a38f185e37fe0101bc7ef6e67abf59f98f8 (patch) | |
tree | 9742988595a30be5d45dbb82ee7285a429f03929 /Zotlabs/Lib/MarkdownSoap.php | |
parent | e9a5af6109a4a83a644432a2f39b47eb96303f4f (diff) | |
download | volse-hubzilla-d5525a38f185e37fe0101bc7ef6e67abf59f98f8.tar.gz volse-hubzilla-d5525a38f185e37fe0101bc7ef6e67abf59f98f8.tar.bz2 volse-hubzilla-d5525a38f185e37fe0101bc7ef6e67abf59f98f8.zip |
various input filter fixes
Diffstat (limited to 'Zotlabs/Lib/MarkdownSoap.php')
-rw-r--r-- | Zotlabs/Lib/MarkdownSoap.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Zotlabs/Lib/MarkdownSoap.php b/Zotlabs/Lib/MarkdownSoap.php index 2dcaaec9a..8cc18d513 100644 --- a/Zotlabs/Lib/MarkdownSoap.php +++ b/Zotlabs/Lib/MarkdownSoap.php @@ -34,9 +34,13 @@ class MarkdownSoap { function clean() { + $x = $this->extract_code($this->str); + $x = $this->purify($x); + $x = $this->putback_code($x); + $x = $this->escape($x); return $x; @@ -60,7 +64,7 @@ class MarkdownSoap { } function encode_code($matches) { - return $this->token . ';' . base64_encode($matches[1]) . ';' ; + return $this->token . ';' . base64_encode($matches[0]) . ';' ; } function decode_code($matches) { @@ -73,7 +77,13 @@ class MarkdownSoap { } function purify($s) { - return purify_html($s); + $s = str_replace("\n",'<br>',$s); + $s = str_replace("\t",' ',$s); + $s = str_replace(' ',' ',$s); + $s = purify_html($s); + $s = str_replace(' '," ",$s); + $s = str_replace(['<br>','<br />'],["\n","\n"],$s); + return $s; } function escape($s) { |