Support for detecting "Hubzilla" (and some bugfixing in the server detection)

This commit is contained in:
Michael Vogel 2015-07-20 00:14:14 +02:00
parent 3622f1a335
commit a4aec06e5b
1 changed files with 14 additions and 3 deletions

View File

@ -430,6 +430,10 @@ function poco_last_updated($profile) {
q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'", q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
dbesc($last_updated), dbesc(datetime_convert()), dbesc(normalise_link($profile))); dbesc($last_updated), dbesc(datetime_convert()), dbesc(normalise_link($profile)));
if (($gcontacts[0]["generation"] == 0))
q("UPDATE `gcontact` SET `generation` = 9 WHERE `nurl` = '%s'",
dbesc(normalise_link($profile)));
return($last_updated); return($last_updated);
} }
@ -559,6 +563,11 @@ function poco_check_server($server_url, $network = "") {
if (isset($data->site->server)) { if (isset($data->site->server)) {
$last_contact = datetime_convert(); $last_contact = datetime_convert();
if (isset($data->site->hubzilla)) {
$platform = $data->site->hubzilla->PLATFORM_NAME;
$version = $data->site->hubzilla->RED_VERSION;
$network = NETWORK_DFRN;
}
if (isset($data->site->redmatrix)) { if (isset($data->site->redmatrix)) {
if (isset($data->site->redmatrix->PLATFORM_NAME)) if (isset($data->site->redmatrix->PLATFORM_NAME))
$platform = $data->site->redmatrix->PLATFORM_NAME; $platform = $data->site->redmatrix->PLATFORM_NAME;
@ -676,8 +685,8 @@ function poco_check_server($server_url, $network = "") {
dbesc(normalise_link($server_url)) dbesc(normalise_link($server_url))
); );
else else
q("INSERT INTO `gserver` (`url`, `nurl`, `version`, `site_name`, `info`, `register_policy`, `poco`, `noscrape`, `network`, `platform`, `last_contact`) q("INSERT INTO `gserver` (`url`, `nurl`, `version`, `site_name`, `info`, `register_policy`, `poco`, `noscrape`, `network`, `platform`, `last_contact`, `last_failure`)
VALUES ('%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s')", VALUES ('%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s')",
dbesc($server_url), dbesc($server_url),
dbesc(normalise_link($server_url)), dbesc(normalise_link($server_url)),
dbesc($version), dbesc($version),
@ -688,9 +697,11 @@ function poco_check_server($server_url, $network = "") {
dbesc($noscrape), dbesc($noscrape),
dbesc($network), dbesc($network),
dbesc($platform), dbesc($platform),
dbesc($last_contact),
dbesc($last_failure),
dbesc(datetime_convert()) dbesc(datetime_convert())
); );
return $failure; return !$failure;
} }
function poco_contact_from_body($body, $created, $cid, $uid) { function poco_contact_from_body($body, $created, $cid, $uid) {