]> git.mxchange.org Git - friendica.git/blob - mod/friendica.php
Added noscrape feature.
[friendica.git] / mod / friendica.php
1 <?php
2
3 function friendica_init(&$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'=> $a->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(count($r))
28                                 foreach($r as $rr)
29                                         $visible_plugins[] = $rr['name'];
30                 }
31
32                 $data = Array(
33                         'version' => FRIENDICA_VERSION,
34                         'url' => z_root(),
35                         'plugins' => $visible_plugins,
36                         'register_policy' =>  $register_policy[$a->config['register_policy']],
37                         'admin' => $admin,
38                         'site_name' => $a->config['sitename'],
39                         'platform' => FRIENDICA_PLATFORM,
40                         'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
41                 );
42                 
43                 //Enable noscrape?
44                 if(!!get_config('system','enable_noscrape'))
45                         $data['no_scrape_url'] = $a->get_baseurl().'/noscrape';
46
47                 echo json_encode($data);
48                 killme();
49         }
50 }
51
52
53
54 function friendica_content(&$a) {
55
56         $o = '';
57         $o .= '<h3>Friendica</h3>';
58
59
60         $o .= '<p></p><p>';
61
62         $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
63         $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
64
65         $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';        
66
67         $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>';
68         $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
69
70         $o .= '<p></p>';
71
72         $visible_plugins = array();
73         if(is_array($a->plugins) && count($a->plugins)) {
74                 $r = q("select * from addon where hidden = 0");
75                 if(count($r))
76                         foreach($r as $rr)
77                                 $visible_plugins[] = $rr['name'];
78         }
79
80
81         if(count($visible_plugins)) {
82                 $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
83                 $sorted = $visible_plugins;
84                 $s = '';
85                 sort($sorted);
86                 foreach($sorted as $p) {
87                         if(strlen($p)) {
88                                 if(strlen($s)) $s .= ', ';
89                                 $s .= $p;
90                         }
91                 }
92                 $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
93         }
94         else
95                 $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
96
97         call_hooks('about_hook', $o);   
98
99         return $o;
100
101 }