*/
function poco_load($cid, $uid = 0, $zcid = 0, $url = null) {
// Call the function "poco_load_worker" via the worker
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "poco_load", intval($cid), intval($uid), intval($zcid), base64_encode($url));
+ proc_run(PRIORITY_LOW, "include/discover_poco.php", "poco_load", (int)$cid, (int)$uid, (int)$zcid, $url);
}
/**
}
if (!$failure) {
- // Test for Hubzilla, Redmatrix or Friendica
- $serverret = z_fetch_url($server_url."/api/statusnet/config.json");
+ // Test for Hubzilla and Red
+ $serverret = z_fetch_url($server_url."/siteinfo.json");
if ($serverret["success"]) {
$data = json_decode($serverret["body"]);
- if (isset($data->site->server)) {
- if (isset($data->site->platform)) {
- $platform = $data->site->platform->PLATFORM_NAME;
- $version = $data->site->platform->STD_VERSION;
- $network = NETWORK_DIASPORA;
- }
- if (isset($data->site->BlaBlaNet)) {
- $platform = $data->site->BlaBlaNet->PLATFORM_NAME;
- $version = $data->site->BlaBlaNet->STD_VERSION;
- $network = NETWORK_DIASPORA;
- }
- if (isset($data->site->hubzilla)) {
- $platform = $data->site->hubzilla->PLATFORM_NAME;
- $version = $data->site->hubzilla->RED_VERSION;
- $network = NETWORK_DIASPORA;
- }
- if (isset($data->site->redmatrix)) {
- if (isset($data->site->redmatrix->PLATFORM_NAME)) {
- $platform = $data->site->redmatrix->PLATFORM_NAME;
- } elseif (isset($data->site->redmatrix->RED_PLATFORM)) {
- $platform = $data->site->redmatrix->RED_PLATFORM;
+ if (isset($data->url)) {
+ $platform = $data->platform;
+ $version = $data->version;
+ $network = NETWORK_DIASPORA;
+ }
+ $site_name = $data->site_name;
+ switch ($data->register_policy) {
+ case "REGISTER_OPEN":
+ $register_policy = REGISTER_OPEN;
+ break;
+ case "REGISTER_APPROVE":
+ $register_policy = REGISTER_APPROVE;
+ break;
+ case "REGISTER_CLOSED":
+ default:
+ $register_policy = REGISTER_CLOSED;
+ break;
+ }
+ } else {
+ // Test for Hubzilla, Redmatrix or Friendica
+ $serverret = z_fetch_url($server_url."/api/statusnet/config.json");
+ if ($serverret["success"]) {
+ $data = json_decode($serverret["body"]);
+ if (isset($data->site->server)) {
+ if (isset($data->site->platform)) {
+ $platform = $data->site->platform->PLATFORM_NAME;
+ $version = $data->site->platform->STD_VERSION;
+ $network = NETWORK_DIASPORA;
+ }
+ if (isset($data->site->BlaBlaNet)) {
+ $platform = $data->site->BlaBlaNet->PLATFORM_NAME;
+ $version = $data->site->BlaBlaNet->STD_VERSION;
+ $network = NETWORK_DIASPORA;
}
+ if (isset($data->site->hubzilla)) {
+ $platform = $data->site->hubzilla->PLATFORM_NAME;
+ $version = $data->site->hubzilla->RED_VERSION;
+ $network = NETWORK_DIASPORA;
+ }
+ if (isset($data->site->redmatrix)) {
+ if (isset($data->site->redmatrix->PLATFORM_NAME)) {
+ $platform = $data->site->redmatrix->PLATFORM_NAME;
+ } elseif (isset($data->site->redmatrix->RED_PLATFORM)) {
+ $platform = $data->site->redmatrix->RED_PLATFORM;
+ }
- $version = $data->site->redmatrix->RED_VERSION;
- $network = NETWORK_DIASPORA;
- }
- if (isset($data->site->friendica)) {
- $platform = $data->site->friendica->FRIENDICA_PLATFORM;
- $version = $data->site->friendica->FRIENDICA_VERSION;
- $network = NETWORK_DFRN;
- }
+ $version = $data->site->redmatrix->RED_VERSION;
+ $network = NETWORK_DIASPORA;
+ }
+ if (isset($data->site->friendica)) {
+ $platform = $data->site->friendica->FRIENDICA_PLATFORM;
+ $version = $data->site->friendica->FRIENDICA_VERSION;
+ $network = NETWORK_DFRN;
+ }
- $site_name = $data->site->name;
+ $site_name = $data->site->name;
- $data->site->closed = poco_to_boolean($data->site->closed);
- $data->site->private = poco_to_boolean($data->site->private);
- $data->site->inviteonly = poco_to_boolean($data->site->inviteonly);
+ $data->site->closed = poco_to_boolean($data->site->closed);
+ $data->site->private = poco_to_boolean($data->site->private);
+ $data->site->inviteonly = poco_to_boolean($data->site->inviteonly);
- if (!$data->site->closed && !$data->site->private and $data->site->inviteonly) {
- $register_policy = REGISTER_APPROVE;
- } elseif (!$data->site->closed && !$data->site->private) {
- $register_policy = REGISTER_OPEN;
- } else {
- $register_policy = REGISTER_CLOSED;
+ if (!$data->site->closed && !$data->site->private and $data->site->inviteonly) {
+ $register_policy = REGISTER_APPROVE;
+ } elseif (!$data->site->closed && !$data->site->private) {
+ $register_policy = REGISTER_OPEN;
+ } else {
+ $register_policy = REGISTER_CLOSED;
+ }
}
}
}
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
if (!dbm::is_result($r)) {
logger("Call server check for server ".$server_url, LOGGER_DEBUG);
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($server_url));
+ proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", $server_url);
}
}
}
$servers = json_decode($serverdata);
foreach ($servers->pods as $server) {
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode("https://".$server->host));
+ proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", "https://".$server->host);
}
}
foreach ($servers as $server) {
$url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name;
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($url));
+ proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", $url);
}
}
}
}
logger('Update directory from server '.$server['url'].' with ID '.$server['id'], LOGGER_DEBUG);
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server_directory", intval($server['id']));
+ proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server_directory", (int)$server['id']);
if (!$complete && (--$no_of_queries == 0)) {
break;
if ($doprobing) {
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
- proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
+ proc_run(PRIORITY_LOW, 'include/gprobe.php', $contact["url"]);
}
return $gcontact_id;