From 7e990a8e5c5bf266bd3fe36cd5bb99e49c6adb1e Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 6 Dec 2011 22:31:04 +0100 Subject: Contacts: refactor common ajax functions to OC_Contacts_App --- apps/contacts/ajax/deletebook.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'apps/contacts/ajax/deletebook.php') diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php index c13217ef2e2..3ede17ab886 100644 --- a/apps/contacts/ajax/deletebook.php +++ b/apps/contacts/ajax/deletebook.php @@ -23,19 +23,12 @@ // Init owncloud require_once('../../../lib/base.php'); -$id = $_GET['id']; - -$l10n = new OC_L10N('contacts'); - // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$addressbook = OC_Contacts_Addressbook::find( $id ); -if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ - OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your contact.')))); - exit(); -} +$id = $_GET['id']; +$addressbook = OC_Contacts_App::getAddressbook( $id ); OC_Contacts_Addressbook::delete($id); OC_JSON::success(array('data' => array( 'id' => $id ))); -- cgit v1.2.3