aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-15 10:54:59 +0000
committerMario <mario@mariovavti.com>2020-10-15 10:54:59 +0000
commit61f554e0d7820b19f7ecb7b6d216f3012dc23acf (patch)
treed4e1198e9a611da907b153ac8e83c386a12973d2 /include
parent3b252d98b89b884be995f6f90e31d7e6612cf522 (diff)
downloadvolse-hubzilla-61f554e0d7820b19f7ecb7b6d216f3012dc23acf.tar.gz
volse-hubzilla-61f554e0d7820b19f7ecb7b6d216f3012dc23acf.tar.bz2
volse-hubzilla-61f554e0d7820b19f7ecb7b6d216f3012dc23acf.zip
remove new lines and tabs from xchan_name
Diffstat (limited to 'include')
-rw-r--r--include/text.php9
-rw-r--r--include/xchan.php2
2 files changed, 10 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index 8bad8337f..af1473713 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3816,3 +3816,12 @@ function unserialise($x) {
return ((is_array($y)) ? $y : $x);
}
+/**
+ * @brief Remove new lines and tabs from strings.
+ *
+ * @return string
+ */
+function sanitize_text_field($str) {
+ return preg_replace('/\s+/S', ' ', $str);
+}
+
diff --git a/include/xchan.php b/include/xchan.php
index 8032dae2f..5de828e7f 100644
--- a/include/xchan.php
+++ b/include/xchan.php
@@ -25,7 +25,7 @@ function xchan_store_lowlevel($arr) {
'xchan_connurl' => ((array_key_exists('xchan_connurl',$arr)) ? $arr['xchan_connurl'] : ''),
'xchan_follow' => ((array_key_exists('xchan_follow',$arr)) ? $arr['xchan_follow'] : ''),
'xchan_connpage' => ((array_key_exists('xchan_connpage',$arr)) ? $arr['xchan_connpage'] : ''),
- 'xchan_name' => ((array_key_exists('xchan_name',$arr)) ? $arr['xchan_name'] : ''),
+ 'xchan_name' => ((array_key_exists('xchan_name',$arr)) ? sanitize_text_field($arr['xchan_name']) : ''),
'xchan_network' => ((array_key_exists('xchan_network',$arr)) ? $arr['xchan_network'] : ''),
'xchan_instance_url' => ((array_key_exists('xchan_instance_url',$arr)) ? $arr['xchan_instance_url'] : ''),
'xchan_flags' => ((array_key_exists('xchan_flags',$arr)) ? intval($arr['xchan_flags']) : 0),