X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fconversation.php;h=8c09fa98b34379aebee0facb95623db1bd4e36cd;hb=d89f90e80ee4a7101bcef7369b64ab5fb42f7b1a;hp=7d0ec0b724566c72d003aa392946a605956c5c70;hpb=2a7de4213f5ce4f2272ae5e4fbb16ffce2852c2c;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 7d0ec0b724..8c09fa98b3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -460,7 +460,6 @@ function conv_get_blocklist() * that are based on unique features of the calling module. * @param App $a * @param array $items - * @param Pager $pager * @param $mode * @param $update * @param bool $preview @@ -470,7 +469,7 @@ function conv_get_blocklist() * @throws ImagickException * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ -function conversation(App $a, array $items, Pager $pager, $mode, $update, $preview = false, $order = 'commented', $uid = 0) +function conversation(App $a, array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) { $ssl_state = (local_user() ? true : false); @@ -506,7 +505,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ . (!empty($_GET['cmax']) ? '&cmax=' . rawurlencode($_GET['cmax']) : '') . (!empty($_GET['file']) ? '&file=' . rawurlencode($_GET['file']) : '') - . "'; var profile_page = " . $pager->getPage() . "; \r\n"; + . "'; \r\n"; } } elseif ($mode === 'profile') { $items = conversation_add_children($items, false, $order, $uid); @@ -525,7 +524,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ $live_update_div = '
' . "\r\n" . "\r\n"; + . "; var netargs = '?f='; \r\n"; } } } elseif ($mode === 'notes') { @@ -535,7 +534,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ if (!$update) { $live_update_div = '
' . "\r\n" . "\r\n"; + . "; var netargs = '/?f='; \r\n"; } } elseif ($mode === 'display') { $items = conversation_add_children($items, false, $order, $uid); @@ -544,7 +543,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ if (!$update) { $live_update_div = '
' . "\r\n" . ""; + . ""; } } elseif ($mode === 'community') { $items = conversation_add_children($items, true, $order, $uid); @@ -553,7 +552,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ if (!$update) { $live_update_div = '
' . "\r\n" . "\r\n"; + ."/?f='; \r\n"; } } elseif ($mode === 'contacts') { $items = conversation_add_children($items, false, $order, $uid); @@ -562,7 +561,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ if (!$update) { $live_update_div = '
' . "\r\n" . "\r\n"; + ."/?f='; \r\n"; } } elseif ($mode === 'search') { $live_update_div = '' . "\r\n"; @@ -580,14 +579,18 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ $items = $cb['items']; $conv_responses = [ - 'like' => ['title' => DI::l10n()->t('Likes','title')], - 'dislike' => ['title' => DI::l10n()->t('Dislikes','title')], - 'attendyes' => ['title' => DI::l10n()->t('Attending','title')], - 'attendno' => ['title' => DI::l10n()->t('Not attending','title')], - 'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')], - 'announce' => ['title' => DI::l10n()->t('Reshares','title')] + 'like' => [], + 'dislike' => [], + 'attendyes' => [], + 'attendno' => [], + 'attendmaybe' => [], + 'announce' => [], ]; + if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { + unset($conv_responses['dislike']); + } + // array with html for each thread (parent+comments) $threads = []; $threadsid = -1; @@ -679,6 +682,10 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ 'share' => null, ]; + if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { + unset($likebuttons['dislike']); + } + $body = Item::prepareBody($item, true, $preview); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); @@ -1565,56 +1572,3 @@ function render_location_dummy(array $item) { return $item['coord']; } } - -function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) { - $ret = []; - foreach ($response_verbs as $v) { - $ret[$v] = []; - $ret[$v]['count'] = $conv_responses[$v][$item['uri']] ?? 0; - $ret[$v]['list'] = $conv_responses[$v][$item['uri'] . '-l'] ?? []; - $ret[$v]['self'] = $conv_responses[$v][$item['uri'] . '-self'] ?? '0'; - if (count($ret[$v]['list']) > MAX_LIKERS) { - $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS); - array_push($ret[$v]['list_part'], '' . DI::l10n()->t('View all') . ''); - } else { - $ret[$v]['list_part'] = ''; - } - $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']); - $ret[$v]['title'] = $conv_responses[$v]['title']; - } - - $count = 0; - foreach ($ret as $key) { - if ($key['count'] == true) { - $count++; - } - } - $ret['count'] = $count; - - return $ret; -} - -function get_response_button_text($v, $count) -{ - $return = ''; - switch ($v) { - case 'like': - $return = DI::l10n()->tt('Like', 'Likes', $count); - break; - case 'dislike': - $return = DI::l10n()->tt('Dislike', 'Dislikes', $count); - break; - case 'attendyes': - $return = DI::l10n()->tt('Attending', 'Attending', $count); - break; - case 'attendno': - $return = DI::l10n()->tt('Not Attending', 'Not Attending', $count); - break; - case 'attendmaybe': - $return = DI::l10n()->tt('Undecided', 'Undecided', $count); - break; - } - - return $return; -}