- $r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `network` IN ('%s')",
+ $r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
- dbesc(NETWORK_DFRN)
- );
- } elseif($system_mode) {
- $r = q("SELECT count(*) AS `total` 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) ",
- dbesc(NETWORK_OSTATUS),
- dbesc(NETWORK_STATUSNET)
- );
+ dbesc(NETWORK_OSTATUS)
+ );
+ } elseif($system_mode) {
+ $r = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1
+ AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) ");
- AND `network` IN ('%s', '%s', '%s', '%s', '') $sql_extra",
+ AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
+ AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra",
- $r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s') LIMIT %d, %d",
+ logger("Start global query", LOGGER_DEBUG);
+ $r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
+ ORDER BY `updated` DESC LIMIT %d, %d",
$r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`, `profile`.`gender` AS `pgender`,
`profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`, `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`
FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
$r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`, `profile`.`gender` AS `pgender`,
`profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`, `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`
FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
- AND `network` IN ('%s', '%s', '%s', '%s', '') $sql_extra LIMIT %d, %d",
+ AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
+ AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
if(x($_GET,'updatedSince') AND !$global)
$ret['updatedSince'] = false;
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;
+ $about = Cache::get("about:".$rr['updated'].":".$rr['nurl']);
+ if (is_null($about)) {
+ $about = bbcode($rr['about'], false, false);
+ Cache::set("about:".$rr['updated'].":".$rr['nurl'],$about);
+ }
+
+ // Non connected persons can only see the keywords of a Diaspora account
+ if ($rr['network'] == NETWORK_DIASPORA) {
+ $rr['location'] = "";
+ $about = "";
+ $rr['gender'] = "";
+ }
+
if($fields_ret['displayName'])
$entry['displayName'] = $rr['name'];
if($fields_ret['aboutMe'])
if($fields_ret['displayName'])
$entry['displayName'] = $rr['name'];
if($fields_ret['aboutMe'])
if($fields_ret['currentLocation'])
$entry['currentLocation'] = $rr['location'];
if($fields_ret['gender'])
$entry['gender'] = $rr['gender'];
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($fields_ret['urls']) {
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL))
if($format === 'xml') {
header('Content-type: text/xml');
echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret)));
if($format === 'xml') {
header('Content-type: text/xml');
echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret)));