aboutsummaryrefslogtreecommitdiffstats
path: root/include/conversation.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/conversation.php')
-rw-r--r--include/conversation.php68
1 files changed, 21 insertions, 47 deletions
diff --git a/include/conversation.php b/include/conversation.php
index d450bc609..fe001a79d 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -165,7 +165,7 @@ function localize_item(&$item){
case 'Note':
default:
$post_type = t('post');
- if(($obj['parent'] && $obj['id'] != $obj['parent']) || $obj['inReplyTo'])
+ if(((isset($obj['parent']) && isset($obj['id']) && $obj['id'] != $obj['parent'])) || isset($obj['inReplyTo']))
$post_type = t('comment');
break;
}
@@ -567,15 +567,12 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$page_writeable = ($profile_owner == local_channel());
if (!$update) {
- $tab = notags(trim((string)$_GET['tab']));
- if ($tab === 'posts') {
- // This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
- // because browser prefetching might change it on us. We have to deliver it with the page.
-
- $live_update_div = '<div id="live-channel"></div>' . "\r\n"
- . "<script> var profile_uid = " . App::$profile['profile_uid']
- . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
- }
+ // This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
+ // because browser prefetching might change it on us. We have to deliver it with the page.
+
+ $live_update_div = '<div id="live-channel"></div>' . "\r\n"
+ . "<script> var profile_uid = " . App::$profile['profile_uid']
+ . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
}
}
@@ -970,7 +967,7 @@ function best_link_url($item) {
$best_url = '';
$sparkle = false;
- $clean_url = normalise_link($item['author-link']);
+ $clean_url = isset($item['author-link']) ? normalise_link($item['author-link']) : '';
if((local_channel()) && (local_channel() == $item['uid'])) {
if(isset(App::$contacts) && x(App::$contacts,$clean_url)) {
@@ -1071,6 +1068,8 @@ function thread_author_menu($item, $mode = '') {
$profile_link = chanlink_hash($item['author_xchan']);
$contact = false;
+ $follow_url = '';
+
if($channel['channel_hash'] !== $item['author_xchan']) {
if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) {
$contact = App::$contacts[$item['author_xchan']];
@@ -1083,19 +1082,18 @@ function thread_author_menu($item, $mode = '') {
}
}
+
+ $contact_url = '';
+ $posts_link = '';
+ $poke_link = '';
+
if($contact) {
$poke_link = ((Apps::system_app_installed($local_channel, 'Poke')) ? z_root() . '/poke/?f=&c=' . $contact['abook_id'] : '');
- if (! intval($contact['abook_self']))
+ if (isset($contact['abook_self']) && !intval($contact['abook_self']))
$contact_url = z_root() . '/connections#' . $contact['abook_id'];
$posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
-
- $clean_url = normalise_link($item['author-link']);
}
- $rating_enabled = get_config('system','rating_enabled');
-
- $ratings_url = (($rating_enabled) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
-
if($profile_link) {
$menu[] = [
'menu' => 'view_profile',
@@ -1144,30 +1142,6 @@ function thread_author_menu($item, $mode = '') {
];
}
- if($pm_url) {
- $menu[] = [
- 'menu' => 'prv_message',
- 'title' => t('Message'),
- 'icon' => 'fw',
- 'action' => '',
- 'href' => $pm_url,
- 'data' => '',
- 'class' => ''
- ];
- }
-
- if($ratings_url) {
- $menu[] = [
- 'menu' => 'ratings',
- 'title' => t('Ratings'),
- 'icon' => 'fw',
- 'action' => '',
- 'href' => $ratings_url,
- 'data' => '',
- 'class' => ''
- ];
- }
-
if($poke_link) {
$menu[] = [
'menu' => 'poke',
@@ -1766,11 +1740,11 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$ret = array();
foreach($response_verbs as $v) {
- $ret[$v] = array();
- $ret[$v]['count'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid']] : 0);
- $ret[$v]['list'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid'] . '-l'] : '');
- $ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
- $ret[$v]['title'] = $conv_responses[$v]['title'];
+ $ret[$v] = [];
+ $ret[$v]['count'] = $conv_responses[$v][$item['mid']] ?? 0;
+ $ret[$v]['list'] = ((isset($conv_responses[$v][$item['mid']])) ? $conv_responses[$v][$item['mid'] . '-l'] : '');
+ $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
+ $ret[$v]['title'] = $conv_responses[$v]['title'] ?? '';
$ret[$v]['modal'] = (($ret[$v]['count'] > MAX_LIKERS) ? true : false);
}