if($justme)
$sql_extra = " AND `contact`.`self` = 1 ";
- else
- $sql_extra = " AND `contact`.`self` = 0 ";
+// else
+// $sql_extra = " AND `contact`.`self` = 0 ";
if($cid)
$sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));
if($system_mode) {
- $r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation` FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
- WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '')
+ $r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`, `profile`.`gender` AS `pgender`
+ FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
+ WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '') AND `profile`.`is-default`
AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
'photos' => false,
'aboutMe' => false,
'currentLocation' => false,
- 'network' => false
+ 'network' => false,
+ 'gender' => false,
+ 'tags' => false
);
if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
if (($rr['location'] == "") AND isset($rr['plocation']))
$rr['location'] = $rr['plocation'];
+ if (($rr['gender'] == "") AND isset($rr['pgender']))
+ $rr['gender'] = $rr['pgender'];
+
+ if (($rr['keywords'] == "") AND isset($rr['pub_keywords']))
+ $rr['keywords'] = $rr['pub_keywords'];
+
$entry = array();
if($fields_ret['id'])
$entry['id'] = $rr['id'];
$entry['aboutMe'] = bbcode($rr['about'], false, false);
if($fields_ret['currentLocation'])
$entry['currentLocation'] = $rr['location'];
+ if($fields_ret['gender'])
+ $entry['gender'] = $rr['gender'];
if($fields_ret['urls']) {
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL))
if (($entry['network'] == "") AND ($rr['self']))
$entry['network'] = NETWORK_DFRN;
}
+ if($fields_ret['tags']) {
+ $tags = str_replace(","," ",$rr['keywords']);
+ $tags = explode(" ", $tags);
+
+ $cleaned = array();
+ foreach ($tags as $tag) {
+ $tag = trim(strtolower($tag));
+ if ($tag != "")
+ $cleaned[] = $tag;
+ }
+
+ $entry['tags'] = array($cleaned);
+ }
+
$ret['entry'][] = $entry;
}
}