diff options
Diffstat (limited to 'apps/contacts/ajax/addcard.php')
-rw-r--r-- | apps/contacts/ajax/addcard.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index 6005d74d144..cfae3327f56 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -27,14 +27,11 @@ $aid = $_POST['id']; $l10n = new OC_L10N('contacts'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in.')))); - exit(); -} +OC_JSON::checkLoggedIn(); $addressbook = OC_Contacts_Addressbook::find( $aid ); if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved? + OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved? exit(); } @@ -51,4 +48,4 @@ $tmpl->assign('details',$details); $tmpl->assign('id',$id); $page = $tmpl->fetchPage(); -echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page ))); +OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page ))); |