aboutsummaryrefslogtreecommitdiffstats
path: root/include/conversation.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/conversation.php')
-rw-r--r--include/conversation.php234
1 files changed, 182 insertions, 52 deletions
diff --git a/include/conversation.php b/include/conversation.php
index c260eb4a0..1673bc9fb 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -363,7 +363,7 @@ function localize_item(&$item){
if(intval($item['item_obscured'])
&& strlen($item['body']) && (! strpos($item['body'],'data'))) {
- $item['body'] = json_encode(crypto_encapsulate($item['body'],get_config('system','pubkey')));
+ $item['body'] = z_obscure($item['body']);
}
}
@@ -473,22 +473,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if (local_channel())
load_pconfig(local_channel(),'');
- $arr_blocked = null;
-
- if (local_channel())
- $str_blocked = get_pconfig(local_channel(),'system','blocked');
- if (! local_channel() && ($mode == 'network')) {
- $sys = get_sys_channel();
- $id = $sys['channel_id'];
- $str_blocked = get_pconfig($id,'system','blocked');
- }
-
- if ($str_blocked) {
- $arr_blocked = explode(',',$str_blocked);
- for ($x = 0; $x < count($arr_blocked); $x ++)
- $arr_blocked[$x] = trim($arr_blocked[$x]);
- }
-
$profile_owner = 0;
$page_writeable = false;
$live_update_div = '';
@@ -615,17 +599,13 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
foreach($items as $item) {
- if($arr_blocked) {
- $blocked = false;
- foreach($arr_blocked as $b) {
- if(($b) && (($item['author_xchan'] == $b) || ($item['owner_xchan'] == $b))) {
- $blocked = true;
- break;
- }
- }
- if($blocked)
- continue;
- }
+ $x = [ 'mode' => $mode, 'item' => $item ];
+ call_hooks('stream_item',$x);
+
+ if($x['item']['blocked'])
+ continue;
+
+ $item = $x['item'];
$threadsid++;
@@ -709,7 +689,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'id' => (($preview) ? 'P0' : $item['item_id']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
'profile_url' => $profile_link,
- 'item_photo_menu' => item_photo_menu($item),
+ 'thread_action_menu' => thread_action_menu($item,$mode),
+ 'thread_author_menu' => thread_author_menu($item,$mode),
'name' => $profile_name,
'sparkle' => $sparkle,
'lock' => $lock,
@@ -787,28 +768,14 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
// Check for any blocked authors
- if($arr_blocked) {
- $blocked = false;
- foreach($arr_blocked as $b) {
- if(($b) && ($item['author_xchan'] == $b)) {
- $blocked = true;
- break;
- }
- }
- if($blocked)
- continue;
- }
- // Check all the kids too
+ $x = [ 'mode' => $mode, 'item' => $item ];
+ call_hooks('stream_item',$x);
+
+ if($x['item']['blocked'])
+ continue;
- if($arr_blocked && $item['children']) {
- for($d = 0; $d < count($item['children']); $d ++) {
- foreach($arr_blocked as $b) {
- if(($b) && ($item['children'][$d]['author_xchan'] == $b))
- $item['children'][$d]['author_blocked'] = true;
- }
- }
- }
+ $item = $x['item'];
builtin_activity_puller($item, $conv_responses);
@@ -994,6 +961,169 @@ function item_photo_menu($item){
return $o;
}
+
+function thread_action_menu($item,$mode = '') {
+
+ $menu = [];
+
+ if((local_channel()) && local_channel() == $item['uid']) {
+ $menu[] = [
+ 'menu' => 'view_source',
+ 'title' => t('View Source'),
+ 'icon' => 'eye',
+ 'action' => 'viewsrc(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+
+ if(! in_array($mode, [ 'network-new', 'search', 'community'])) {
+ if($item['parent'] == $item['id'] && (get_observer_hash() != $item['author_xchan'])) {
+ $menu[] = [
+ 'menu' => 'follow_thread',
+ 'title' => t('Follow Thread'),
+ 'icon' => 'plus',
+ 'action' => 'dosubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ $menu[] = [
+ 'menu' => 'unfollow_thread',
+ 'title' => t('Unfollow Thread'),
+ 'icon' => 'minus',
+ 'action' => 'dounsubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ }
+
+
+
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_action_menu', $args);
+
+ return $args['menu'];
+
+}
+
+function thread_author_menu($item, $mode = '') {
+
+ $menu = [];
+
+ $local_channel = local_channel();
+
+ if($local_channel) {
+ if(! count(App::$contacts))
+ load_contact_links($local_channel);
+ $channel = App::get_channel();
+ $channel_hash = (($channel) ? $channel['channel_hash'] : '');
+ }
+
+ $profile_link = chanlink_hash($item['author_xchan']);
+ if($item['uid'] > 0)
+ $pm_url = z_root() . '/mail/new/?f=&hash=' . $item['author_xchan'];
+
+ if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts))
+ $contact = App::$contacts[$item['author_xchan']];
+ else
+ if($local_channel && $item['author']['xchan_addr'])
+ $follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
+
+ if($contact) {
+ $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
+ if (! intval($contact['abook_self']))
+ $contact_url = z_root() . '/connedit/' . $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',
+ 'title' => t('View Profile'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $profile_link
+ ];
+ }
+
+ if($posts_link) {
+ $menu[] = [
+ 'menu' => 'view_posts',
+ 'title' => t('Activity/Posts'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $posts_link
+ ];
+ }
+
+ if($follow_url) {
+ $menu[] = [
+ 'menu' => 'follow',
+ 'title' => t('Connect'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $follow_url
+ ];
+ }
+
+ if($contact_url) {
+ $menu[] = [
+ 'menu' => 'connedit',
+ 'title' => t('Edit Connection'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $contact_url
+ ];
+ }
+
+ if($pm_url) {
+ $menu[] = [
+ 'menu' => 'prv_message',
+ 'title' => t('Message'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $pm_url
+ ];
+ }
+
+ if($ratings_url) {
+ $menu[] = [
+ 'menu' => 'ratings',
+ 'title' => t('Ratings'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $ratings_url
+ ];
+ }
+
+ if($poke_link) {
+ $menu[] = [
+ 'menu' => 'poke',
+ 'title' => t('Poke'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $poke_link
+ ];
+ }
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_author_menu', $args);
+
+ return $args['menu'];
+
+}
+
+
+
+
+
/**
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
*
@@ -1434,7 +1564,7 @@ function format_location($item) {
if(strpos($item['location'],'#') === 0) {
$location = substr($item['location'],1);
- $location = ((strpos($location,'[') !== false) ? bbcode($location) : $location);
+ $location = ((strpos($location,'[') !== false) ? zidify_links(bbcode($location)) : $location);
}
else {
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
@@ -1486,7 +1616,7 @@ function prepare_page($item) {
'$author' => (($naked) ? '' : $item['author']['xchan_name']),
'$auth_url' => (($naked) ? '' : zid($item['author']['xchan_url'])),
'$date' => (($naked) ? '' : datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'Y-m-d H:i')),
- '$title' => smilies(bbcode($item['title'])),
+ '$title' => zidify_links(smilies(bbcode($item['title']))),
'$body' => $body['html'],
'$preview' => $preview,
'$link' => $link,
@@ -1752,7 +1882,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) {
$tabs[] = array(
- 'label' => t('Wiki'),
+ 'label' => t('Wikis'),
'url' => z_root() . '/wiki/' . $nickname,
'sel' => ((argv(0) == 'wiki') ? 'active' : ''),
'title' => t('Wiki'),