More fields in gcontact, contact search respects "hide" setting

This commit is contained in:
Michael Vogel 2016-01-06 14:13:59 +01:00
parent 75e2ec01fe
commit 2bad2cdd91
9 changed files with 120 additions and 87 deletions

View file

@ -333,6 +333,8 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`keywords` text NOT NULL, `keywords` text NOT NULL,
`gender` varchar(32) NOT NULL DEFAULT '', `gender` varchar(32) NOT NULL DEFAULT '',
`community` tinyint(1) NOT NULL DEFAULT 0, `community` tinyint(1) NOT NULL DEFAULT 0,
`hide` tinyint(1) NOT NULL DEFAULT 0,
`nsfw` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(255) NOT NULL DEFAULT '', `network` varchar(255) NOT NULL DEFAULT '',
`addr` varchar(255) NOT NULL DEFAULT '', `addr` varchar(255) NOT NULL DEFAULT '',
`generation` tinyint(3) NOT NULL DEFAULT 0, `generation` tinyint(3) NOT NULL DEFAULT 0,
@ -536,6 +538,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_thrparent` (`uid`,`thr-parent`), INDEX `uid_thrparent` (`uid`,`thr-parent`),
INDEX `uid_parenturi` (`uid`,`parent-uri`), INDEX `uid_parenturi` (`uid`,`parent-uri`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`), INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `uid_gcontactid_created` (`uid`,`gcontact-id`,`created`),
INDEX `wall_body` (`wall`,`body`(6)), INDEX `wall_body` (`wall`,`body`(6)),
INDEX `uid_visible_moderated_created` (`uid`,`visible`,`moderated`,`created`), INDEX `uid_visible_moderated_created` (`uid`,`visible`,`moderated`,`created`),
INDEX `uid_uri` (`uid`,`uri`), INDEX `uid_uri` (`uid`,`uri`),

View file

@ -666,7 +666,10 @@ function db_definition() {
"about" => array("type" => "text", "not null" => "1"), "about" => array("type" => "text", "not null" => "1"),
"keywords" => array("type" => "text", "not null" => "1"), "keywords" => array("type" => "text", "not null" => "1"),
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"), "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),

View file

