Don't link unknown likes.
Likes/Dislikes of unknown channels have disabled links now. Fixed intention a bit, romved a unused variable.
This commit is contained in:
parent
22e6e691ca
commit
d2268a412d
@ -440,7 +440,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
for($x = 0; $x < count($arr_blocked); $x ++)
|
||||
$arr_blocked[$x] = trim($arr_blocked[$x]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -480,11 +479,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
. ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
|
||||
. ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '')
|
||||
. ((x($_GET,'uri')) ? '&uri=' . $_GET['uri'] : '')
|
||||
|
||||
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
elseif($mode === 'channel') {
|
||||
@ -502,15 +498,12 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif($mode === 'display') {
|
||||
$profile_owner = local_user();
|
||||
$page_writeable = false;
|
||||
|
||||
$live_update_div = '<div id="live-display"></div>' . "\r\n";
|
||||
|
||||
}
|
||||
|
||||
elseif($mode === 'page') {
|
||||
@ -519,10 +512,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
$live_update_div = '<div id="live-page"></div>' . "\r\n";
|
||||
}
|
||||
|
||||
|
||||
elseif($mode === 'search') {
|
||||
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
||||
}
|
||||
|
||||
elseif($mode === 'photos') {
|
||||
$profile_onwer = $a->profile['profile_uid'];
|
||||
$page_writeable = ($profile_owner == local_user());
|
||||
@ -555,7 +548,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
$alike = array();
|
||||
$dlike = array();
|
||||
|
||||
|
||||
// array with html for each thread (parent+comments)
|
||||
$threads = array();
|
||||
$threadsid = -1;
|
||||
@ -609,7 +601,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
$profile_name = $item['author-link'];
|
||||
|
||||
|
||||
|
||||
$tags=array();
|
||||
$hashtags = array();
|
||||
$mentions = array();
|
||||
@ -631,7 +622,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
$profile_link = $item['author']['xchan_url'];
|
||||
$profile_avatar = $item['author']['xchan_photo_m'];
|
||||
|
||||
|
||||
$location = format_location($item);
|
||||
|
||||
localize_item($item);
|
||||
@ -663,7 +653,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
$unverified = '';
|
||||
|
||||
|
||||
|
||||
$tags=array();
|
||||
$terms = get_terms_oftype($item['term'],array(TERM_HASHTAG,TERM_MENTION,TERM_UNKNOWN));
|
||||
if(count($terms))
|
||||
@ -699,7 +688,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
'has_folders' => ((count($folders)) ? 'true' : ''),
|
||||
'categories' => $categories,
|
||||
'folders' => $folders,
|
||||
|
||||
'text' => strip_tags($body),
|
||||
'ago' => relative_date($item['created']),
|
||||
'app' => $item['app'],
|
||||
@ -786,12 +774,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
}
|
||||
}
|
||||
|
||||
like_puller($a, $item, $alike, 'like');
|
||||
|
||||
|
||||
like_puller($a,$item,$alike,'like');
|
||||
|
||||
if(feature_enabled($profile_owner,'dislike'))
|
||||
like_puller($a,$item,$dlike,'dislike');
|
||||
if(feature_enabled($profile_owner, 'dislike'))
|
||||
like_puller($a, $item, $dlike, 'dislike');
|
||||
|
||||
if(! visible_activity($item)) {
|
||||
continue;
|
||||
@ -826,7 +812,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($page_mode === 'traditional' || $page_mode === 'preview') {
|
||||
$page_template = get_markup_template("threaded_conversation.tpl");
|
||||
}
|
||||
@ -869,7 +854,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -981,25 +965,32 @@ function item_photo_menu($item){
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
function like_puller($a,$item,&$arr,$mode) {
|
||||
/**
|
||||
* @brief Returns a like/dislike entry.
|
||||
* It gives back a HTML link to the channel that liked/disliked.
|
||||
*
|
||||
* @param array $a (not used)
|
||||
* @param array $item
|
||||
* @param array &$arr
|
||||
* @param string $mode like/dislike
|
||||
* @return void
|
||||
*/
|
||||
function like_puller($a, $item, &$arr, $mode) {
|
||||
|
||||
$url = '';
|
||||
$sparkle = '';
|
||||
$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'])) {
|
||||
|
||||
if($item['author']['xchan_url'])
|
||||
$url = chanlink_url($item['author']['xchan_url']);
|
||||
else
|
||||
$url = z_root();
|
||||
|
||||
if(! $item['thr_parent'])
|
||||
$item['thr_parent'] = $item['parent_mid'];
|
||||
|
||||
if(! ((isset($arr[$item['thr_parent'] . '-l'])) && (is_array($arr[$item['thr_parent'] . '-l']))))
|
||||
$arr[$item['thr_parent'] . '-l'] = array();
|
||||
|
||||
if(! isset($arr[$item['thr_parent']]))
|
||||
$arr[$item['thr_parent']] = 1;
|
||||
else
|
||||
@ -1007,7 +998,10 @@ function like_puller($a,$item,&$arr,$mode) {
|
||||
|
||||
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
|
||||
|
||||
if($url)
|
||||
$arr[$item['thr_parent'] . '-l'][] = '<a href="'. $url . '">' . $name . '</a>';
|
||||
else
|
||||
$arr[$item['thr_parent'] . '-l'][] = '<a href="#" class="disabled">' . $name . '</a>';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -232,3 +232,9 @@
|
||||
display: none;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
/* disable link handling for unknown entries */
|
||||
.dropdown-menu > li > a.disabled {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
Reference in New Issue
Block a user