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.
 
 
 
 
 
 

110 lines
3.1 KiB

  1. <?php
  2. function friendica_init(&$a) {
  3. if ($a->argv[1]=="json"){
  4. $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
  5. $sql_extra = '';
  6. if(x($a->config,'admin_nickname')) {
  7. $sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname']));
  8. }
  9. if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){
  10. $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
  11. //$r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($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'=> $a->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(count($r))
  24. foreach($r as $rr)
  25. $visible_plugins[] = $rr['name'];
  26. }
  27. load_config('feature_lock');
  28. $locked_features = array();
  29. if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
  30. foreach($a->config['feature_lock'] as $k => $v) {
  31. if($k === 'config_loaded')
  32. continue;
  33. $locked_features[$k] = intval($v);
  34. }
  35. }
  36. $data = Array(
  37. 'version' => FRIENDICA_VERSION,
  38. 'url' => z_root(),
  39. 'plugins' => $visible_plugins,
  40. 'locked_features' => $locked_features,
  41. 'register_policy' => $register_policy[$a->config['register_policy']],
  42. 'admin' => $admin,
  43. 'site_name' => $a->config['sitename'],
  44. 'platform' => FRIENDICA_PLATFORM,
  45. 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
  46. 'no_scrape_url' => $a->get_baseurl().'/noscrape'
  47. );
  48. echo json_encode($data);
  49. killme();
  50. }
  51. }
  52. function friendica_content(&$a) {
  53. $o = '';
  54. $o .= '<h3>Friendica</h3>';
  55. $o .= '<p></p><p>';
  56. $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
  57. $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
  58. $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
  59. $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>';
  60. $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
  61. $o .= '<p></p>';
  62. $visible_plugins = array();
  63. if(is_array($a->plugins) && count($a->plugins)) {
  64. $r = q("select * from addon where hidden = 0");
  65. if(count($r))
  66. foreach($r as $rr)
  67. $visible_plugins[] = $rr['name'];
  68. }
  69. if(count($visible_plugins)) {
  70. $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
  71. $sorted = $visible_plugins;
  72. $s = '';
  73. sort($sorted);
  74. foreach($sorted as $p) {
  75. if(strlen($p)) {
  76. if(strlen($s)) $s .= ', ';
  77. $s .= $p;
  78. }
  79. }
  80. $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
  81. }
  82. else
  83. $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
  84. call_hooks('about_hook', $o);
  85. return $o;
  86. }