@ -2407,10 +2407,10 @@ function diaspora_profile($importer,$xml,$msg) {
if(! $contact) if(! $contact)
return; return;
if($contact['blocked']) { //if($contact['blocked']) {
logger('diaspora_post: Ignoring this author.'); // logger('diaspora_post: Ignoring this author.');
return 202; // return 202;
} //}
$name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : ''); $name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : '');
$image_url = unxmlify($xml->image_url); $image_url = unxmlify($xml->image_url);
@ -2418,6 +2418,8 @@ function diaspora_profile($importer,$xml,$msg) {
$location = diaspora2bb(unxmlify($xml->location)); $location = diaspora2bb(unxmlify($xml->location));
$about = diaspora2bb(unxmlify($xml->bio)); $about = diaspora2bb(unxmlify($xml->bio));
$gender = unxmlify($xml->gender); $gender = unxmlify($xml->gender);
$searchable = (unxmlify($xml->searchable) == "true");
$nsfw = (unxmlify($xml->nsfw) == "true");
$tags = unxmlify($xml->tag_string); $tags = unxmlify($xml->tag_string);
$tags = explode("#", $tags); $tags = explode("#", $tags);
@ -2432,6 +2434,8 @@ function diaspora_profile($importer,$xml,$msg) {
$keywords = implode(", ", $keywords); $keywords = implode(", ", $keywords);
$handle_parts = explode("@", $diaspora_handle); $handle_parts = explode("@", $diaspora_handle);
$nick = $handle_parts[0];
if($name === '') { if($name === '') {
$name = $handle_parts[0]; $name = $handle_parts[0];
} }
@ -2466,10 +2470,12 @@ function diaspora_profile($importer,$xml,$msg) {
/// @TODO Update name on item['author-name'] if the name changed. See consume_feed() /// @TODO Update name on item['author-name'] if the name changed. See consume_feed()
/// (Not doing this currently because D* protocol is scheduled for revision soon). /// (Not doing this currently because D* protocol is scheduled for revision soon).
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d", $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($name), dbesc($name),
dbesc($nick),
dbesc($diaspora_handle),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($images[0]), dbesc($image_url),
dbesc($images[1]), dbesc($images[1]),
dbesc($images[2]), dbesc($images[2]),
dbesc(datetime_convert()), dbesc(datetime_convert()),
@ -2482,34 +2488,17 @@ function diaspora_profile($importer,$xml,$msg) {
intval($importer['uid']) intval($importer['uid'])
); );
if (unxmlify($xml->searchable) == "true") { if ($searchable) {
require_once('include/socgraph.php'); require_once('include/socgraph.php');
poco_check($contact['url'], $name, NETWORK_DIASPORA, $images[0], $about, $location, $gender, $keywords, "", poco_check($contact['url'], $name, NETWORK_DIASPORA, $image_url, $about, $location, $gender, $keywords, "",
datetime_convert(), 2, $contact['id'], $importer['uid']); datetime_convert(), 2, $contact['id'], $importer['uid']);
} }
// @todo: update_gcontact(array("url" => $contact['url'], "network" => NETWORK_DIASPORA, "generation" => 2,
/* "photo" => $image_url, "name" => $name, "location" => $location,
update_gcontact($contact["url"], $contact["network"], "about" => $about, "birthday" => $birthday, "gender" => $gender,
$author["author-avatar"], $contact["name"], "addr" => $diaspora_handle, "nick" => $nick, "keywords" => $keywords,
$contact["nick"], $contact["location"], "hide" => !$searchable, "nsfw" => $nsfw));
$contact["about"]);
*/
$profileurl = "";
$author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($contact['url'])));
if (count($author) == 0) {
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`, `location`, `about`) VALUES ('%s', '%s', '%s', '%s', '%s')",
dbesc(normalise_link($contact['url'])), dbesc($name), dbesc($location), dbesc($about), dbesc($images[0]));
$author = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
dbesc(normalise_link($contact['url'])));
} else if (normalise_link($contact['url']).$name.$location.$about != normalise_link($author[0]["url"]).$author[0]["name"].$author[0]["location"].$author[0]["about"]) {
q("UPDATE unique_contacts SET name = '%s', avatar = '%s', `location` = '%s', `about` = '%s' WHERE url = '%s'",
dbesc($name), dbesc($images[0]), dbesc($location), dbesc($about), dbesc(normalise_link($contact['url'])));
}
/* if($r) { /* if($r) {
if($oldphotos) { if($oldphotos) {

View file

@ -1339,7 +1339,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
} }
if ($arr["gcontact-id"] == 0) if ($arr["gcontact-id"] == 0)
$arr["gcontact-id"] = get_gcontact_id($arr['author-link'], $arr['network'], $arr['author-avatar'], $arr['author-name']); $arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['author-link'], "network" => $arr['network'],
"photo" => $arr['author-avatar'], "name" => $arr['author-name']));
if ($arr['guid'] != "") { if ($arr['guid'] != "") {
// Checking if there is already an item with the same guid // Checking if there is already an item with the same guid

View file

@ -169,10 +169,10 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
} }
// @todo: Addr // @todo: Addr
update_gcontact($contact["url"], $contact["network"], update_gcontact(array("url" => $contact["url"], "network" => $contact["network"],
$author["author-avatar"], $contact["name"], "photo" => $author["author-avatar"], "name" => $contact["name"],
$contact["nick"], $contact["location"], "nick" => $contact["nick"], "location" => $contact["location"],
$contact["about"]); "about" => $contact["about"], "generation" => 2));
} }
return($author); return($author);

View file

@ -1488,35 +1488,37 @@ function poco_discover_server($data, $default_generation = 0) {
return $success; return $success;
} }
function get_gcontact_id($url, $network, $avatar = "", $name = "", $nick = "", $location = "", $about = "", $addr = "") { function get_gcontact_id($contact) {
$gcontact_id = 0; $gcontact_id = 0;
if ($network == NETWORK_STATUSNET) if ($contact["network"] == NETWORK_STATUSNET)
$network = NETWORK_OSTATUS; $contact["network"] = NETWORK_OSTATUS;
$r = q("SELECT `id`, `name`, `nick`, `network`, `photo`, `location`, `about` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($url))); dbesc(normalise_link($contact["url"])));
if ($r) if ($r)
$gcontact_id = $r[0]["id"]; $gcontact_id = $r[0]["id"];
else { else {
q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`) q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `generation`)
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
dbesc($name), dbesc($contact["name"]),
dbesc($nick), dbesc($contact["nick"]),
dbesc($addr), dbesc($contact["addr"]),
dbesc($network), dbesc($contact["network"]),
dbesc($url), dbesc($contact["url"]),
dbesc(normalise_link($url)), dbesc(normalise_link($contact["url"])),
dbesc($avatar), dbesc($contact["photo"]),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($location), dbesc($contact["location"]),
dbesc($about) dbesc($contact["about"]),
intval($contact["generation"])
); );
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url))); $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($contact["url"])));
if ($r) if ($r)
$gcontact_id = $r[0]["id"]; $gcontact_id = $r[0]["id"];
@ -1525,39 +1527,71 @@ function get_gcontact_id($url, $network, $avatar = "", $name = "", $nick = "", $
return $gcontact_id; return $gcontact_id;
} }
function update_gcontact($url, $network, $avatar = "", $name = "", $nick = "", $location = "", $about = "", $addr = "") { function update_gcontact($contact) {
if ($network == NETWORK_STATUSNET) $gcontact_id = get_gcontact_id($contact);
$network = NETWORK_OSTATUS;
$gcontact_id = get_gcontact_id($url, $network, $avatar, $name, $nick, $location, $about);
if (!$gcontact_id) if (!$gcontact_id)
return false; return false;
if (($avatar != $r[0]["photo"]) AND ($avatar != "")) $r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`, `hide`, `nsfw`
q("UPDATE `gcontact` SET `photo` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `photo` = '')", FROM `gcontact` WHERE `id` = %d LIMIT 1",
dbesc($avatar), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network)); intval($gcontact_id));
if (($name != $r[0]["name"]) AND ($name != "")) if ($contact["generation"] == 0)
q("UPDATE `gcontact` SET `name` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `name` = '')", $contact["generation"] = $r[0]["generation"];
dbesc($name), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network));
if (($nick != $r[0]["nick"]) AND ($nick != "")) if ($contact["photo"] == "")
q("UPDATE `gcontact` SET `nick` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `nick` = '')", $contact["photo"] = $r[0]["photo"];
dbesc($nick), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network));
if (($addr != $r[0]["addr"]) AND ($nick != "")) if ($contact["name"] == "")
q("UPDATE `gcontact` SET `addr` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `addr` = '')", $contact["name"] = $r[0]["name"];
dbesc($addr), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network));
if (($location != $r[0]["location"]) AND ($location != "")) if ($contact["nick"] == "")
q("UPDATE `gcontact` SET `location` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `location` = '')", $contact["nick"] = $r[0]["nick"];
dbesc($location), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network));
if (($about != $r[0]["about"]) AND ($about != "")) if ($contact["addr"] == "")
q("UPDATE `gcontact` SET `about` = '%s', `updated` = '%s' WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `about` = '')", $contact["addr"] = $r[0]["addr"];
dbesc($about), dbesc(datetime_convert()), dbesc(normalise_link($url)), dbesc($network));
if ($contact["location"] =="")
$contact["location"] = $r[0]["location"];
if ($contact["about"] =="")
$contact["about"] = $r[0]["about"];
if ($contact["birthday"] =="")
$contact["birthday"] = $r[0]["birthday"];
if ($contact["gender"] =="")
$contact["gender"] = $r[0]["gender"];
if ($contact["keywords"] =="")
$contact["keywords"] = $r[0]["keywords"];
if (!isset($contact["hide"]))
$contact["hide"] = $r[0]["hide"];
if (!isset($contact["nsfw"]))
$contact["nsfw"] = $r[0]["nsfw"];
if ($contact["network"] == NETWORK_STATUSNET)
$contact["network"] = NETWORK_OSTATUS;
if (($contact["photo"] != $r[0]["photo"]) OR ($contact["name"] != $r[0]["name"]) OR ($contact["nick"] != $r[0]["nick"]) OR ($contact["addr"] != $r[0]["addr"]) OR
($contact["birthday"] != $r[0]["birthday"]) OR ($contact["gender"] != $r[0]["gender"]) OR ($contact["keywords"] != $r[0]["keywords"]) OR
($contact["hide"] != $r[0]["hide"]) OR ($contact["nsfw"] != $r[0]["nsfw"]) OR
($contact["location"] != $r[0]["location"]) OR ($contact["about"] != $r[0]["about"]) OR ($contact["generation"] < $r[0]["generation"])) {
q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s',
`birthday` = '%s', `gender` = '%s', `keywords` = %d, `hide` = %d, `nsfw` = %d,
`location` = '%s', `about` = '%s', `generation` = %d, `updated` = '%s'
WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["addr"]),
dbesc($contact["birthday"]), dbesc($contact["gender"]), dbesc($contact["keywords"]),
intval($contact["hide"]), intval($contact["nsfw"]),
dbesc($contact["location"]), dbesc($contact["about"]), intval($contact["generation"]), dbesc(datetime_convert()),
dbesc(normalise_link($contact["url"])), dbesc($contact["network"]), intval($contact["generation"]));
}
return $gcontact_id; return $gcontact_id;
} }

View file

@ -94,9 +94,15 @@ function dirfind_content(&$a, $prefix = "") {
else else
$ostatus = NETWORK_DFRN; $ostatus = NETWORK_DFRN;
$count = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND $count = q("SELECT count(*) AS `total` FROM `gcontact`
(`url` REGEXP '%s' OR `name` REGEXP '%s' OR `location` REGEXP '%s' OR LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
`about` REGEXP '%s' OR `keywords` REGEXP '%s')".$extra_sql, AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)))) AND
(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql",
intval(local_user()), dbesc(CONTACT_IS_SHARING), dbesc(CONTACT_IS_FRIEND),
dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora), dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora),
dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)),
dbesc(escape_tags($search)), dbesc(escape_tags($search))); dbesc(escape_tags($search)), dbesc(escape_tags($search)));
@ -106,8 +112,8 @@ function dirfind_content(&$a, $prefix = "") {
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl` LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
AND `contact`.`uid` = %d AND NOT `contact`.`blocked` AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s') AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
WHERE `gcontact`.`network` IN ('%s', '%s', '%s') AND WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)) AND ((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)))) AND
(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR (`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql `gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql
GROUP BY `gcontact`.`nurl` GROUP BY `gcontact`.`nurl`

View file

@ -693,9 +693,8 @@ function item_post(&$a) {
$datarray['postopts'] = $postopts; $datarray['postopts'] = $postopts;
$datarray['origin'] = $origin; $datarray['origin'] = $origin;
$datarray['moderated'] = $allow_moderated; $datarray['moderated'] = $allow_moderated;
$datarray['gcontact-id'] = get_gcontact_id($datarray['author-link'], $datarray['network'], $datarray['gcontact-id'] = get_gcontact_id(array("url" => $datarray['author-link'], "network" => $datarray['network'],
$datarray['author-avatar'], $datarray['author-name']); "photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
/** /**
* These fields are for the convenience of plugins... * These fields are for the convenience of plugins...
* 'self' if true indicates the owner is posting on their own wall * 'self' if true indicates the owner is posting on their own wall

View file

@ -61,8 +61,7 @@ function poco_init(&$a) {
$update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince'])); $update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
if ($global) { if ($global) {
//$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND ((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) 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')",
$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND `network` IN ('%s', '%s', '%s')",
dbesc($update_limit), dbesc($update_limit),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
@ -94,8 +93,7 @@ function poco_init(&$a) {
if ($global) { if ($global) {
logger("Start global query", LOGGER_DEBUG); logger("Start global query", LOGGER_DEBUG);
//$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s') AND ((`last_contact` >= `last_failure`) OR (`updated` > `last_failure`)) LIMIT %d, %d", $r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d", ORDER BY `updated` DESC LIMIT %d, %d",
dbesc($update_limit), dbesc($update_limit),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),