The global contacts now contain a "generation" value that defines how we know this contact

This commit is contained in:
Michael Vogel 2015-02-15 10:52:45 +01:00
parent cb88269581
commit d1d794f1ab
7 changed files with 179 additions and 27 deletions

View file

@ -135,9 +135,9 @@ function poco_init(&$a) {
if(x($_GET,'updatedSince') AND !$global)
$ret['updatedSince'] = false;
$ret['startIndex'] = (string) $startIndex;
$ret['itemsPerPage'] = (string) $itemsPerPage;
$ret['totalResults'] = (string) $totalResults;
$ret['startIndex'] = (int) $startIndex;
$ret['itemsPerPage'] = (int) $itemsPerPage;
$ret['totalResults'] = (int) $totalResults;
$ret['entry'] = array();
@ -153,7 +153,8 @@ function poco_init(&$a) {
'network' => false,
'gender' => false,
'tags' => false,
'address' => false
'address' => false,
'generation' => false
);
if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
@ -168,6 +169,15 @@ function poco_init(&$a) {
if(is_array($r)) {
if(count($r)) {
foreach($r as $rr) {
if (!isset($rr['generation'])) {
if ($global)
$rr['generation'] = 3;
elseif ($system_mode)
$rr['generation'] = 1;
else
$rr['generation'] = 2;
}
if (($rr['about'] == "") AND isset($rr['pabout']))
$rr['about'] = $rr['pabout'];
@ -198,7 +208,7 @@ function poco_init(&$a) {
$entry = array();
if($fields_ret['id'])
$entry['id'] = $rr['id'];
$entry['id'] = (int)$rr['id'];
if($fields_ret['displayName'])
$entry['displayName'] = $rr['name'];
if($fields_ret['aboutMe'])
@ -207,6 +217,8 @@ function poco_init(&$a) {
$entry['currentLocation'] = $rr['location'];
if($fields_ret['gender'])
$entry['gender'] = $rr['gender'];
if($fields_ret['generation'])
$entry['generation'] = (int)$rr['generation'];
if($fields_ret['urls']) {
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL))