diff options
Diffstat (limited to 'apps/contacts/ajax/deletecard.php')
-rw-r--r-- | apps/contacts/ajax/deletecard.php | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php index a0a6b8c3ea8..e26dfd6ebfe 100644 --- a/apps/contacts/ajax/deletecard.php +++ b/apps/contacts/ajax/deletecard.php @@ -23,25 +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'); -$card = OC_Contacts_VCard::find( $id ); -if( $card === false ){ - OC_JSON::error(array('data' => array( 'message' => $l10n->t('Contact could not be found.')))); - exit(); -} - -$addressbook = OC_Contacts_Addressbook::find( $card['addressbookid'] ); -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']; +$card = OC_Contacts_App::getContactObject( $id ); OC_Contacts_VCard::delete($id); OC_JSON::success(array('data' => array( 'id' => $id ))); |