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();
}
$vcard = OC_Contacts_App::getContactVCard( $id );
foreach($vcard->children as $property) {
if($property->name == 'CATEGORIES') {
$checksum = md5($property->serialize());
OCP\JSON::success(array(
'data' => array(
'value' => $property->value,
'checksum' => $checksum,
)));
exit();
if(isset($vcard->CATEGORIES)) {
foreach($vcard->children as $property) {
if($property->name == 'CATEGORIES') {
$checksum = md5($property->serialize());
OCP\JSON::success(array(
'data' => array(
'value' => $property->value,
'checksum' => $checksum,
)));
exit();
}
}
}
OCP\JSON::error(array(
'data' => array(
'message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
OCP\JSON::error(array(
'data' => array(
'message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
} else {
OCP\JSON::success();
}