diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-05 17:22:24 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-05 17:22:24 -0400 |
commit | e5f291b09c4403bf5ffdd131c662f35a92ec363e (patch) | |
tree | 7e170eecc57df46d239f9a0b908a12b7163b34f1 /ajax/deletefolder.php | |
parent | 96041641949c55abf2b432bc08ea493b40dec873 (diff) |
button to remove folder
Diffstat (limited to 'ajax/deletefolder.php')
-rw-r--r-- | ajax/deletefolder.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ajax/deletefolder.php b/ajax/deletefolder.php new file mode 100644 index 000000000..f11a1975f --- /dev/null +++ b/ajax/deletefolder.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(); + +$folderid = trim($_POST['folderid']); + +$foldermapper = new OC_News_FolderMapper(); +$success = $foldermapper->deleteById($folderid); + +$l = OC_L10N::get('news'); + +if(!$success) { + OCP\JSON::error(array('data' => array('message' => $l->t('Error removing folder.')))); + OCP\Util::writeLog('news','ajax/deletefolder.php: Error removing folder: '.$_POST['folderid'], OCP\Util::ERROR); + exit(); +} + +OCP\JSON::success(array('data' => array( 'folderid' => $folderid ))); |