4 use Friendica\Core\System;
5 use Friendica\Core\Config;
7 function friendica_init(App $a) {
8 if ($a->argv[1] == "json"){
9 $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
12 if (x($a->config,'admin_nickname')) {
13 $sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
15 if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
16 $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
18 $r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
20 'name' => $r[0]['username'],
21 'profile'=> System::baseUrl() . '/profile/' . $r[0]['nickname'],
27 $visible_plugins = array();
28 if (is_array($a->plugins) && count($a->plugins)) {
29 $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
30 if (dbm::is_result($r)) {
32 $visible_plugins[] = $rr['name'];
37 Config::load('feature_lock');
38 $locked_features = array();
39 if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
40 foreach ($a->config['feature_lock'] as $k => $v) {
41 if ($k === 'config_loaded') {
45 $locked_features[$k] = intval($v);
50 'version' => FRIENDICA_VERSION,
51 'url' => System::baseUrl(),
52 'plugins' => $visible_plugins,
53 'locked_features' => $locked_features,
54 'register_policy' => $register_policy[$a->config['register_policy']],
56 'site_name' => $a->config['sitename'],
57 'platform' => FRIENDICA_PLATFORM,
58 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
59 'no_scrape_url' => System::baseUrl().'/noscrape'
62 echo json_encode($data);
67 function friendica_content(App $a) {
68 $o = '<h1>Friendica</h1>' . PHP_EOL;
70 $o .= t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> ';
71 $o .= t('running at web location') . ' ' . System::baseUrl();
72 $o .= '</p>' . PHP_EOL;
75 $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . PHP_EOL;
76 $o .= '</p>' . PHP_EOL;
79 $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a>';
80 $o .= '</p>' . PHP_EOL;
82 $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
83 $o .= '</p>' . PHP_EOL;
85 $visible_plugins = array();
86 if (is_array($a->plugins) && count($a->plugins)) {
87 $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
88 if (dbm::is_result($r)) {
90 $visible_plugins[] = $rr['name'];
95 if (count($visible_plugins)) {
96 $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
97 $sorted = $visible_plugins;
100 foreach ($sorted as $p) {
108 $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
110 $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
113 $blocklist = Config::get('system', 'blocklist');
114 if (count($blocklist)) {
115 $o .= '<div id="about_blocklist"><p>' . t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL;
116 $o .= '<table class="table"><thead><tr><th>' . t('Blocked domain') . '</th><th>' . t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL;
117 foreach ($blocklist as $b) {
118 $o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL;
120 $o .= '</tbody></table></div>' . PHP_EOL;
123 call_hooks('about_hook', $o);