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.
 
 
 
 
 
 

98 lines
2.7 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. $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. echo json_encode($data);
  38. killme();
  39. }
  40. }
  41. function friendica_content(&$a) {
  42. $o = '';
  43. $o .= '<h3>Friendica</h3>';
  44. $o .= '<p></p><p>';
  45. $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
  46. $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
  47. $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
  48. $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>';
  49. $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
  50. $o .= '<p></p>';
  51. $visible_plugins = array();
  52. if(is_array($a->plugins) && count($a->plugins)) {
  53. $r = q("select * from addon where hidden = 0");
  54. if(count($r))
  55. foreach($r as $rr)
  56. $visible_plugins[] = $rr['name'];
  57. }
  58. if(count($visible_plugins)) {
  59. $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
  60. $sorted = $visible_plugins;
  61. $s = '';
  62. sort($sorted);
  63. foreach($sorted as $p) {
  64. if(strlen($p)) {
  65. if(strlen($s)) $s .= ', ';
  66. $s .= $p;
  67. }
  68. }
  69. $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
  70. }
  71. else
  72. $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
  73. call_hooks('about_hook', $o);
  74. return $o;
  75. }