1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-04 15:24:35 +01:00
OwncloudContactsOfficial/ajax/categories/categoriesfor.php

35 lines
863 B
PHP
Raw Normal View History

<?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-09-07 14:32:45 +02:00
2012-05-03 12:23:29 +02:00
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
2012-07-19 23:48:17 +02:00
OCP\JSON::error(array(
'data' => array(
2012-10-25 03:34:12 +02:00
'message' => OCA\Contacts\App::$l10n->t('No ID provided'))));
exit();
}
2012-10-25 03:34:12 +02:00
$vcard = OCA\Contacts\App::getContactVCard( $id );
2012-09-07 15:21:03 +02:00
foreach($vcard->children as $property) {
if($property->name == 'CATEGORIES') {
$checksum = md5($property->serialize());
2012-07-19 23:48:17 +02:00
OCP\JSON::success(array(
'data' => array(
2012-09-07 14:32:45 +02:00
'value' => $property->value,
2012-07-19 23:48:17 +02:00
'checksum' => $checksum,
)));
exit();
}
}
2012-07-19 23:48:17 +02:00
OCP\JSON::error(array(
'data' => array(
2012-10-25 03:34:12 +02:00
'message' => OCA\Contacts\App::$l10n->t('Error setting checksum.'))));