From ae024edbf9d9210126902b241bf9b7d2dbece1ec Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 26 Sep 2011 12:14:48 +0200 Subject: [PATCH] fix "friend of" message in ping.php --- mod/ping.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index 38a32744d..d11af2e0e 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -14,7 +14,7 @@ function ping_init(&$a) { $friends = array(); $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` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -25,13 +25,16 @@ function ping_init(&$a) { $network = count($r); foreach ($r as $it) { switch($it['verb']){ - case 'http://activitystrea.ms/schema/1.0/like': + case ACTIVITY_LIKE: $likes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/dislike': + case ACTIVITY_DISLIKE: $dislikes[] = $it; 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; break; default: @@ -41,7 +44,7 @@ function ping_init(&$a) { $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` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -51,13 +54,16 @@ function ping_init(&$a) { $home = count($r); foreach ($r as $it) { switch($it['verb']){ - case 'http://activitystrea.ms/schema/1.0/like': + case ACTIVITY_LIKE: $likes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/dislike': + case ACTIVITY_DISLIKE: $dislikes[] = $it; 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; break; default: @@ -154,7 +160,7 @@ function ping_init(&$a) { } if (count($friends)){ 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'] ) ); }; }