A free, self-hostable news aggregator…
Fix issue #61 : amélioration import OPML
Marien Fressinaud244026874aba
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.phpindex 7a34430ea..c67609d57 100755--- a/app/controllers/feedController.php+++ b/app/controllers/feedController.php@@ -190,6 +190,7 @@ class feedController extends ActionController {$nb_month_old = $this->view->conf->oldEntries ();$date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old);+ $error = false;$i = 0;foreach ($feeds as $feed) {try {@@ -207,17 +208,31 @@ class feedController extends ActionController {);if (!$feedDAO->searchByUrl ($values['url'])) {- $feedDAO->addFeed ($values);+ if (!$feedDAO->addFeed ($values)) {+ $error = true;+ }}} catch (FeedException $e) {+ $error = true;Log::record ($e->getMessage (), Log::ERROR);}}+ if ($error) {+ $res = 'Les flux ont été importés mais des erreurs sont survenus';+ } else {+ $res = 'Les flux ont été importés';+ }+ $notif = array (+ 'type' => 'good',+ 'content' => $res+ );+ Session::_param ('notification', $notif);+Request::forward (array (- 'c' => 'feed',- 'a' => 'actualize'- ));+ 'c' => 'configure',+ 'a' => 'importExport'+ ), true);}}diff --git a/lib/lib_rss.php b/lib/lib_rss.phpindex b9202755b..81a98590e 100644--- a/lib/lib_rss.php+++ b/lib/lib_rss.php@@ -124,7 +124,11 @@ function opml_import ($xml) {}if ($title) {- $cat = new Category ($title);+ $catDAO = new CategoryDAO ();+ $cat = $catDAO->searchByName ($title);+ if ($cat === false) {+ $cat = new Category ($title);+ }$categories[] = $cat;$feeds = array_merge ($feeds, getFeedsOutline ($outline, $cat->id ()));