likes working a bit better - not translateable yet
This commit is contained in:
parent
82e74e3520
commit
417d1080d4
@ -89,15 +89,17 @@ function localize_item(&$item){
|
|||||||
$item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']);
|
$item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']);
|
||||||
|
|
||||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||||
|
/*
|
||||||
if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){
|
if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){
|
||||||
|
|
||||||
|
// FIXME we shouldn't have a DB lookup on every item
|
||||||
$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';",
|
||||||
dbesc($item['parent_uri']));
|
dbesc($item['parent_uri']));
|
||||||
if(count($r)==0) return;
|
if(count($r)==0) return;
|
||||||
$obj=$r[0];
|
$obj=$r[0];
|
||||||
|
|
||||||
$author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
$author = '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]';
|
||||||
$objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
|
$objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
|
||||||
|
|
||||||
switch($obj['verb']){
|
switch($obj['verb']){
|
||||||
@ -131,6 +133,7 @@ function localize_item(&$item){
|
|||||||
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
|
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (activity_match($item['verb'],ACTIVITY_FRIEND)) {
|
if (activity_match($item['verb'],ACTIVITY_FRIEND)) {
|
||||||
|
|
||||||
if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
|
if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
|
||||||
@ -1599,7 +1602,7 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||||||
$verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
|
$verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
|
||||||
|
|
||||||
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
|
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
|
||||||
$url = $item['author-link'];
|
$url = $item['author']['xchan_url'];
|
||||||
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
|
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
|
||||||
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
|
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
|
||||||
$sparkle = ' class="sparkle" ';
|
$sparkle = ' class="sparkle" ';
|
||||||
@ -1616,7 +1619,7 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||||||
$arr[$item['thr_parent']] = 1;
|
$arr[$item['thr_parent']] = 1;
|
||||||
else
|
else
|
||||||
$arr[$item['thr_parent']] ++;
|
$arr[$item['thr_parent']] ++;
|
||||||
$arr[$item['thr_parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
|
$arr[$item['thr_parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author']['xchan_name'] . '</a>';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
|
19
mod/like.php
19
mod/like.php
@ -44,7 +44,7 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
if(! $item_id || (! $r)) {
|
if(! $item_id || (! $r)) {
|
||||||
logger('like: no item ' . $item_id);
|
logger('like: no item ' . $item_id);
|
||||||
return;
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = $r[0];
|
$item = $r[0];
|
||||||
@ -53,10 +53,16 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
if(! perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_comments')) {
|
if(! perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_comments')) {
|
||||||
notice( t('Permission denied') . EOL);
|
notice( t('Permission denied') . EOL);
|
||||||
return;
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$remote_owner = $item['owner_xchan'];
|
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
|
||||||
|
dbesc($item['owner_xchan'])
|
||||||
|
);
|
||||||
|
if($r)
|
||||||
|
$remote_owner = $r[0];
|
||||||
|
else
|
||||||
|
killme();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -110,11 +116,10 @@ function like_content(&$a) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM item WHERE verb = '%s' AND ( item_restrict & %d )
|
$r = q("SELECT * FROM item WHERE verb = '%s' AND item_restrict = 0
|
||||||
AND owner_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1",
|
AND owner_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1",
|
||||||
dbesc($activity),
|
dbesc($activity),
|
||||||
intval(ITEM_DELETED),
|
dbesc($remote_owner['xchan_hash']),
|
||||||
dbesc($remote_owner),
|
|
||||||
intval($item_id),
|
intval($item_id),
|
||||||
dbesc($item['uri'])
|
dbesc($item['uri'])
|
||||||
);
|
);
|
||||||
@ -174,7 +179,7 @@ function like_content(&$a) {
|
|||||||
$arr['parent'] = $item['id'];
|
$arr['parent'] = $item['id'];
|
||||||
$arr['parent_uri'] = $item['uri'];
|
$arr['parent_uri'] = $item['uri'];
|
||||||
$arr['thr_parent'] = $item['uri'];
|
$arr['thr_parent'] = $item['uri'];
|
||||||
$arr['owner_xchan'] = $remote_owner;
|
$arr['owner_xchan'] = $remote_owner['xchan_hash'];
|
||||||
$arr['author_xchan'] = $observer['xchan_hash'];
|
$arr['author_xchan'] = $observer['xchan_hash'];
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user