diff options
author | Mario <mario@mariovavti.com> | 2019-11-07 09:14:51 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-07 09:14:51 +0100 |
commit | 9934dbfe69ba654a5377d276929c7cba89e6d39f (patch) | |
tree | bda76da6bd591588e895f252f7c91603f9ef3b38 | |
parent | 2a05bd9ed691437faabbfe130dbaab3dad878367 (diff) | |
parent | b6314c109dbfa134576beff9ed29254826e10223 (diff) | |
download | volse-hubzilla-9934dbfe69ba654a5377d276929c7cba89e6d39f.tar.gz volse-hubzilla-9934dbfe69ba654a5377d276929c7cba89e6d39f.tar.bz2 volse-hubzilla-9934dbfe69ba654a5377d276929c7cba89e6d39f.zip |
Merge branch 'dev' into 'dev'
Sanitize title on Atom/RSS feed import
See merge request hubzilla/core!1770
-rw-r--r-- | include/feedutils.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/feedutils.php b/include/feedutils.php index 5e52828c3..9f4d732bb 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -449,6 +449,18 @@ function get_atom_elements($feed, $item) { if (title_is_body($res['title'], $res['body'])) $res['title'] = ""; + else { + $res['title'] = bbcode($res['title'], [ 'tryoembed' => false ]); + $res['title'] = html2plain($res['title'], 0, true); + $res['title'] = html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8'); + $res['title'] = preg_replace("/https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@]+/", "", $res['title']); + while (strpos($res['title'], "\n") !== false) + $res['title'] = str_replace("\n", " ", $res['title']); + while (strpos($res['title'], " ") !== false) + $res['title'] = str_replace(" ", " ", $res['title']); + $res['title'] = trim($res['title']); + } + if($res['plink']) $base_url = implode('/', array_slice(explode('/',$res['plink']),0,3)); |