summaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-11-12 23:28:47 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-11-12 23:28:47 +0100
commit764946814f2b9af2022925d3edd185f9874c5357 (patch)
tree7fdd0a70d9d6f0ce06129612c563875949bf4f43 /app/Models/Feed.php
parenta235f003bd5b78f2c94ccbbe56614f5828918962 (diff)
force_feed option
By adding #force_feed at the end of the URL of a feed sent with a wrong content-type (mime) https://github.com/FreshRSS/FreshRSS/issues/456
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index bd1babeea..8f4b60097 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -210,6 +210,10 @@ class FreshRSS_Feed extends Minz_Model {
$url = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url);
}
$feed = customSimplePie();
+ if (substr($url, -11) === '#force_feed') {
+ $feed->force_feed(true);
+ $url = substr($url, 0, -11);
+ }
$feed->set_feed_url($url);
if (!$loadDetails) { //Only activates auto-discovery when adding a new feed
$feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
@@ -226,7 +230,7 @@ class FreshRSS_Feed extends Minz_Model {
$subscribe_url = $feed->subscribe_url(false);
$title = strtr(html_only_entity_decode($feed->get_title()), array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;')); //HTML to HTML-PRE //ENT_COMPAT except &
- $this->_name($title == '' ? $this->url : $title);
+ $this->_name($title == '' ? $url : $title);
$this->_website(html_only_entity_decode($feed->get_link()));
$this->_description(html_only_entity_decode($feed->get_description()));
@@ -235,7 +239,7 @@ class FreshRSS_Feed extends Minz_Model {
$subscribe_url = $feed->subscribe_url(true);
}
- if ($subscribe_url !== null && $subscribe_url !== $this->url) {
+ if ($subscribe_url !== null && $subscribe_url !== $url) {
if ($this->httpAuth != '') {
// on enlève les id si authentification HTTP
$subscribe_url = preg_replace('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url);