sparkle links for friends-of-friends, bug #13
This commit is contained in:
parent
fecef140d5
commit
7f1f18675c
2 changed files with 51 additions and 28 deletions
26
boot.php
26
boot.php
|
@ -2591,3 +2591,29 @@ function unamp($s) {
|
||||||
return str_replace('&', '&', $s);
|
return str_replace('&', '&', $s);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
if(! function_exists('extract_item_authors')) {
|
||||||
|
function extract_item_authors($arr,$uid) {
|
||||||
|
|
||||||
|
if((! $uid) || (! is_array($arr)) || (! count($arr)))
|
||||||
|
return array();
|
||||||
|
$urls = array();
|
||||||
|
foreach($arr as $rr) {
|
||||||
|
if(! in_array("'" . dbesc($rr['author-link']) . "'",$urls))
|
||||||
|
$urls[] = "'" . dbesc($rr['author-link']) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
// pre-quoted, don't put quotes on %s
|
||||||
|
if(count($urls)) {
|
||||||
|
$r = q("SELECT `id`,`url` FROM `contact` WHERE `uid` = %d AND `url` IN ( %s ) AND `network` = 'dfrn' AND `self` = 0 AND `blocked` = 0 ",
|
||||||
|
intval($uid),
|
||||||
|
implode(',',$urls)
|
||||||
|
);
|
||||||
|
if(count($r)) {
|
||||||
|
$ret = array();
|
||||||
|
foreach($r as $rr)
|
||||||
|
$ret[$rr['url']] = $rr['id'];
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array();
|
||||||
|
}}
|
|
@ -196,12 +196,13 @@ function network_content(&$a, $update = 0) {
|
||||||
AND `item`.`parent` = `parentitem`.`id`
|
AND `item`.`parent` = `parentitem`.`id`
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ",
|
ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ",
|
||||||
intval($_SESSION['uid']),
|
intval(local_user()),
|
||||||
intval($a->pager['start']),
|
intval($a->pager['start']),
|
||||||
intval($a->pager['itemspage'])
|
intval($a->pager['itemspage'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$author_contacts = extract_item_authors($r,local_user());
|
||||||
|
|
||||||
$cmnt_tpl = load_view_file('view/comment_item.tpl');
|
$cmnt_tpl = load_view_file('view/comment_item.tpl');
|
||||||
$like_tpl = load_view_file('view/like.tpl');
|
$like_tpl = load_view_file('view/like.tpl');
|
||||||
|
@ -232,11 +233,17 @@ function network_content(&$a, $update = 0) {
|
||||||
|
|
||||||
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
||||||
|
|
||||||
if(strlen($item['author-link']) && link_compare($item['author-link'],$item['url'])
|
if(strlen($item['author-link']) && link_compare($item['author-link'],$item['url'])) {
|
||||||
&& ($item['network'] === 'dfrn') && (! $item['self'])) {
|
if(($item['network'] === 'dfrn') && (! $item['self'])) {
|
||||||
$profile_link = $redirect_url;
|
$profile_link = $redirect_url;
|
||||||
$sparkle = ' sparkle';
|
$sparkle = ' sparkle';
|
||||||
}
|
}
|
||||||
|
elseif(isset($author_contacts[$item['author-link']])) {
|
||||||
|
$profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
|
||||||
|
$sparkle = ' sparkle';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
$location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
||||||
$coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
|
$coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
|
||||||
|
@ -289,15 +296,15 @@ function network_content(&$a, $update = 0) {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$template = $tpl;
|
$template = $tpl;
|
||||||
$commentww = '';
|
$commentww = '';
|
||||||
|
$sparkle = '';
|
||||||
$owner_url = $owner_photo = $owner_name = '';
|
$owner_url = $owner_photo = $owner_name = '';
|
||||||
|
|
||||||
$profile_url = $item['url'];
|
|
||||||
|
|
||||||
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
|
||||||
|
|
||||||
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
|
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||||
|
@ -333,7 +340,6 @@ function network_content(&$a, $update = 0) {
|
||||||
$owner_url = $redirect_url;
|
$owner_url = $redirect_url;
|
||||||
$osparkle = ' sparkle';
|
$osparkle = ' sparkle';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,13 +370,6 @@ function network_content(&$a, $update = 0) {
|
||||||
|
|
||||||
$drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
|
$drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(($item['network'] === 'dfrn') && (! $item['self'] )) {
|
|
||||||
$profile_url = $redirect_url;
|
|
||||||
$sparkle = ' sparkle';
|
|
||||||
}
|
|
||||||
|
|
||||||
$photo = $item['photo'];
|
$photo = $item['photo'];
|
||||||
$thumb = $item['thumb'];
|
$thumb = $item['thumb'];
|
||||||
|
|
||||||
|
@ -381,22 +380,20 @@ function network_content(&$a, $update = 0) {
|
||||||
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
|
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
|
||||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
|
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
|
||||||
|
|
||||||
|
if(strlen($item['author-link']) && link_compare($item['author-link'],$item['url'])) {
|
||||||
$profile_link = $profile_url;
|
if(($item['network'] === 'dfrn') && (! $item['self'])) {
|
||||||
|
|
||||||
// Can we use our special contact URL for this author?
|
|
||||||
|
|
||||||
if(strlen($item['author-link'])) {
|
|
||||||
if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
|
|
||||||
$profile_link = $redirect_url;
|
$profile_link = $redirect_url;
|
||||||
$sparkle = ' sparkle';
|
$sparkle = ' sparkle';
|
||||||
}
|
}
|
||||||
else {
|
elseif(isset($author_contacts[$item['author-link']])) {
|
||||||
|
$profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
|
||||||
|
$sparkle = ' sparkle';
|
||||||
|
}
|
||||||
|
else
|
||||||
$profile_link = $item['author-link'];
|
$profile_link = $item['author-link'];
|
||||||
$sparkle = '';
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
$profile_link = $item['url'];
|
||||||
|
|
||||||
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
|
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
|
||||||
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
|
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
|
||||||
|
|
Loading…
Reference in a new issue