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.
 
 
 
 
 
 

112 lines
3.2 KiB

  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($a->config['admin_email']));
  13. $r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($adminlist[0]));
  14. $admin = array(
  15. 'name' => $r[0]['username'],
  16. 'profile'=> App::get_baseurl().'/profile/'.$r[0]['nickname'],
  17. );
  18. } else {
  19. $admin = false;
  20. }
  21. $visible_plugins = array();
  22. if(is_array($a->plugins) && count($a->plugins)) {
  23. $r = q("select * from addon where hidden = 0");
  24. if (dbm::is_result($r))
  25. foreach($r as $rr)
  26. $visible_plugins[] = $rr['name'];
  27. }
  28. Config::load('feature_lock');
  29. $locked_features = array();
  30. if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
  31. foreach($a->config['feature_lock'] as $k => $v) {
  32. if($k === 'config_loaded')
  33. continue;
  34. $locked_features[$k] = intval($v);
  35. }
  36. }
  37. $data = Array(
  38. 'version' => FRIENDICA_VERSION,
  39. 'url' => z_root(),
  40. 'plugins' => $visible_plugins,
  41. 'locked_features' => $locked_features,
  42. 'register_policy' => $register_policy[$a->config['register_policy']],
  43. 'admin' => $admin,
  44. 'site_name' => $a->config['sitename'],
  45. 'platform' => FRIENDICA_PLATFORM,
  46. 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
  47. 'no_scrape_url' => App::get_baseurl().'/noscrape'
  48. );
  49. echo json_encode($data);
  50. killme();
  51. }
  52. }
  53. function friendica_content(App $a) {
  54. $o = '';
  55. $o .= '<h3>Friendica</h3>';
  56. $o .= '<p></p><p>';
  57. $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
  58. $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
  59. $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
  60. $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a></p><p>';
  61. $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
  62. $o .= '<p></p>';
  63. $visible_plugins = array();
  64. if(is_array($a->plugins) && count($a->plugins)) {
  65. $r = q("select * from addon where hidden = 0");
  66. if (dbm::is_result($r))
  67. foreach($r as $rr)
  68. $visible_plugins[] = $rr['name'];
  69. }
  70. if(count($visible_plugins)) {
  71. $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
  72. $sorted = $visible_plugins;
  73. $s = '';
  74. sort($sorted);
  75. foreach($sorted as $p) {
  76. if(strlen($p)) {
  77. if(strlen($s)) $s .= ', ';
  78. $s .= $p;
  79. }
  80. }
  81. $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
  82. }
  83. else
  84. $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
  85. call_hooks('about_hook', $o);
  86. return $o;
  87. }