2 require_once("include/datetime.php");
5 function ping_init(&$a) {
11 $r = q("SELECT COUNT(*) AS `total` FROM `item`
12 WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `wall` = 0 ",
15 $network = $r[0]['total'];
17 $r = q("SELECT COUNT(*) AS `total` FROM `item`
18 WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `wall` = 1 ",
21 $home = $r[0]['total'];
23 $intros1 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`,
24 `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
25 FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
26 WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0",
29 $intros2 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`,
30 `contact`.`name`, `contact`.`url`, `contact`.`photo`
31 FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
32 WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`contact-id`!=0",
36 $intro = $intros1[0]['total'] + $intros2[0]['total'];
37 if ($intros1[0]['total']==0) $intros1=Array();
38 if ($intros2[0]['total']==0) $intros2=Array();
39 $intros = $intros1+$intros2;
43 $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
44 $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail`
45 WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
49 $mail = $mails[0]['total'];
51 if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){
52 $regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1");
53 $register = $regs[0]['total'];
59 $notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s">%s</note>';
63 header("Content-type: text/xml");
64 echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
70 if ($register!=0) echo "<register>$register</register>";
72 echo ' <notif count="'.($mail+$intro+$register).'">';
74 foreach ($intros as $i) {
75 echo sprintf ( $notsxml,
76 $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend")
81 foreach ($mails as $i) {
82 echo sprintf ( $notsxml,
83 $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message")
88 foreach ($regs as $i) {
89 echo sprintf ( $notsxml,
90 $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration")