aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/MarkdownSoap.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-18 16:41:43 -0700
committerzotlabs <mike@macgirvin.com>2017-03-18 16:41:43 -0700
commit4afeefb5ce2119541a6d2a0a0b332c7a9a59a2b4 (patch)
treec481814a4031c480f99e480e00bbd7bb1c837f91 /Zotlabs/Lib/MarkdownSoap.php
parentd9037589407162f51578856b084baaa5353a8a04 (diff)
downloadvolse-hubzilla-4afeefb5ce2119541a6d2a0a0b332c7a9a59a2b4.tar.gz
volse-hubzilla-4afeefb5ce2119541a6d2a0a0b332c7a9a59a2b4.tar.bz2
volse-hubzilla-4afeefb5ce2119541a6d2a0a0b332c7a9a59a2b4.zip
various input filter fixes
Diffstat (limited to 'Zotlabs/Lib/MarkdownSoap.php')
-rw-r--r--Zotlabs/Lib/MarkdownSoap.php14
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",'&nbsp;&nbsp;&nbsp;&nbsp;',$s);
+ $s = str_replace(' ','&nbsp;',$s);
+ $s = purify_html($s);
+ $s = str_replace('&nbsp;'," ",$s);
+ $s = str_replace(['<br>','<br />'],["\n","\n"],$s);
+ return $s;
}
function escape($s) {