2012-10-05 05:05:49 +02:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
|
|
|
OCP\JSON::callCheck();
|
|
|
|
|
|
|
|
require_once __DIR__.'/../loghandler.php';
|
|
|
|
|
|
|
|
$categoryid = isset($_POST['categoryid']) ? $_POST['categoryid'] : null;
|
2012-11-01 15:31:58 +01:00
|
|
|
$contactids = isset($_POST['contactids']) ? $_POST['contactids'] : null;
|
2012-10-05 05:05:49 +02:00
|
|
|
|
|
|
|
if(is_null($categoryid)) {
|
2012-10-25 03:34:12 +02:00
|
|
|
bailOut(OCA\Contacts\App::$l10n->t('Group ID missing from request.'));
|
2012-10-05 05:05:49 +02:00
|
|
|
}
|
|
|
|
|
2012-11-01 15:31:58 +01:00
|
|
|
if(is_null($contactids)) {
|
2012-10-25 03:34:12 +02:00
|
|
|
bailOut(OCA\Contacts\App::$l10n->t('Contact ID missing from request.'));
|
2012-10-05 05:05:49 +02:00
|
|
|
}
|
|
|
|
|
2012-10-25 03:34:12 +02:00
|
|
|
$catmgr = OCA\Contacts\App::getVCategories();
|
2012-11-01 15:31:58 +01:00
|
|
|
|
|
|
|
foreach($contactids as $contactid) {
|
2012-11-23 01:16:46 +01:00
|
|
|
debug('id: ' . $contactid .', categoryid: ' . $categoryid);
|
2012-11-01 15:31:58 +01:00
|
|
|
$catmgr->removeFromCategory($contactid, $categoryid);
|
2012-10-05 05:05:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
OCP\JSON::success();
|