summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-30 15:38:58 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-30 15:38:58 -0400
commiteda7f50864cd4e92b8541065e6ec0fa1f7d990ec (patch)
treee272b45e29ffa8cff434234e96b7cfcd41fcc34a
parent25051024bc3609ead82bddee50ddf129f6aa535f (diff)
fixes what broke in the last commit
-rw-r--r--ajax/updatefeed.php8
-rw-r--r--appinfo/app.php8
-rw-r--r--lib/utils.php23
-rw-r--r--opmlparser.php2
-rw-r--r--templates/test.php2
5 files changed, 19 insertions, 24 deletions
diff --git a/ajax/updatefeed.php b/ajax/updatefeed.php
index f503d9e91..fe286d3c1 100644
--- a/ajax/updatefeed.php
+++ b/ajax/updatefeed.php
@@ -23,8 +23,12 @@ $folderid = $_POST['folderid'];
$newfeed = OC_News_Utils::fetch($feedurl);
-$feedmapper = new OC_News_FeedMapper();
-$newfeedid = $feedmapper->save($newfeed, $folderid);
+$newfeedid = false;
+
+if ($newfeed !== null) {
+ $feedmapper = new OC_News_FeedMapper();
+ $newfeedid = $feedmapper->save($newfeed, $folderid);
+}
$l = OC_L10N::get('news');
diff --git a/appinfo/app.php b/appinfo/app.php
index ad529db9a..13b0643f3 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -21,16 +21,8 @@ OC::$CLASSPATH['OC_News_FolderMapper'] = 'apps/news/lib/foldermapper.php';
OC::$CLASSPATH['OC_News_Utils'] = 'apps/news/lib/utils.php';
-
$l = new OC_l10n('news');
-
-OCP\App::register( array(
- 'order' => 70,
- 'id' => 'news',
- 'name' => 'News'
-));
-
OCP\App::addNavigationEntry( array(
'id' => 'news',
'order' => 74,
diff --git a/lib/utils.php b/lib/utils.php
index 12a9506ec..cc3b6aa09 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -30,21 +30,20 @@ class OC_News_Utils {
return null;
}
- if (!$spfeed->handle_content_type()) {
- return null;
- }
+ $spfeed->handle_content_type();
$title = $spfeed->get_title();
-
- $spitems = $spfeed->get_items();
+
$items = array();
- foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
- $itemUrl = $spitem->get_permalink();
- $itemTitle = $spitem->get_title();
- $itemGUID = $spitem->get_id();
- $itemBody = $spitem->get_content();
- $items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
+ if ($spitems = $spfeed->get_items()) {
+ foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
+ $itemUrl = $spitem->get_permalink();
+ $itemTitle = $spitem->get_title();
+ $itemGUID = $spitem->get_id();
+ $itemBody = $spitem->get_content();
+ $items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
+ }
}
-
+
$feed = new OC_News_Feed($url, $title, $items);
$favicon = $spfeed->get_image_url();
diff --git a/opmlparser.php b/opmlparser.php
index cde55e2dd..072c74b86 100644
--- a/opmlparser.php
+++ b/opmlparser.php
@@ -62,7 +62,7 @@ class OPMLParser {
$title = $rawfeed['title'];
$feed->setTitle($title);
}
-
+ echo $url;
return $feed;
}
diff --git a/templates/test.php b/templates/test.php
index e8bb02c72..d088fe02d 100644
--- a/templates/test.php
+++ b/templates/test.php
@@ -1,6 +1,6 @@
<?php
-$content = file_get_contents('/var/www/apps/news/prova.opml');
+$content = file_get_contents('/tmp/occOrigzvXqKO');
require_once('news/opmlparser.php');