blob: 75def433d30289f15fd03fa8f7b616d13cf71371 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
/**
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('core','ajax/vcategories/delete.php: '.$msg, OC_Log::DEBUG);
exit();
}
function debug($msg) {
OC_Log::write('core','ajax/vcategories/delete.php: '.$msg, OC_Log::DEBUG);
}
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$app = isset($_POST['app'])?$_POST['app']:null;
$categories = isset($_POST['categories'])?$_POST['categories']:null;
if(is_null($app)) {
bailOut(OC_Contacts_App::$l10n->t('Application name not provided.'));
}
OC_JSON::checkAppEnabled($app);
debug('The application "'.$app.'" uses the default file. OC_VObjects will not be updated.');
if(is_null($categories)) {
bailOut('No categories selected for deletion.');
}
$vcategories = new OC_VCategories($app);
$vcategories->delete($categories);
OC_JSON::success(array('data' => array('categories'=>$vcategories->categories())));
?>
|