1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Don't set checksum for non-existing property.

This commit is contained in:
Thomas Tanghus 2012-10-19 02:27:37 +02:00
parent f877dd7339
commit 4890bdf705

View File

@ -18,17 +18,21 @@ if(is_null($id)) {
exit(); exit();
} }
$vcard = OC_Contacts_App::getContactVCard( $id ); $vcard = OC_Contacts_App::getContactVCard( $id );
foreach($vcard->children as $property) { if(isset($vcard->CATEGORIES)) {
if($property->name == 'CATEGORIES') { foreach($vcard->children as $property) {
$checksum = md5($property->serialize()); if($property->name == 'CATEGORIES') {
OCP\JSON::success(array( $checksum = md5($property->serialize());
'data' => array( OCP\JSON::success(array(
'value' => $property->value, 'data' => array(
'checksum' => $checksum, 'value' => $property->value,
))); 'checksum' => $checksum,
exit(); )));
exit();
}
} }
OCP\JSON::error(array(
'data' => array(
'message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
} else {
OCP\JSON::success();
} }
OCP\JSON::error(array(
'data' => array(
'message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));