1
0
Fork 0

fix "friend of" message in ping.php

This commit is contained in:
Fabio Comuni 2011-09-26 12:14:48 +02:00
parent ec4061e6fe
commit ae024edbf9

View file

@ -14,7 +14,7 @@ function ping_init(&$a) {
$friends = array(); $friends = array();
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
@ -25,13 +25,16 @@ function ping_init(&$a) {
$network = count($r); $network = count($r);
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
case 'http://activitystrea.ms/schema/1.0/like': case ACTIVITY_LIKE:
$likes[] = $it; $likes[] = $it;
break; break;
case 'http://activitystrea.ms/schema/1.0/dislike': case ACTIVITY_DISLIKE:
$dislikes[] = $it; $dislikes[] = $it;
break; break;
case 'http://activitystrea.ms/schema/1.0/make-friend': case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$friends[] = $it; $friends[] = $it;
break; break;
default: default:
@ -41,7 +44,7 @@ function ping_init(&$a) {
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
@ -51,13 +54,16 @@ function ping_init(&$a) {
$home = count($r); $home = count($r);
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
case 'http://activitystrea.ms/schema/1.0/like': case ACTIVITY_LIKE:
$likes[] = $it; $likes[] = $it;
break; break;
case 'http://activitystrea.ms/schema/1.0/dislike': case ACTIVITY_DISLIKE:
$dislikes[] = $it; $dislikes[] = $it;
break; break;
case 'http://activitystrea.ms/schema/1.0/make-friend': case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title;
$friends[] = $it; $friends[] = $it;
break; break;
default: default:
@ -154,7 +160,7 @@ function ping_init(&$a) {
} }
if (count($friends)){ if (count($friends)){
foreach ($friends as $i) { foreach ($friends as $i) {
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['pname'] ) ); echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['fname'] ) );
}; };
} }