diff options
Diffstat (limited to 'apps/contacts/ajax/showaddproperty.php')
-rw-r--r-- | apps/contacts/ajax/showaddproperty.php | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/contacts/ajax/showaddproperty.php b/apps/contacts/ajax/showaddproperty.php index 718478d42bf..0d01b37d8ef 100644 --- a/apps/contacts/ajax/showaddproperty.php +++ b/apps/contacts/ajax/showaddproperty.php @@ -27,20 +27,17 @@ $id = $_GET['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(); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Contact could not be found.')))); + 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()){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact.')))); + OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your contact.')))); exit(); } @@ -48,4 +45,4 @@ $tmpl = new OC_Template('contacts','part.addpropertyform'); $tmpl->assign('id',$id); $page = $tmpl->fetchPage(); -echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); +OC_JSON::success(array('data' => array( 'page' => $page ))); |