use Friendica\App;
use Friendica\Core\Addon;
-use Friendica\Core\System;
use Friendica\Core\Config;
+use Friendica\Core\Logger;
+use Friendica\Core\System;
+use Friendica\Database\DBA;
use Friendica\Util\Network;
-require_once 'include/dba.php';
-
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
'href' => System::baseUrl().'/nodeinfo/1.0']]];
$nodeinfo['usage'] = [];
- $nodeinfo['openRegistrations'] = ($a->config['register_policy'] != 0);
+ $nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED;
- $nodeinfo['metadata'] = ['nodeName' => $a->config['sitename']];
+ $nodeinfo['metadata'] = ['nodeName' => Config::get('config', 'sitename')];
if (Config::get('system', 'nodeinfo')) {
$nodeinfo['usage']['localPosts'] = (int)Config::get('nodeinfo', 'local_posts');
$nodeinfo['usage']['localComments'] = (int)Config::get('nodeinfo', 'local_comments');
- if (Addon::isEnabled('appnet')) {
- $nodeinfo['services']['inbound'][] = 'appnet';
- }
- if (Addon::isEnabled('appnet') || Addon::isEnabled('buffer')) {
- $nodeinfo['services']['outbound'][] = 'appnet';
- }
if (Addon::isEnabled('blogger')) {
$nodeinfo['services']['outbound'][] = 'blogger';
}
if (Addon::isEnabled('dwpost')) {
$nodeinfo['services']['outbound'][] = 'dreamwidth';
}
- if (Addon::isEnabled('fbpost') || Addon::isEnabled('buffer')) {
- $nodeinfo['services']['outbound'][] = 'facebook';
- }
if (Addon::isEnabled('statusnet')) {
$nodeinfo['services']['inbound'][] = 'gnusocial';
$nodeinfo['services']['outbound'][] = 'gnusocial';
}
-
- if (Addon::isEnabled('gpluspost') || Addon::isEnabled('buffer')) {
- $nodeinfo['services']['outbound'][] = 'google';
- }
if (Addon::isEnabled('ijpost')) {
$nodeinfo['services']['outbound'][] = 'insanejournal';
}
if (Addon::isEnabled('twitter')) {
$nodeinfo['metadata']['services']['inbound'][] = 'twitter';
}
+
+ $nodeinfo['metadata']['explicitContent'] = Config::get('system', 'explicit_content', false) == true;
}
header('Content-type: application/json; charset=utf-8');
function nodeinfo_cron() {
- $a = get_app();
+ $a = \get_app();
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
if (Addon::isEnabled('statistics_json')) {
return;
}
- logger('cron_start');
+ Logger::log('cron_start');
$users = q("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
FROM `user`
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);
- logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
+ Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, Logger::DEBUG);
}
- $local_posts = dba::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
+ $local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
- logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
+ Logger::log('local_posts: ' . $local_posts, Logger::DEBUG);
- $local_comments = dba::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
+ $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
- logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
+ Logger::log('local_comments: ' . $local_comments, Logger::DEBUG);
// Now trying to register
- $url = 'http://the-federation.info/register/'.$a->get_hostname();
- logger('registering url: '.$url, LOGGER_DEBUG);
+ $url = 'http://the-federation.info/register/'.$a->getHostName();
+ Logger::log('registering url: '.$url, Logger::DEBUG);
$ret = Network::fetchUrl($url);
- logger('registering answer: '.$ret, LOGGER_DEBUG);
+ Logger::log('registering answer: '.$ret, Logger::DEBUG);
- logger('cron_end');
+ Logger::log('cron_end');
}