2011-12-04 20:25:46 +01: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 19:31:29 +02:00
|
|
|
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
2012-06-14 18:00:13 +02:00
|
|
|
OCP\JSON::callCheck();
|
2012-01-11 20:07:15 +01:00
|
|
|
|
2011-12-04 20:25:46 +01:00
|
|
|
$bookid = $_POST['bookid'];
|
2012-02-11 22:00:42 +01:00
|
|
|
$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
|
|
|
|
|
2012-01-11 20:07:15 +01:00
|
|
|
if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
|
2012-05-01 17:38:27 +02:00
|
|
|
OCP\Util::writeLog('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OCP\Util::ERROR);
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
|
2012-01-11 20:07:15 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::success(array(
|
2011-12-11 16:26:00 +01:00
|
|
|
'active' => OC_Contacts_Addressbook::isActive($bookid),
|
2011-12-04 20:25:46 +01:00
|
|
|
'bookid' => $bookid,
|
2011-12-16 17:42:07 +01:00
|
|
|
'book' => $book,
|
2011-12-04 20:25:46 +01:00
|
|
|
));
|