aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-02 00:36:12 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-02 00:36:12 +0100
commitcae1efd552ed0618b13120e07c346cbe28cbd00a (patch)
tree173a36c7c889c45d1590f0942e5a776c65e84db0 /app/controllers/feedController.php
parent2232b03bb48a012d8d3902dd32c7612dc112e0f9 (diff)
Corrections quelques bugs + modif fichier config BDD + ajout fichier build.sh pour générer la lib Minz
Diffstat (limited to 'app/controllers/feedController.php')
-rwxr-xr-xapp/controllers/feedController.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
index 9a56e97cf..585405ee7 100755
--- a/app/controllers/feedController.php
+++ b/app/controllers/feedController.php
@@ -10,11 +10,11 @@ class feedController extends ActionController {
} else {
if (Request::isPost ()) {
$url = Request::param ('url_rss');
-
+
try {
$feed = new Feed ($url);
$feed->load ();
-
+
$feedDAO = new FeedDAO ();
$values = array (
'id' => $feed->id (),
@@ -26,7 +26,7 @@ class feedController extends ActionController {
'lastUpdate' => time ()
);
$feedDAO->addFeed ($values);
-
+
$entryDAO = new EntryDAO ();
$entries = $feed->entries ();
foreach ($entries as $entry) {
@@ -44,13 +44,21 @@ class feedController extends ActionController {
);
$entryDAO->addEntry ($values);
}
-
+
// notif
$notif = array (
'type' => 'good',
'content' => 'Le flux <em>' . $feed->url () . '</em> a bien été ajouté'
);
Session::_param ('notification', $notif);
+ } catch (FileNotExistException $e) {
+ Log::record ($e->getMessage (), Log::ERROR);
+ // notif
+ $notif = array (
+ 'type' => 'bad',
+ 'content' => 'Un problème de configuration a empêché l\'ajout du flux. Voir les logs pour plus d\'informations'
+ );
+ Session::_param ('notification', $notif);
} catch (Exception $e) {
// notif
$notif = array (
@@ -59,7 +67,7 @@ class feedController extends ActionController {
);
Session::_param ('notification', $notif);
}
-
+
Request::forward (array (), true);
}
}