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.
 
 
 
 
 
 

61 lines
2.6 KiB

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