<?php
function poco_init(&$a) {
+ require_once("include/bbcode.php");
$system_mode = false;
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 * FROM `contact` WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '')
- AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
+ $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),
dbesc(NETWORK_OSTATUS),
'updated' => false,
'preferredUsername' => false,
'photos' => false,
- 'network' => false
+ 'aboutMe' => false,
+ 'currentLocation' => false,
+ 'network' => false,
+ 'gender' => false,
+ 'tags' => false
);
if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
if(is_array($r)) {
if(count($r)) {
foreach($r as $rr) {
+ if (($rr['about'] == "") AND isset($rr['pabout']))
+ $rr['about'] = $rr['pabout'];
+
+ 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'];
if($fields_ret['displayName'])
$entry['displayName'] = $rr['name'];
+ if($fields_ret['aboutMe'])
+ $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))
$entry['network'] = $rr['network'];
if ($entry['network'] == NETWORK_STATUSNET)
$entry['network'] = NETWORK_OSTATUS;
+ 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;
}
}