diff options
Diffstat (limited to 'apps/contacts/ajax/showsetproperty.php')
-rw-r--r-- | apps/contacts/ajax/showsetproperty.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 77b90ea8cc4..0b30a8e68ec 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -28,27 +28,24 @@ $checksum = $_GET['checksum']; $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(); } $vcard = OC_Contacts_VCard::parse($card['carddata']); // Check if the card is valid if(is_null($vcard)){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('vCard could not be read.')))); + OC_JSON::error(array('data' => array( 'message' => $l10n->t('vCard could not be read.')))); exit(); } @@ -59,7 +56,7 @@ for($i=0;$i<count($vcard->children);$i++){ } } if(is_null($line)){ - echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload the page.')))); + OC_JSON::error(array('data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload the page.')))); exit(); } @@ -70,4 +67,4 @@ $tmpl->assign('checksum',$checksum); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line])); $page = $tmpl->fetchPage(); -echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); +OC_JSON::success(array('data' => array( 'page' => $page ))); |