diff options
Diffstat (limited to 'apps/news/ajax/deletefeed.php')
-rw-r--r-- | apps/news/ajax/deletefeed.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/news/ajax/deletefeed.php b/apps/news/ajax/deletefeed.php new file mode 100644 index 00000000000..d31a9417d14 --- /dev/null +++ b/apps/news/ajax/deletefeed.php @@ -0,0 +1,33 @@ +<?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(); + +$feedid = $_POST['feedid']; + +$feedmapper = new OC_News_FeedMapper(); +$success = $feedmapper->deleteById($feedid); + +$l = OC_L10N::get('news'); + +if(!$success) { + OCP\JSON::error(array('data' => array('message' => $l->t('Error removing feed.')))); + OCP\Util::writeLog('news','ajax/deletefeed.php: Error removing feed: '.$_POST['feedid'], OCP\Util::ERROR); + exit(); +} + +OCP\JSON::success(array('data' => array( 'feedid' => $feedid ))); |