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.

101 lines
2.8 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  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. $data = Array(
  28. 'version' => FRIENDICA_VERSION,
  29. 'url' => z_root(),
  30. 'plugins' => $visible_plugins,
  31. 'register_policy' => $register_policy[$a->config['register_policy']],
  32. 'admin' => $admin,
  33. 'site_name' => $a->config['sitename'],
  34. 'platform' => FRIENDICA_PLATFORM,
  35. 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
  36. );
  37. //Enable noscrape?
  38. if(!get_config('system','disable_noscrape'))
  39. $data['no_scrape_url'] = $a->get_baseurl().'/noscrape';
  40. echo json_encode($data);
  41. killme();
  42. }
  43. }
  44. function friendica_content(&$a) {
  45. $o = '';
  46. $o .= '<h3>Friendica</h3>';
  47. $o .= '<p></p><p>';
  48. $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
  49. $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
  50. $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
  51. $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">the bucktracker at github</a></p><p>';
  52. $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
  53. $o .= '<p></p>';
  54. $visible_plugins = array();
  55. if(is_array($a->plugins) && count($a->plugins)) {
  56. $r = q("select * from addon where hidden = 0");
  57. if(count($r))
  58. foreach($r as $rr)
  59. $visible_plugins[] = $rr['name'];
  60. }
  61. if(count($visible_plugins)) {
  62. $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
  63. $sorted = $visible_plugins;
  64. $s = '';
  65. sort($sorted);
  66. foreach($sorted as $p) {
  67. if(strlen($p)) {
  68. if(strlen($s)) $s .= ', ';
  69. $s .= $p;
  70. }
  71. }
  72. $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
  73. }
  74. else
  75. $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
  76. call_hooks('about_hook', $o);
  77. return $o;
  78. }