diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-02 23:39:19 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-02 23:39:19 -0400 |
commit | 72c730bf5fb21f58589a836483585dabd6866520 (patch) | |
tree | a57dab8dcf88ce5a4f1172ba89663aa52947fdb8 /ajax | |
parent | f8f6fd3d778fe95bac15e52747ff5b1f6461c136 (diff) |
button to add feed; selection of a feed
Diffstat (limited to 'ajax')
-rw-r--r-- | ajax/createfolder.php | 1 | ||||
-rw-r--r-- | ajax/newfeed.php | 36 |
2 files changed, 36 insertions, 1 deletions
diff --git a/ajax/createfolder.php b/ajax/createfolder.php index ecc44df49..a53b60d92 100644 --- a/ajax/createfolder.php +++ b/ajax/createfolder.php @@ -32,4 +32,3 @@ if(!$folderid) { //TODO: replace the following with the success case. see contact/ajax/createaddressbook.php for inspirations OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.')))); - diff --git a/ajax/newfeed.php b/ajax/newfeed.php new file mode 100644 index 000000000..d75af0e8e --- /dev/null +++ b/ajax/newfeed.php @@ -0,0 +1,36 @@ +<?php +/** +* ownCloud - News app +* +* @author Alessandro Cosentino +* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> +* +* This file is licensed under the Affero General Public License version 3 or later. +* See the COPYING-README file +* +*/ + +// Check if we are a user +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('news'); +OCP\JSON::callCheck(); + +$userid = OCP\USER::getUser(); + +$feedurl = trim($_POST['feedurl']); + +$feed = OC_News_Utils::fetch($feedurl); +$feedmapper = new OC_News_FeedMapper(); +$feedid = $feedmapper->save($feed, 0); + +$l = OC_L10N::get('news'); + +if(!$feedid) { + OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.')))); + OCP\Util::writeLog('news','ajax/newfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR); + exit(); +} + +//TODO: replace the following with the success case. see contact/ajax/createaddressbook.php for inspirations +OCP\JSON::error(array('data' => array('message' => $l->t('Error adding feed.')))); + |