activate.php 870 B

123456789101112131415161718192021222324252627282930313233
  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. $id = $_POST['id'];
  13. $book = OC_Contacts_App::getAddressbook($id);// is owner access check
  14. if(!OC_Contacts_Addressbook::setActive($id, $_POST['active'])) {
  15. OCP\Util::writeLog('contacts',
  16. 'ajax/activation.php: Error activating addressbook: '. $id,
  17. OCP\Util::ERROR);
  18. OCP\JSON::error(array(
  19. 'data' => array(
  20. 'message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
  21. exit();
  22. }
  23. OCP\JSON::success(array(
  24. 'active' => OC_Contacts_Addressbook::isActive($id),
  25. 'id' => $id,
  26. 'addressbook' => $book,
  27. ));