diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-12-06 22:31:04 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-12-07 20:40:59 +0100 |
commit | 7e990a8e5c5bf266bd3fe36cd5bb99e49c6adb1e (patch) | |
tree | 01b639d59265fa14a359409c0617bfe8e65c0090 /apps/contacts/ajax/deletecard.php | |
parent | 247146f7036984e0ae7a6719e8adfca6c2251079 (diff) | |
download | nextcloud-server-7e990a8e5c5bf266bd3fe36cd5bb99e49c6adb1e.tar.gz nextcloud-server-7e990a8e5c5bf266bd3fe36cd5bb99e49c6adb1e.zip |
Contacts: refactor common ajax functions to OC_Contacts_App
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 ))); |