'dislike' is not part of activitystreams core schema - use symblic constants instead

This commit is contained in:
Friendika 2011-07-07 16:56:44 -07:00
parent 0470eb7805
commit eccaa525cc

View file

@ -5,8 +5,7 @@
*/ */
function localize_item(&$item){ function localize_item(&$item){
if ($item['verb']=="http://activitystrea.ms/schema/1.0/like" || if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){
$item['verb']=="http://activitystrea.ms/schema/1.0/dislike"){
$r = q("SELECT * from `item`,`contact` WHERE $r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';", `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
@ -18,9 +17,9 @@ function localize_item(&$item){
$objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]'; $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
switch($obj['verb']){ switch($obj['verb']){
case 'http://activitystrea.ms/schema/1.0/post': case ACTIVITY_POST:
switch ($obj['object-type']){ switch ($obj['object-type']){
case 'http://activitystrea.ms/schema/1.0/event': case ACTIVITY_OBJ_EVENT:
$post_type = t('event'); $post_type = t('event');
break; break;
default: default:
@ -40,19 +39,19 @@ function localize_item(&$item){
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]'; $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
switch($item['verb']){ switch($item['verb']){
case "http://activitystrea.ms/schema/1.0/like": case ACTIVITY_LIKE :
$bodyverb = t('%1$s likes %2$s\'s %3$s'); $bodyverb = t('%1$s likes %2$s\'s %3$s');
break; break;
case "http://activitystrea.ms/schema/1.0/dislike": case ACTIVITY_DISLIKE:
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
break; break;
} }
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink); $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
} }
if ($item['verb']=='http://activitystrea.ms/schema/1.0/make-friend'){ if ($item['verb']=== ACTIVITY_FRIEND){
if ($item['object-type']=="" || $item['object-type']!='http://activitystrea.ms/schema/1.0/person') return; if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
$Aname = $item['author-name']; $Aname = $item['author-name'];
$Alink = $item['author-link']; $Alink = $item['author-link'];