X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsocgraph.php;h=55e0e6fc3a98a560c32573c442707e7c39de878a;hb=41a81624a226fb3813ebaaec529fef1c2b3a8a5a;hp=ce6cdcdef69f67e8f135c13b69a92288e4f5d16e;hpb=56a57aaca42dce2d55c22ce81d33ba8f15b080db;p=friendica.git diff --git a/include/socgraph.php b/include/socgraph.php index ce6cdcdef6..55e0e6fc3a 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -1159,54 +1159,78 @@ function poco_check_server($server_url, $network = "", $force = false) { } 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; + } } } }