From da2ce5c4f493e0cfe57a9ecc8229e51ed94d3a33 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 May 2021 18:56:07 -0400 Subject: [PATCH 1/5] Fix undefined tamplate variables in comment_item.tpl - Remove unused "type" hidden field in comment form - Remove unused moderated_comment.tpl files --- include/conversation.php | 1 + view/templates/comment_item.tpl | 1 - view/templates/moderated_comment.tpl | 34 ----------- .../duepuntozero/templates/comment_item.tpl | 1 - .../templates/moderated_comment.tpl | 61 ------------------- view/theme/frio/templates/comment_item.tpl | 1 - view/theme/quattro/templates/comment_item.tpl | 1 - view/theme/vier/templates/comment_item.tpl | 1 - 8 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 view/templates/moderated_comment.tpl delete mode 100644 view/theme/duepuntozero/templates/moderated_comment.tpl diff --git a/include/conversation.php b/include/conversation.php index 0a8f5cfc3..57d368e92 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1212,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'), diff --git a/view/templates/comment_item.tpl b/view/templates/comment_item.tpl index 977a5b75b..856637e26 100644 --- a/view/templates/comment_item.tpl +++ b/view/templates/comment_item.tpl @@ -5,7 +5,6 @@
{{/if}}
- {{**}} diff --git a/view/templates/moderated_comment.tpl b/view/templates/moderated_comment.tpl deleted file mode 100644 index 39dbbde47..000000000 --- a/view/templates/moderated_comment.tpl +++ /dev/null @@ -1,34 +0,0 @@ - -
- - - - - - - -
- {{$mytitle}} -
-
- - - -
- - -
- - -
diff --git a/view/theme/duepuntozero/templates/comment_item.tpl b/view/theme/duepuntozero/templates/comment_item.tpl index cd14b253c..1d416fdf1 100644 --- a/view/theme/duepuntozero/templates/comment_item.tpl +++ b/view/theme/duepuntozero/templates/comment_item.tpl @@ -5,7 +5,6 @@
{{/if}}
- {{**}} diff --git a/view/theme/duepuntozero/templates/moderated_comment.tpl b/view/theme/duepuntozero/templates/moderated_comment.tpl deleted file mode 100644 index 197d1281d..000000000 --- a/view/theme/duepuntozero/templates/moderated_comment.tpl +++ /dev/null @@ -1,61 +0,0 @@ - -
- - - - - - - -
- {{$mytitle}} -
-
- -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
-
- - -
- - -
- - -
diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index d4284d39b..aab6aee94 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -5,7 +5,6 @@
{{/if}}
- {{**}} diff --git a/view/theme/quattro/templates/comment_item.tpl b/view/theme/quattro/templates/comment_item.tpl index 1fa4e333e..cb6f4ad2f 100644 --- a/view/theme/quattro/templates/comment_item.tpl +++ b/view/theme/quattro/templates/comment_item.tpl @@ -1,6 +1,5 @@
- {{**}} diff --git a/view/theme/vier/templates/comment_item.tpl b/view/theme/vier/templates/comment_item.tpl index 0e2cbb5bb..ef48ac7ef 100644 --- a/view/theme/vier/templates/comment_item.tpl +++ b/view/theme/vier/templates/comment_item.tpl @@ -5,7 +5,6 @@
{{/if}} - {{**}} From 2c6bf754d5b55b50638d23e6f0affc338c8c09a2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 May 2021 18:59:09 -0400 Subject: [PATCH 2/5] Fix undefined variables in wall_thread.tpl - Remove unused "num_comments_text" template variable - Remove unused "item.postops" template variable mention --- src/Model/Item.php | 3 ++- src/Object/Post.php | 7 +++---- view/theme/vier/templates/wall_thread.tpl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 64bd266c8..ab99e8c1a 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3020,7 +3020,7 @@ class Item ]; if (!empty($item['plink'])) { - $ret["href"] = DI::baseUrl()->remove($item['plink']); + $ret['href'] = DI::baseUrl()->remove($item['plink']); $ret["title"] = DI::l10n()->t('link to source'); } } elseif (!empty($item['plink']) && ($item['private'] != self::PRIVATE)) { @@ -3028,6 +3028,7 @@ class Item 'href' => $item['plink'], 'orig' => $item['plink'], 'title' => DI::l10n()->t('link to source'), + 'orig_title' => DI::l10n()->t('Link to source'), ]; } else { $ret = []; diff --git a/src/Object/Post.php b/src/Object/Post.php index 6973fd236..7bd3bcefb 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -427,6 +427,8 @@ class Post $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'], @@ -543,10 +545,7 @@ class Post } } - 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' : ''); diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index f5e13137a..36e26b0a5 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -155,7 +155,7 @@ {{/if}}
-
{{$item.location_html nofilter}} {{$item.postopts}}
+
{{$item.location_html nofilter}}
From abc0616d331f487a353b6df9d681c7a6b0471593 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 May 2021 18:59:49 -0400 Subject: [PATCH 3/5] Fix undefined variables in profile/vcard.tpl --- src/Model/Profile.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Model/Profile.php b/src/Model/Profile.php index f328453e9..3e35d60c2 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -412,7 +412,12 @@ class Profile } } - $p = []; + // Expected profile/vcard.tpl profile.* template variables + $p = [ + 'address' => null, + 'edit' => null, + 'upubkey' => null, + ]; foreach ($profile as $k => $v) { $k = str_replace('-', '_', $k); $p[$k] = $v; From 43638fa29b6257aa32bf34890c0e4bc631b17d23 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 May 2021 19:03:33 -0400 Subject: [PATCH 4/5] Fix undefined variables in nav.tpl - Reworked the nav_info hook to include the rest of the array keys defined in Nav::getInfo - Replaced the theme-specific template variable nav.userinfo with the regular userinfo in frio nav.tpl - Initialized all the nav array keys --- src/Content/Nav.php | 38 ++++++++++++++++++++++--------- view/theme/frio/templates/nav.tpl | 26 ++++++++------------- view/theme/frio/theme.php | 35 ++++++++++++++-------------- 3 files changed, 55 insertions(+), 44 deletions(-) diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 01eac6733..db3fa7863 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -144,9 +144,9 @@ class Nav * array 'userinfo' => Array of user information (name, icon) * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - private static function getInfo(App $a) + private static function getInfo(App $a): array { - $ssl_state = ((local_user()) ? true : false); + $ssl_state = (bool) local_user(); /* * Our network is distributed, and as you visit friends some of the @@ -158,13 +158,27 @@ class Nav $sitelocation = $myident . substr(DI::baseUrl()->get($ssl_state), strpos(DI::baseUrl()->get($ssl_state), '//') + 2); - // nav links: array of array('href', 'text', 'extra css classes', 'title') - $nav = []; + $nav = [ + 'admin' => null, + 'apps' => null, + 'community' => null, + 'home' => null, + 'events' => null, + 'login' => null, + 'logout' => null, + 'langselector' => null, + 'messages' => null, + 'network' => null, + 'notifications' => null, + 'remote' => null, + 'search' => null, + 'usermenu' => [], + ]; // Display login or logout - $nav['usermenu'] = []; $userinfo = null; + // nav links: array of array('href', 'text', 'extra css classes', 'title') if (Session::isAuthenticated()) { $nav['logout'] = ['logout', DI::l10n()->t('Logout'), '', DI::l10n()->t('End this session')]; } else { @@ -297,13 +311,15 @@ class Nav $banner = 'logoFriendica'; } - Hook::callAll('nav_info', $nav); - - return [ + $nav_info = [ + 'banner' => $banner, + 'nav' => $nav, 'sitelocation' => $sitelocation, - 'nav' => $nav, - 'banner' => $banner, - 'userinfo' => $userinfo, + 'userinfo' => $userinfo, ]; + + Hook::callAll('nav_info', $nav_info); + + return $nav_info; } } diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index 8e1b25757..915e5e9fc 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -1,11 +1,11 @@ -{{* we have modified the navmenu (look at function frio_remote_nav() ) to have remote links. $nav.userinfo is a new variable and replaces the original $userinfo variable *}} -{{if $nav.userinfo}} +{{* we have modified the navmenu (look at function frio_remote_nav() ) to have remote links. *}} +{{if $userinfo}}
{{* {{$langselector}} *}}
{{$sitelocation}}
-{{/if}} - - -{{* The navbar for users which are not logged in *}} -{{if $nav.userinfo == ''}} +{{else}} + {{* The navbar for users which are not logged in *}} - {{/if}} {{* provide a a search input for mobile view, which expands by pressing the search icon *}}