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