summaryrefslogtreecommitdiff
path: root/app/models/Feed.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-28 16:01:14 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-28 16:01:14 +0200
commit864318bf68b28ff6340701bce24e25768164e138 (patch)
treed42868498eb494992ab45ef8b7222aa20d16e2d1 /app/models/Feed.php
parent1bee8ad9a7c02c0f53d1f334467cb6d1e5044511 (diff)
Meilleure gestion des erreurs lors de l'ajout d'un flux RSS + les vidéos apparaissent maintenant dans les articles + si connexion paramétrée l'actualisation des flux n'est plus permis
Diffstat (limited to 'app/models/Feed.php')
-rw-r--r--app/models/Feed.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index e519a91cb..51c409b69 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -99,7 +99,7 @@ class Feed extends Model {
if (!is_null ($value) && filter_var ($value, FILTER_VALIDATE_URL)) {
$this->url = $value;
} else {
- throw new Exception ();
+ throw new BadUrlException ($value);
}
}
public function _category ($value) {
@@ -155,15 +155,23 @@ class Feed extends Model {
$feed->set_feed_url ($url);
$feed->set_cache_location (CACHE_PATH);
+ $feed->strip_htmltags (array (
+ 'base', 'blink', 'body', 'doctype',
+ 'font', 'form', 'frame', 'frameset', 'html',
+ 'input', 'marquee', 'meta', 'noscript',
+ 'param', 'script', 'style'
+ ));
$feed->init ();
- if ($feed->error()) {
+ if ($feed->error ()) {
throw new FeedException ($feed->error);
}
+ // si on a utilisé l'auto-discover, notre url va avoir changé
$subscribe_url = $feed->subscribe_url ();
if (!is_null ($subscribe_url) && $subscribe_url != $this->url) {
if ($this->httpAuth != '') {
+ // on enlève les id si authentification HTTP
$subscribe_url = preg_replace ('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url);
}
$this->_url ($subscribe_url);
@@ -172,6 +180,8 @@ class Feed extends Model {
$this->_name (!is_null ($title) ? $title : $this->url);
$this->_website ($feed->get_link ());
$this->_description ($feed->get_description ());
+
+ // et on charge les articles du flux
$this->loadEntries ($feed);
}
}