activation.php 883 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
  4. * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
  5. * This file is licensed under the Affero General Public License version 3 or
  6. * later.
  7. * See the COPYING-README file.
  8. */
  9. OCP\JSON::checkLoggedIn();
  10. OCP\JSON::checkAppEnabled('contacts');
  11. OCP\JSON::callCheck();
  12. $bookid = $_POST['bookid'];
  13. $book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
  14. if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
  15. OCP\Util::writeLog('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OCP\Util::ERROR);
  16. OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
  17. exit();
  18. }
  19. OCP\JSON::success(array(
  20. 'active' => OC_Contacts_Addressbook::isActive($bookid),
  21. 'bookid' => $bookid,
  22. 'book' => $book,
  23. ));