X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=b25fae4f71683b47317bba6bde90583a5124c613;hb=725296a6f2189a5470eaab8bcdcc2645545de261;hp=dda15fa65bfe61949a327bf25baad7aa4e6de9c1;hpb=a491c5d916fa1e162d4fcd9fb056e0259e0e7c85;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index dda15fa65b..b25fae4f71 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -520,10 +520,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $threadsid++; - $owner_url = ''; - $owner_name = ''; - $sparkle = ''; - // prevent private email from leaking. if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) { continue; @@ -540,14 +536,14 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'network' => $item['author-network'], 'url' => $item['author-link']]; $profile_link = Contact::magicLinkByContact($author); + $sparkle = ''; if (strpos($profile_link, 'redir/') === 0) { $sparkle = ' sparkle'; } $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; Hook::callAll('render_location',$locate); - - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); + $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: ''); localize_item($item); if ($mode === 'network-new') { @@ -563,10 +559,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'delete' => DI::l10n()->t('Delete'), ]; - $star = false; - $isstarred = "unstarred"; - - $lock = false; $likebuttons = [ 'like' => null, 'dislike' => null, @@ -577,7 +569,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o unset($likebuttons['dislike']); } - $body = Item::prepareBody($item, true, $preview); + $body_html = Item::prepareBody($item, true, $preview); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); @@ -596,13 +588,13 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), 'linktitle' => DI::l10n()->t('View %s\'s profile @ %s', $profile_name, $item['author-link']), 'profile_url' => $profile_link, - 'item_photo_menu' => item_photo_menu($item), + 'item_photo_menu_html' => item_photo_menu($item), 'name' => $profile_name, 'sparkle' => $sparkle, - 'lock' => $lock, + 'lock' => false, 'thumb' => DI::baseUrl()->remove($item['author-avatar']), 'title' => $title, - 'body' => $body, + 'body_html' => $body_html, 'tags' => $tags['tags'], 'hashtags' => $tags['hashtags'], 'mentions' => $tags['mentions'], @@ -613,23 +605,23 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'has_folders' => ((count($folders)) ? 'true' : ''), 'categories' => $categories, 'folders' => $folders, - 'text' => strip_tags($body), + 'text' => strip_tags($body_html), 'localtime' => DateTimeFormat::local($item['created'], 'r'), 'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']),$item['app']) : Temporal::getRelativeDate($item['created'])), - 'location' => $location, + 'location_html' => $location_html, 'indent' => '', - 'owner_name' => $owner_name, - 'owner_url' => $owner_url, + 'owner_name' => '', + 'owner_url' => '', 'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']), 'plink' => Item::getPlink($item), 'edpost' => false, - 'isstarred' => $isstarred, - 'star' => $star, + 'isstarred' => 'unstarred', + 'star' => false, 'drop' => $drop, 'vote' => $likebuttons, - 'like' => '', - 'dislike' => '', - 'comment' => '', + 'like_html' => '', + 'dislike_html' => '', + 'comment_html' => '', 'conv' => (($preview) ? '' : ['href'=> 'display/'.$item['guid'], 'title'=> DI::l10n()->t('View in context')]), 'previewing' => $previewing, 'wait' => DI::l10n()->t('Please wait'), @@ -741,32 +733,48 @@ function conversation_fetch_comments($thread_items, $pinned) { $direction = ['direction' => 5, 'title' => DI::l10n()->t('%s commented on this.', $row['author-name'])]; } - if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id'])) { - if (Contact::isSharing($row['author-id'], $row['uid'])) { + switch ($row['post-type']) { + case Item::PT_TO: + $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')]; + break; + case Item::PT_CC: + $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')]; + break; + case Item::PT_BTO: + $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')]; + break; + case Item::PT_BCC: + $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')]; + break; + case Item::PT_FOLLOWER: $row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])]; - } else { - if ($row['post-type'] == Item::PT_TAG) { - $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')]; - } - $parentlines[] = $lineno; + break; + case Item::PT_TAG: + $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')]; + break; + case Item::PT_ANNOUNCEMENT: + $row['direction'] = ['direction' => 3, 'title' => DI::l10n()->t('Reshared')]; + break; + case Item::PT_COMMENT: + $row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])]; + break; + case Item::PT_STORED: + $row['direction'] = ['direction' => 8, 'title' => DI::l10n()->t('Stored')]; + break; + case Item::PT_GLOBAL: + $row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')]; + break; + case Item::PT_RELAY: + $row['direction'] = ['direction' => 10, 'title' => DI::l10n()->t('Relay')]; + break; + case Item::PT_FETCHED: + $row['direction'] = ['direction' => 2, 'title' => DI::l10n()->t('Fetched')]; + break; } - switch ($row['post-type']) { - case Item::PT_TO: - $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')]; - break; - case Item::PT_CC: - $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')]; - break; - case Item::PT_BTO: - $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')]; - break; - case Item::PT_BCC: - $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')]; - break; - case Item::PT_FOLLOWER: - $row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])]; - } + if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id']) && + !Contact::isSharing($row['author-id'], $row['uid'])) { + $parentlines[] = $lineno; } if ($row['gravity'] == GRAVITY_PARENT) { @@ -1164,17 +1172,12 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) $jotplugins = ''; Hook::callAll('jot_tool', $jotplugins); - $query_str = DI::args()->getQueryString(); - if (strpos($query_str, 'public=1') !== false) { - $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str); - } - // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins)); $tpl = Renderer::getMarkupTemplate("jot.tpl"); $o .= Renderer::replaceMacros($tpl,[ '$new_post' => DI::l10n()->t('New Post'), - '$return_path' => $query_str, + '$return_path' => DI::args()->getQueryString(), '$action' => 'item', '$share' => ($x['button'] ?? '') ?: DI::l10n()->t('Share'), '$loading' => DI::l10n()->t('Loading...'), @@ -1495,13 +1498,3 @@ function sort_thr_commented(array $a, array $b) { return strcmp($b['commented'], $a['commented']); } - -function render_location_dummy(array $item) { - if (!empty($item['location']) && !empty($item['location'])) { - return $item['location']; - } - - if (!empty($item['coord']) && !empty($item['coord'])) { - return $item['coord']; - } -}