2011-12-04 19:25:46 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2012-04-17 17:31:29 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
2012-06-13 15:35:42 +00:00
|
|
|
OCP\JSON::callCheck();
|
2012-01-11 19:07:15 +00:00
|
|
|
|
2011-12-04 19:25:46 +00:00
|
|
|
$bookid = $_POST['bookid'];
|
2012-02-11 21:00:42 +00:00
|
|
|
$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
|
|
|
|
|
2012-01-11 19:07:15 +00:00
|
|
|
if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
|
2012-07-19 21:48:17 +00:00
|
|
|
OCP\Util::writeLog('contacts',
|
|
|
|
'ajax/activation.php: Error activating addressbook: '. $bookid,
|
|
|
|
OCP\Util::ERROR);
|
|
|
|
OCP\JSON::error(array(
|
|
|
|
'data' => array(
|
|
|
|
'message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
|
2012-01-11 19:07:15 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::success(array(
|
2011-12-11 15:26:00 +00:00
|
|
|
'active' => OC_Contacts_Addressbook::isActive($bookid),
|
2011-12-04 19:25:46 +00:00
|
|
|
'bookid' => $bookid,
|
2011-12-16 16:42:07 +00:00
|
|
|
'book' => $book,
|
2011-12-04 19:25:46 +00:00
|
|
|
));
|