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