4 * @file mod/statistics_json.php
8 use Friendica\Core\Addon;
9 use Friendica\Core\Config;
10 use Friendica\Core\Logger;
11 use Friendica\Core\System;
13 function statistics_json_init(App $a) {
15 if (!Config::get("system", "nodeinfo")) {
16 System::httpExit(404);
20 intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED
21 && ! Config::get('config', 'invitation_only');
24 "name" => Config::get('config', 'sitename'),
25 "network" => FRIENDICA_PLATFORM,
26 "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
27 "registrations_open" => $registration_open,
28 "total_users" => Config::get('nodeinfo', 'total_users'),
29 "active_users_halfyear" => Config::get('nodeinfo', 'active_users_halfyear'),
30 "active_users_monthly" => Config::get('nodeinfo', 'active_users_monthly'),
31 "local_posts" => Config::get('nodeinfo', 'local_posts')
34 $statistics["services"] = [];
35 $statistics["services"]["appnet"] = Addon::isEnabled("appnet");
36 $statistics["services"]["blogger"] = Addon::isEnabled("blogger");
37 $statistics["services"]["buffer"] = Addon::isEnabled("buffer");
38 $statistics["services"]["dreamwidth"] = Addon::isEnabled("dwpost");
39 $statistics["services"]["gnusocial"] = Addon::isEnabled("statusnet");
40 $statistics["services"]["libertree"] = Addon::isEnabled("libertree");
41 $statistics["services"]["livejournal"] = Addon::isEnabled("ljpost");
42 $statistics["services"]["pumpio"] = Addon::isEnabled("pumpio");
43 $statistics["services"]["twitter"] = Addon::isEnabled("twitter");
44 $statistics["services"]["tumblr"] = Addon::isEnabled("tumblr");
45 $statistics["services"]["wordpress"] = Addon::isEnabled("wppost");
47 $statistics["appnet"] = $statistics["services"]["appnet"];
48 $statistics["blogger"] = $statistics["services"]["blogger"];
49 $statistics["buffer"] = $statistics["services"]["buffer"];
50 $statistics["dreamwidth"] = $statistics["services"]["dreamwidth"];
51 $statistics["gnusocial"] = $statistics["services"]["gnusocial"];
52 $statistics["libertree"] = $statistics["services"]["libertree"];
53 $statistics["livejournal"] = $statistics["services"]["livejournal"];
54 $statistics["pumpio"] = $statistics["services"]["pumpio"];
55 $statistics["twitter"] = $statistics["services"]["twitter"];
56 $statistics["tumblr"] = $statistics["services"]["tumblr"];
57 $statistics["wordpress"] = $statistics["services"]["wordpress"];
59 header("Content-Type: application/json");
60 echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
61 Logger::log("statistics_init: printed " . print_r($statistics, true), Logger::DATA);