2012-03-07 16:39:56 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2012-04-17 19:31:29 +02:00
|
|
|
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
2012-03-07 16:39:56 +01:00
|
|
|
|
|
|
|
$id = isset($_GET['id'])?$_GET['id']:null;
|
|
|
|
if(is_null($id)) {
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('No ID provided'))));
|
2012-03-07 16:39:56 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
$vcard = OC_Contacts_App::getContactVCard( $id );
|
|
|
|
foreach($vcard->children as $property){
|
2012-05-01 17:38:27 +02:00
|
|
|
//OCP\Util::writeLog('contacts','ajax/categories/checksumfor.php: '.$property->name, OCP\Util::DEBUG);
|
2012-03-07 16:39:56 +01:00
|
|
|
if($property->name == 'CATEGORIES') {
|
|
|
|
$checksum = md5($property->serialize());
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::success(array('data' => array('value'=>$property->value, 'checksum'=>$checksum)));
|
2012-03-07 16:39:56 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
2012-05-03 12:23:29 +02:00
|
|
|
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
|