diff options
-rw-r--r-- | include/text.php | 9 | ||||
-rw-r--r-- | include/xchan.php | 2 |
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), |