diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-03 00:35:45 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-03 00:35:45 -0400 |
commit | a4502857ece08326168fd5b1170d9ff9f4c3be01 (patch) | |
tree | 2eaff7d4a705bcc7bee42a9f4eaf8bd2dec67f3c /ajax/createfeed.php | |
parent | 9e1b6c31a8818f665ac58307931c6fd308e6c353 (diff) |
small fixes on previous commits
Diffstat (limited to 'ajax/createfeed.php')
-rw-r--r-- | ajax/createfeed.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ajax/createfeed.php b/ajax/createfeed.php index 3b20b3ce9..a17ef8f33 100644 --- a/ajax/createfeed.php +++ b/ajax/createfeed.php @@ -21,21 +21,23 @@ $feedurl = trim($_POST['feedurl']); $folderid = trim($_POST['folderid']); $feed = OC_News_Utils::fetch($feedurl); -$feedmapper = new OC_News_FeedMapper(); -$feedid = $feedmapper->save($feed, $folderid); + +if ($feed != null) { + $feedmapper = new OC_News_FeedMapper(); + $feedid = $feedmapper->save($feed, $folderid); +} $l = OC_L10N::get('news'); -if(!$feedid) { - OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.')))); +if($feed == null || !$feedid) { + OCP\JSON::error(array('data' => array('message' => $l->t('Error adding feed.')))); OCP\Util::writeLog('news','ajax/createfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR); exit(); } $tmpl = new OCP\Template("news", "part.listfeed"); $tmpl->assign('child', $feed); -$listitem = $tmpl->fetchPage(); +$listfeed = $tmpl->fetchPage(); -//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!'), 'listitem' => $listitem))); +OCP\JSON::success(array('data' => array('message' => $l->t('Feed added!'), 'listfeed' => $listfeed))); |