Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
3.8KB

  1. <?php
  2. use Friendica\Core\Config;
  3. function friendica_init(App $a) {
  4. if ($a->argv[1] == "json"){
  5. $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
  6. $sql_extra = '';
  7. if (x($a->config,'admin_nickname')) {
  8. $sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
  9. }
  10. if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
  11. $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
  12. $r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
  13. $admin = array(
  14. 'name' => $r[0]['username'],
  15. 'profile'=> App::get_baseurl() . '/profile/' . $r[0]['nickname'],
  16. );
  17. } else {
  18. $admin = false;
  19. }
  20. $visible_plugins = array();
  21. if (is_array($a->plugins) && count($a->plugins)) {
  22. $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
  23. if (dbm::is_result($r)) {
  24. foreach($r as $rr) {
  25. $visible_plugins[] = $rr['name'];
  26. }
  27. }
  28. }
  29. Config::load('feature_lock');
  30. $locked_features = array();
  31. if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
  32. foreach ($a->config['feature_lock'] as $k => $v) {
  33. if ($k === 'config_loaded') {
  34. continue;
  35. }
  36. $locked_features[$k] = intval($v);
  37. }
  38. }
  39. $data = Array(
  40. 'version' => FRIENDICA_VERSION,
  41. 'url' => z_root(),
  42. 'plugins' => $visible_plugins,
  43. 'locked_features' => $locked_features,
  44. 'register_policy' => $register_policy[$a->config['register_policy']],
  45. 'admin' => $admin,
  46. 'site_name' => $a->config['sitename'],
  47. 'platform' => FRIENDICA_PLATFORM,
  48. 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
  49. 'no_scrape_url' => App::get_baseurl().'/noscrape'
  50. );
  51. echo json_encode($data);
  52. killme();
  53. }
  54. }
  55. function friendica_content(App $a) {
  56. $o = '<h1>Friendica</h1>' . PHP_EOL;
  57. $o .= '<p>';
  58. $o .= t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> ';
  59. $o .= t('running at web location') . ' ' . z_root();
  60. $o .= '</p>' . PHP_EOL;
  61. $o .= '<p>';
  62. $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . PHP_EOL;
  63. $o .= '</p>' . PHP_EOL;
  64. $o .= '<p>';
  65. $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a>';
  66. $o .= '</p>' . PHP_EOL;
  67. $o .= '<p>';
  68. $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
  69. $o .= '</p>' . PHP_EOL;
  70. $visible_plugins = array();
  71. if (is_array($a->plugins) && count($a->plugins)) {
  72. $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
  73. if (dbm::is_result($r)) {
  74. foreach($r as $rr) {
  75. $visible_plugins[] = $rr['name'];
  76. }
  77. }
  78. }
  79. if (count($visible_plugins)) {
  80. $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
  81. $sorted = $visible_plugins;
  82. $s = '';
  83. sort($sorted);
  84. foreach ($sorted as $p) {
  85. if (strlen($p)) {
  86. if (strlen($s)) {
  87. $s .= ', ';
  88. }
  89. $s .= $p;
  90. }
  91. }
  92. $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
  93. } else {
  94. $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
  95. }
  96. $blocklist = Config::get('system', 'blocklist');
  97. if (count($blocklist)) {
  98. $o .= '<div id="about_blocklist"><p>' . t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL;
  99. $o .= '<table class="table"><thead><tr><th>' . t('Blocked domain') . '</th><th>' . t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL;
  100. foreach ($blocklist as $b) {
  101. $o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL;
  102. }
  103. $o .= '</tbody></table></div>' . PHP_EOL;
  104. }
  105. call_hooks('about_hook', $o);
  106. return $o;
  107. }