]> source.dussan.org Git - nextcloud-server.git/commitdiff
Access check fix in contacts/ajax/activation.php
authorBart Visscher <bartv@thisnet.nl>
Sat, 11 Feb 2012 21:00:42 +0000 (22:00 +0100)
committerBart Visscher <bartv@thisnet.nl>
Sun, 12 Feb 2012 14:14:24 +0000 (15:14 +0100)
plus small cleanup

apps/contacts/ajax/activation.php

index fda63a528a4c2e974702c87888bc7aede40779fd..d69e3dba3f8ce2c7a1259fa226ef6920c2cb3e24 100644 (file)
 require_once ("../../../lib/base.php");
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
-$l=new OC_L10N('contacts');
 
 $bookid = $_POST['bookid'];
+$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
+
 if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
-       OC_JSON::error(array('data' => array('message' => $l->t('Error (de)activating addressbook.'))));
        OC_Log::write('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OC_Log::ERROR);
+       OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
        exit();
 }
-$book = OC_Contacts_App::getAddressbook($bookid);
-
 
-/* is there an OC_JSON::error() ? */
 OC_JSON::success(array(
        'active' => OC_Contacts_Addressbook::isActive($bookid),
        'bookid' => $bookid,