]> git.mxchange.org Git - friendica.git/blob - mod/statistics_json.php
Cleanup /format pre-move
[friendica.git] / mod / statistics_json.php
1 <?php
2
3 /**
4  * @file mod/statistics_json.php
5  */
6
7 require_once("include/plugin.php");
8
9 function statistics_json_init(App $a) {
10
11         if (!get_config("system", "nodeinfo")) {
12                 http_status_exit(404);
13                 killme();
14         }
15
16         $statistics = array(
17                 "name" => $a->config["sitename"],
18                 "network" => FRIENDICA_PLATFORM,
19                 "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
20                 "registrations_open" => ($a->config['register_policy'] != 0),
21                 "total_users" => get_config('nodeinfo', 'total_users'),
22                 "active_users_halfyear" => get_config('nodeinfo', 'active_users_halfyear'),
23                 "active_users_monthly" => get_config('nodeinfo', 'active_users_monthly'),
24                 "local_posts" => get_config('nodeinfo', 'local_posts')
25         );
26
27         $statistics["services"] = array();
28         $statistics["services"]["appnet"] = plugin_enabled("appnet");
29         $statistics["services"]["blogger"] = plugin_enabled("blogger");
30         $statistics["services"]["buffer"] = plugin_enabled("buffer");
31         $statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
32         $statistics["services"]["facebook"] = plugin_enabled("fbpost");
33         $statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
34         $statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
35         $statistics["services"]["libertree"] = plugin_enabled("libertree");
36         $statistics["services"]["livejournal"] = plugin_enabled("ljpost");
37         $statistics["services"]["pumpio"] = plugin_enabled("pumpio");
38         $statistics["services"]["twitter"] = plugin_enabled("twitter");
39         $statistics["services"]["tumblr"] = plugin_enabled("tumblr");
40         $statistics["services"]["wordpress"] = plugin_enabled("wppost");
41
42         $statistics["appnet"] = $statistics["services"]["appnet"];
43         $statistics["blogger"] = $statistics["services"]["blogger"];
44         $statistics["buffer"] = $statistics["services"]["buffer"];
45         $statistics["dreamwidth"] = $statistics["services"]["dreamwidth"];
46         $statistics["facebook"] = $statistics["services"]["facebook"];
47         $statistics["gnusocial"] = $statistics["services"]["gnusocial"];
48         $statistics["googleplus"] = $statistics["services"]["googleplus"];
49         $statistics["libertree"] = $statistics["services"]["libertree"];
50         $statistics["livejournal"] = $statistics["services"]["livejournal"];
51         $statistics["pumpio"] = $statistics["services"]["pumpio"];
52         $statistics["twitter"] = $statistics["services"]["twitter"];
53         $statistics["tumblr"] = $statistics["services"]["tumblr"];
54         $statistics["wordpress"] = $statistics["services"]["wordpress"];
55
56         header("Content-Type: application/json");
57         echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
58         logger("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
59         killme();
60 }