Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

56 lines
2.7 KiB

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