]> git.mxchange.org Git - friendica.git/blob - mod/ping.php
"profile locator/address" is now called "Identity Address" to reduce confusion
[friendica.git] / mod / ping.php
1 <?php
2
3
4
5 function ping_init(&$a) {
6
7         if(! local_user())
8                 xml_status(0);
9
10         $r = q("SELECT COUNT(*) AS `total` FROM `item` 
11                 WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d",
12                 intval(local_user())
13         );
14         $network = $r[0]['total'];
15
16         $r = q("SELECT COUNT(*) AS `total` FROM `item` 
17                 WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `type` != 'remote' ",
18                 intval(local_user())
19         );
20         $home = $r[0]['total'];
21
22         $r = q("SELECT COUNT(*) AS `total` FROM `intro` 
23                 WHERE `uid` = %d  AND `blocked` = 0 AND `ignore` = 0 ",
24                 intval(local_user())
25         );
26         $intro = $r[0]['total'];
27
28         if ($a->config['register_policy'] == REGISTER_APPROVE &&        
29                 $a->config['admin_email'] === $a->user['email']){
30                         $r = q("SELECT COUNT(*) AS `total` FROM `register`");
31                         $register = $r[0]['total'];
32         } else {
33                 $register = "0";
34         }
35
36
37         $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
38         $r = q("SELECT COUNT(*) AS `total` FROM `mail`
39                 WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
40                 intval(local_user()),
41                 dbesc($myurl)
42         );
43
44         $mail = $r[0]['total'];
45         
46         header("Content-type: text/xml");
47         echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<result><register>$register</register><intro>$intro</intro><mail>$mail</mail><net>$network</net><home>$home</home></result>\r\n";
48
49         killme();
50 }
51