4 use Friendica\Core\System;
5 use Friendica\Core\Config;
6 use Friendica\Database\DBM;
8 function friendica_init(App $a) {
9 if ($a->argv[1] == "json"){
10 $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
13 if (x($a->config,'admin_nickname')) {
14 $sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
16 if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
17 $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
19 $r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
21 'name' => $r[0]['username'],
22 'profile'=> System::baseUrl() . '/profile/' . $r[0]['nickname'],
28 $visible_plugins = array();
29 if (is_array($a->plugins) && count($a->plugins)) {
30 $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
31 if (DBM::is_result($r)) {
33 $visible_plugins[] = $rr['name'];
38 Config::load('feature_lock');
39 $locked_features = array();
40 if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
41 foreach ($a->config['feature_lock'] as $k => $v) {
42 if ($k === 'config_loaded') {
46 $locked_features[$k] = intval($v);
51 'version' => FRIENDICA_VERSION,
52 'url' => System::baseUrl(),
53 'plugins' => $visible_plugins,
54 'locked_features' => $locked_features,
55 'register_policy' => $register_policy[$a->config['register_policy']],
57 'site_name' => $a->config['sitename'],
58 'platform' => FRIENDICA_PLATFORM,
59 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
60 'no_scrape_url' => System::baseUrl().'/noscrape'
63 echo json_encode($data);
68 function friendica_content(App $a) {
69 $o = '<h1>Friendica</h1>' . PHP_EOL;
71 $o .= t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> ';
72 $o .= t('running at web location') . ' ' . System::baseUrl();
73 $o .= '</p>' . PHP_EOL;
76 $o .= t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.') . PHP_EOL;
77 $o .= '</p>' . PHP_EOL;
80 $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a>';
81 $o .= '</p>' . PHP_EOL;
83 $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
84 $o .= '</p>' . PHP_EOL;
86 $visible_plugins = array();
87 if (is_array($a->plugins) && count($a->plugins)) {
88 $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
89 if (DBM::is_result($r)) {
91 $visible_plugins[] = $rr['name'];
96 if (count($visible_plugins)) {
97 $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
98 $sorted = $visible_plugins;
101 foreach ($sorted as $p) {
109 $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
111 $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
114 $blocklist = Config::get('system', 'blocklist');
115 if (count($blocklist)) {
116 $o .= '<div id="about_blocklist"><p>' . t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL;
117 $o .= '<table class="table"><thead><tr><th>' . t('Blocked domain') . '</th><th>' . t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL;
118 foreach ($blocklist as $b) {
119 $o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL;
121 $o .= '</tbody></table></div>' . PHP_EOL;
124 call_hooks('about_hook', $o);