summaryrefslogtreecommitdiffstats
path: root/ajax/updatefeed.php
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-17 21:49:38 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-17 21:49:38 -0400
commit4ce35659094ed4df43ad41a198a2944aeced9784 (patch)
tree13be6588a7aa99a5a35700f4552bffb71e2e7a1d /ajax/updatefeed.php
parentc378e972a12ba41d252d74e509f88ea7bec2544d (diff)
update feeds works; need to be polished
Diffstat (limited to 'ajax/updatefeed.php')
-rw-r--r--ajax/updatefeed.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/ajax/updatefeed.php b/ajax/updatefeed.php
index 754d87495..bc74324e3 100644
--- a/ajax/updatefeed.php
+++ b/ajax/updatefeed.php
@@ -17,21 +17,23 @@ OCP\JSON::callCheck();
$userid = OCP\USER::getUser();
-$feedurl = trim($_POST['feedurl']);
-$folderid = trim($_POST['folderid']);
+$feedid = $_POST['feedid'];
+$feedurl = $_POST['feedurl'];
+$folderid = $_POST['folderid'];
+
+$newfeed = OC_News_Utils::fetch($feedurl);
-$feed = OC_News_Utils::fetch($feedurl);
$feedmapper = new OC_News_FeedMapper();
-$feedid = $feedmapper->save($feed, $folderid);
+$newfeedid = $feedmapper->save($newfeed, $folderid);
$l = OC_L10N::get('news');
-if(!$feedid) {
- OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.'))));
- OCP\Util::writeLog('news','ajax/createfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR);
+if(!$newfeedid) {
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error updating feed.'))));
+ OCP\Util::writeLog('news','ajax/updatefeed.php: Error updating feed: '.$_POST['feedid'], OCP\Util::ERROR);
exit();
}
//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations
-OCP\JSON::success(array('data' => array('message' => $l->t('Feed added!'))));
+OCP\JSON::success(array('data' => array('message' => $l->t('Feed updated!'))));