]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #10228 from MrPetovan/bug/warnings
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 11 May 2021 04:10:29 +0000 (06:10 +0200)
committerGitHub <noreply@github.com>
Tue, 11 May 2021 04:10:29 +0000 (06:10 +0200)
[PHP 8] Fix undefined template variables

1  2 
src/Object/Post.php

diff --combined src/Object/Post.php
index 2e6eb1bf6e986e588d1d05e327d85713f28c063c,7bd3bcefb3e5f03df5692067ca6aa2410b9ba038..d8d210e65cbc5ee58b05e16c6ea35e6c7609ec13
@@@ -427,6 -427,8 +427,8 @@@ class Pos
                $tmp_item = [
                        'template'        => $this->getTemplate(),
                        'type'            => implode("", array_slice(explode("/", $item['verb']), -1)),
+                       'comment_firstcollapsed' => false,
+                       'comment_lastcollapsed' => false,
                        'suppress_tags'   => DI::config()->get('system', 'suppress_tags'),
                        'tags'            => $tags['tags'],
                        'hashtags'        => $tags['hashtags'],
                        }
                }
  
-               if ($this->isToplevel()) {
-                       $result['total_comments_num'] = "$total_children";
-                       $result['total_comments_text'] = DI::l10n()->tt('comment', 'comments', $total_children);
-               }
+               $result['total_comments_num'] = $this->isToplevel() ? $total_children : 0;
  
                $result['private'] = $item['private'];
                $result['toplevel'] = ($this->isToplevel() ? 'toplevel_item' : '');
  
                $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
                foreach ($terms as $term) {
 +                      if (!$term['url']) {
 +                              DI::logger()->warning('Mention term with no URL', ['term' => $term]);
 +                              continue;
 +                      }
 +
                        $profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']);
 -                      if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
 +                      if (!empty($profile['addr']) && (($profile['contact-type'] ?? Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
                                ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
                                $text .= '@' . $profile['addr'] . ' ';
                        }
                                '$qcomment'    => $qcomment,
                                '$default'     => $default_text,
                                '$profile_uid' => $uid,
 -                              '$mylink'      => DI::baseUrl()->remove($a->contact['url']),
 +                              '$mylink'      => DI::baseUrl()->remove($a->contact['url'] ?? ''),
                                '$mytitle'     => DI::l10n()->t('This is you'),
 -                              '$myphoto'     => DI::baseUrl()->remove($a->contact['thumb']),
 +                              '$myphoto'     => DI::baseUrl()->remove($a->contact['thumb'] ?? ''),
                                '$comment'     => DI::l10n()->t('Comment'),
                                '$submit'      => DI::l10n()->t('Submit'),
                                '$loading'     => DI::l10n()->t('Loading...'),