X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=57d368e927b9723ff16ca4191e26b2fe8db72837;hb=c18622caf999e2ddf7e2cda5bf4a50d6506c3931;hp=7eda2277baafb1c285f99947b894f876717dbff7;hpb=472cc10ac5e8a688a7767313474f60d05edf52f6;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 7eda2277ba..57d368e927 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1,6 +1,6 @@ title; @@ -176,9 +174,17 @@ function localize_item(&$item) } } - $A = '[url=' . Contact::magicLink($Alink) . ']' . $Aname . '[/url]'; - $B = '[url=' . Contact::magicLink($Blink) . ']' . $Bname . '[/url]'; - if ($Bphoto != "") { + $author = ['uid' => 0, 'id' => $item['author-id'], + 'network' => $item['author-network'], 'url' => $item['author-link']]; + $A = '[url=' . Contact::magicLinkByContact($author) . ']' . $item['author-name'] . '[/url]'; + + if (!empty($Blink)) { + $B = '[url=' . Contact::magicLink($Blink) . ']' . $Bname . '[/url]'; + } else { + $B = ''; + } + + if ($Bphoto != "" && !empty($Blink)) { $Bphoto = '[url=' . Contact::magicLink($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]'; } @@ -201,7 +207,7 @@ function localize_item(&$item) if ($activity->match($item['verb'], Activity::TAG)) { $fields = ['author-id', 'author-link', 'author-name', 'author-network', 'verb', 'object-type', 'resource-id', 'body', 'plink']; - $obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]); + $obj = Post::selectFirst($fields, ['uri' => $item['parent-uri']]); if (!DBA::isResult($obj)) { return; } @@ -256,16 +262,15 @@ function localize_item(&$item) // add zrl's to public images $photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is"; if (preg_match($photo_pattern, $item['body'])) { - $photo_replace = '[url=' . Profile::zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]'; + $photo_replace = '[url=' . Profile::zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' , true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]'; $item['body'] = BBCode::pregReplaceInTag($photo_pattern, $photo_replace, 'url', $item['body']); } // add sparkle links to appropriate permalinks - $author = ['uid' => 0, 'id' => $item['author-id'], - 'network' => $item['author-network'], 'url' => $item['author-link']]; - // Only create a redirection to a magic link when logged in if (!empty($item['plink']) && Session::isAuthenticated()) { + $author = ['uid' => 0, 'id' => $item['author-id'], + 'network' => $item['author-network'], 'url' => $item['author-link']]; $item['plink'] = Contact::magicLinkByContact($author, $item['plink']); } } @@ -324,8 +329,7 @@ function conv_get_blocklist() $blocklist = []; foreach (explode(',', $str_blocked) as $entry) { - // The 4th parameter guarantees that there always will be a public contact entry - $cid = Contact::getIdForURL(trim($entry), 0, false, ['url' => trim($entry)]); + $cid = Contact::getIdForURL(trim($entry), 0, false); if (!empty($cid)) { $blocklist[] = $cid; } @@ -467,7 +471,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview]; - Hook::callAll('conversation_start',$cb); + Hook::callAll('conversation_start', $cb); $items = $cb['items']; @@ -477,7 +481,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'attendyes' => [], 'attendno' => [], 'attendmaybe' => [], - 'announce' => [], + 'announce' => [], ]; if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { @@ -544,7 +548,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; - Hook::callAll('render_location',$locate); + Hook::callAll('render_location', $locate); $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: ''); localize_item($item); @@ -614,7 +618,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'folders' => $folders, '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'])), + 'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']), $item['app']) : Temporal::getRelativeDate($item['created'])), 'location_html' => $location_html, 'indent' => '', 'owner_name' => '', @@ -678,7 +682,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $item['pagedrop'] = $page_dropping; if ($item['gravity'] == GRAVITY_PARENT) { - $item_object = new Post($item); + $item_object = new PostObject($item); $conv->addParent($item_object); } } @@ -697,6 +701,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o '$live_update' => $live_update_div, '$remove' => DI::l10n()->t('remove'), '$mode' => $mode, + '$update' => $update, '$user' => $a->user, '$threads' => $threads, '$dropping' => ($page_dropping ? DI::l10n()->t('Delete Selected Items') : False), @@ -710,59 +715,77 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o * * @param mixed $thread_items Database statement with thread posts * @param boolean $pinned Is the item pinned? + * @param array $activity Contact data of the resharer * * @return array items with parents and comments */ -function conversation_fetch_comments($thread_items, $pinned) { +function conversation_fetch_comments($thread_items, bool $pinned, array $activity) { $comments = []; - while ($row = Item::fetch($thread_items)) { + while ($row = Post::fetch($thread_items)) { + if (!empty($activity)) { + if (($row['gravity'] == GRAVITY_PARENT)) { + $row['post-reason'] = Item::PR_ANNOUNCEMENT; + $row = array_merge($row, $activity); + $contact = Contact::getById($activity['causer-id'], ['url', 'name', 'thumb']); + $row['causer-link'] = $contact['url']; + $row['causer-avatar'] = $contact['thumb']; + $row['causer-name'] = $contact['name']; + } elseif (($row['gravity'] == GRAVITY_ACTIVITY) && ($row['verb'] == Activity::ANNOUNCE) && + ($row['author-id'] == $activity['causer-id'])) { + continue; + } + } + $name = $row['causer-contact-type'] == Contact::TYPE_RELAY ? $row['causer-link'] : $row['causer-name']; - switch ($row['post-type']) { - case Item::PT_TO: + switch ($row['post-reason']) { + case Item::PR_TO: $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')]; break; - case Item::PT_CC: + case Item::PR_CC: $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')]; break; - case Item::PT_BTO: + case Item::PR_BTO: $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')]; break; - case Item::PT_BCC: + case Item::PR_BCC: $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')]; break; - case Item::PT_FOLLOWER: + case Item::PR_FOLLOWER: $row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])]; break; - case Item::PT_TAG: + case Item::PR_TAG: $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')]; break; - case Item::PT_ANNOUNCEMENT: + case Item::PR_ANNOUNCEMENT: if (!empty($row['causer-id']) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')) { + $row['owner-id'] = $row['causer-id']; $row['owner-link'] = $row['causer-link']; $row['owner-avatar'] = $row['causer-avatar']; $row['owner-name'] = $row['causer-name']; } if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) { - $row['reshared'] = DI::l10n()->t('%s reshared this.', '' . htmlentities($name) . ''); + $causer = ['uid' => 0, 'id' => $row['causer-id'], + 'network' => $row['causer-network'], 'url' => $row['causer-link']]; + $row['reshared'] = DI::l10n()->t('%s reshared this.', '' . htmlentities($name) . ''); } $row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))]; break; - case Item::PT_COMMENT: + case Item::PR_COMMENT: $row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])]; break; - case Item::PT_STORED: + case Item::PR_STORED: $row['direction'] = ['direction' => 8, 'title' => DI::l10n()->t('Stored')]; break; - case Item::PT_GLOBAL: + case Item::PR_GLOBAL: $row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')]; break; - case Item::PT_RELAY: + case Item::PR_RELAY: $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s.', $name))]; break; - case Item::PT_FETCHED: + case Item::PR_FETCHED: $row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s', $name))]; break; } @@ -809,9 +832,23 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid) $items = []; foreach ($parents AS $parent) { - $condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)", - $parent['uri'], $uid, Verb::getID(Activity::FOLLOW)]; - $items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params); + if (!empty($parent['thr-parent-id']) && !empty($parent['gravity']) && ($parent['gravity'] == GRAVITY_ACTIVITY)) { + $condition = ["`parent-uri-id` = ? AND `uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)", + $parent['thr-parent-id'], $uid, Verb::getID(Activity::FOLLOW)]; + if (!empty($parent['author-id'])) { + $activity = ['causer-id' => $parent['author-id']]; + foreach (['commented', 'received', 'created'] as $orderfields) { + if (!empty($parent[$orderfields])) { + $activity[$orderfields] = $parent[$orderfields]; + } + } + } + } else { + $condition = ["`parent-uri-id` = ? AND `uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)", + $parent['uri-id'], $uid, Verb::getID(Activity::FOLLOW)]; + $activity = []; + } + $items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params, $activity); } foreach ($items as $index => $item) { @@ -828,21 +865,22 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid) /** * Fetch conversation items * - * @param array $parent - * @param array $items - * @param array $condition - * @param boolean $block_authors - * @param array $params + * @param array $parent Parent Item array + * @param array $items Item array + * @param array $condition SQL condition + * @param boolean $block_authors Don't show posts from contacts that are hidden (used on the community page) + * @param array $params SQL parameters + * @param array $activity Contact data of the resharer * @return array */ -function conversation_fetch_items(array $parent, array $items, array $condition, bool $block_authors, array $params) { +function conversation_fetch_items(array $parent, array $items, array $condition, bool $block_authors, array $params, array $activity) { if ($block_authors) { - $condition[0] .= " AND NOT `author`.`hidden`"; + $condition[0] .= " AND NOT `author-hidden`"; } - $thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity', 'post-type']), $condition, $params); + $thread_items = Post::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['pinned', 'contact-uid', 'gravity', 'post-type', 'post-reason']), $condition, $params); - $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false); + $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false, $activity); if (count($comments) != 0) { $items = array_merge($items, $comments); @@ -850,7 +888,8 @@ function conversation_fetch_items(array $parent, array $items, array $condition, return $items; } -function item_photo_menu($item) { +function item_photo_menu($item) +{ $sub_link = ''; $poke_link = ''; $contact_url = ''; @@ -861,8 +900,8 @@ function item_photo_menu($item) { $block_link = ''; $ignore_link = ''; - if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self']) { - $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;'; + if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self'] && !$item['mention']) { + $sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;'; } $author = ['uid' => 0, 'id' => $item['author-id'], @@ -871,7 +910,7 @@ function item_photo_menu($item) { $sparkle = (strpos($profile_link, 'redir/') === 0); $cid = 0; - $pcid = Contact::getIdForURL($item['author-link'], 0, false); + $pcid = $item['author-id']; $network = ''; $rel = 0; $condition = ['uid' => local_user(), 'nurl' => Strings::normaliseLink($item['author-link'])]; @@ -891,8 +930,8 @@ function item_photo_menu($item) { if (!empty($pcid)) { $contact_url = 'contact/' . $pcid; $posts_link = $contact_url . '/posts'; - $block_link = $contact_url . '/block'; - $ignore_link = $contact_url . '/ignore'; + $block_link = $item['self'] ? '' : $contact_url . '/block'; + $ignore_link = $item['self'] ? '' : $contact_url . '/ignore'; } if ($cid && !$item['self']) { @@ -928,7 +967,7 @@ function item_photo_menu($item) { if ((($cid == 0) || ($rel == Contact::FOLLOWER)) && in_array($item['network'], Protocol::FEDERATED)) { - $menu[DI::l10n()->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']); + $menu[DI::l10n()->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']) . '&auto=1'; } } else { $menu = [DI::l10n()->t('View Profile') => $item['author-link']]; @@ -945,7 +984,7 @@ function item_photo_menu($item) { if (strpos($v, 'javascript:') === 0) { $v = substr($v, 11); $o .= '
  • ' . $k . '
  • ' . PHP_EOL; - } elseif ($v!='') { + } elseif ($v) { $o .= '
  • ' . $k . '
  • ' . PHP_EOL; } } @@ -957,13 +996,14 @@ function item_photo_menu($item) { * * Increments the count of each matching activity and adds a link to the author as needed. * - * @param array $item + * @param array $activity * @param array &$conv_responses (already created with builtin activity structure) * @return void * @throws ImagickException * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ -function builtin_activity_puller($item, &$conv_responses) { +function builtin_activity_puller(array $activity, array &$conv_responses) +{ foreach ($conv_responses as $mode => $v) { $sparkle = ''; @@ -990,47 +1030,45 @@ function builtin_activity_puller($item, &$conv_responses) { return; } - if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['gravity'] != GRAVITY_PARENT)) { - $author = ['uid' => 0, 'id' => $item['author-id'], - 'network' => $item['author-network'], 'url' => $item['author-link']]; + if (!empty($activity['verb']) && DI::activity()->match($activity['verb'], $verb) && ($activity['gravity'] != GRAVITY_PARENT)) { + $author = [ + 'uid' => 0, + 'id' => $activity['author-id'], + 'network' => $activity['author-network'], + 'url' => $activity['author-link'] + ]; $url = Contact::magicLinkByContact($author); if (strpos($url, 'redir/') === 0) { $sparkle = ' class="sparkle" '; } - $url = '' . htmlentities($item['author-name']) . ''; - - if (empty($item['thr-parent'])) { - $item['thr-parent'] = $item['parent-uri']; - } + $link = '' . htmlentities($activity['author-name']) . ''; - if (!(isset($conv_responses[$mode][$item['thr-parent'] . '-l']) - && is_array($conv_responses[$mode][$item['thr-parent'] . '-l']))) { - $conv_responses[$mode][$item['thr-parent'] . '-l'] = []; - } - - // only list each unique author once - if (in_array($url,$conv_responses[$mode][$item['thr-parent'] . '-l'])) { - continue; + if (empty($activity['thr-parent-id'])) { + $activity['thr-parent-id'] = $activity['parent-uri-id']; } // Skip when the causer of the parent is the same than the author of the announce - if (($verb == Activity::ANNOUNCE) && Item::exists(['uri' => $item['thr-parent'], - 'uid' => $item['uid'], 'causer-id' => $item['author-id'], 'gravity' => GRAVITY_PARENT])) { + if (($verb == Activity::ANNOUNCE) && Post::exists(['uri-id' => $activity['thr-parent-id'], + 'uid' => $activity['uid'], 'causer-id' => $activity['author-id'], 'gravity' => GRAVITY_PARENT])) { continue; } - if (!isset($conv_responses[$mode][$item['thr-parent']])) { - $conv_responses[$mode][$item['thr-parent']] = 1; - } else { - $conv_responses[$mode][$item['thr-parent']] ++; + if (!isset($conv_responses[$mode][$activity['thr-parent-id']])) { + $conv_responses[$mode][$activity['thr-parent-id']] = [ + 'links' => [], + 'self' => 0, + ]; + } elseif (in_array($link, $conv_responses[$mode][$activity['thr-parent-id']]['links'])) { + // only list each unique author once + continue; } - if (public_contact() == $item['author-id']) { - $conv_responses[$mode][$item['thr-parent'] . '-self'] = 1; + if (public_contact() == $activity['author-id']) { + $conv_responses[$mode][$activity['thr-parent-id']]['self'] = 1; } - $conv_responses[$mode][$item['thr-parent'] . '-l'][] = $url; + $conv_responses[$mode][$activity['thr-parent-id']]['links'][] = $link; // there can only be one activity verb per item so if we found anything, we can stop looking return; @@ -1039,26 +1077,26 @@ function builtin_activity_puller($item, &$conv_responses) { } /** - * Format the vote text for a profile item + * Format the activity text for an item/photo/video * - * @param int $cnt = number of people who vote the item - * @param array $arr = array of pre-linked names of likers/dislikers - * @param string $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe' - * @param int $id = item id + * @param array $links = array of pre-linked names of actors + * @param string $verb = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe' + * @param int $id = item id * @return string formatted text * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ -function format_like($cnt, array $arr, $type, $id) { +function format_activity(array $links, $verb, $id) { $o = ''; $expanded = ''; $phrase = ''; - if ($cnt == 1) { - $likers = $arr[0]; + $total = count($links); + if ($total == 1) { + $likers = $links[0]; // Phrase if there is only one liker. In other cases it will be uses for the expanded // list which show all likers - switch ($type) { + switch ($verb) { case 'like' : $phrase = DI::l10n()->t('%s likes this.', $likers); break; @@ -1078,56 +1116,51 @@ function format_like($cnt, array $arr, $type, $id) { $phrase = DI::l10n()->t('%s reshared this.', $likers); break; } - } - - if ($cnt > 1) { - $total = count($arr); + } elseif ($total > 1) { if ($total < MAX_LIKERS) { - $last = DI::l10n()->t('and') . ' ' . $arr[count($arr)-1]; - $arr2 = array_slice($arr, 0, -1); - $likers = implode(', ', $arr2) . ' ' . $last; + $likers = implode(', ', array_slice($links, 0, -1)); + $likers .= ' ' . DI::l10n()->t('and') . ' ' . $links[count($links)-1]; } else { - $arr = array_slice($arr, 0, MAX_LIKERS - 1); - $likers = implode(', ', $arr); - $likers .= DI::l10n()->t('and %d other people', $total - MAX_LIKERS); + $likers = implode(', ', array_slice($links, 0, MAX_LIKERS - 1)); + $likers .= ' ' . DI::l10n()->t('and %d other people', $total - MAX_LIKERS); } - $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\""; + $spanatts = "class=\"fakelink\" onclick=\"openClose('{$verb}list-$id');\""; $explikers = ''; - switch ($type) { + switch ($verb) { case 'like': - $phrase = DI::l10n()->t('%2$d people like this', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people like this', $spanatts, $total); $explikers = DI::l10n()->t('%s like this.', $likers); break; case 'dislike': - $phrase = DI::l10n()->t('%2$d people don\'t like this', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people don\'t like this', $spanatts, $total); $explikers = DI::l10n()->t('%s don\'t like this.', $likers); break; case 'attendyes': - $phrase = DI::l10n()->t('%2$d people attend', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people attend', $spanatts, $total); $explikers = DI::l10n()->t('%s attend.', $likers); break; case 'attendno': - $phrase = DI::l10n()->t('%2$d people don\'t attend', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people don\'t attend', $spanatts, $total); $explikers = DI::l10n()->t('%s don\'t attend.', $likers); break; case 'attendmaybe': - $phrase = DI::l10n()->t('%2$d people attend maybe', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people attend maybe', $spanatts, $total); $explikers = DI::l10n()->t('%s attend maybe.', $likers); break; case 'announce': - $phrase = DI::l10n()->t('%2$d people reshared this', $spanatts, $cnt); + $phrase = DI::l10n()->t('%2$d people reshared this', $spanatts, $total); $explikers = DI::l10n()->t('%s reshared this.', $likers); break; } - $expanded .= "\t" . ''; + $expanded .= "\t" . ''; } $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [ '$phrase' => $phrase, - '$type' => $type, + '$type' => $verb, '$id' => $id ]); $o .= $expanded; @@ -1152,16 +1185,16 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$term' => DI::l10n()->t('Tag term:'), '$fileas' => DI::l10n()->t('Save to Folder:'), '$whereareu' => DI::l10n()->t('Where are you right now?'), - '$delitems' => DI::l10n()->t("Delete item\x28s\x29?") + '$delitems' => DI::l10n()->t("Delete item\x28s\x29?"), + '$is_mobile' => DI::mode()->isMobile(), ]); $jotplugins = ''; Hook::callAll('jot_tool', $jotplugins); - // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins)); $tpl = Renderer::getMarkupTemplate("jot.tpl"); - $o .= Renderer::replaceMacros($tpl,[ + $o .= Renderer::replaceMacros($tpl, [ '$new_post' => DI::l10n()->t('New Post'), '$return_path' => DI::args()->getQueryString(), '$action' => 'item', @@ -1179,6 +1212,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$edimg' => DI::l10n()->t('Image'), '$edurl' => DI::l10n()->t('Link'), '$edattach' => DI::l10n()->t('Link or Media'), + '$edvideo' => DI::l10n()->t('Video'), '$setloc' => DI::l10n()->t('Set your location'), '$shortsetloc' => DI::l10n()->t('set location'), '$noloc' => DI::l10n()->t('Clear browser location'), @@ -1242,17 +1276,17 @@ function get_item_children(array &$item_list, array $parent, $recursive = true) if ($item['gravity'] != GRAVITY_PARENT) { if ($recursive) { // Fallback to parent-uri if thr-parent is not set - $thr_parent = $item['thr-parent']; + $thr_parent = $item['thr-parent-id']; if ($thr_parent == '') { - $thr_parent = $item['parent-uri']; + $thr_parent = $item['parent-uri-id']; } - if ($thr_parent == $parent['uri']) { + if ($thr_parent == $parent['uri-id']) { $item['children'] = get_item_children($item_list, $item); $children[] = $item; unset($item_list[$i]); } - } elseif ($item['parent'] == $parent['id']) { + } elseif ($item['parent-uri-id'] == $parent['uri-id']) { $children[] = $item; unset($item_list[$i]); } @@ -1382,7 +1416,7 @@ function conv_sort(array $item_list, $order) continue; } - $item_array[$item['uri']] = $item; + $item_array[$item['uri-id']] = $item; } // Extract the top level items