From 4f9f86e310a433d56622527be002ba2a474c5240 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Nov 2018 18:56:26 +0000 Subject: [PATCH] We are now escaping many template fields --- src/Module/Contact.php | 10 +-- src/Object/Post.php | 6 +- view/templates/admin/addon_details.tpl | 2 +- view/templates/admin/contactblock.tpl | 4 +- view/templates/admin/users.tpl | 16 ++-- view/templates/hovercard.tpl | 14 ++-- view/templates/profile_vcard.tpl | 6 +- view/templates/vcard-widget.tpl | 10 +-- view/templates/wall_thread.tpl | 8 +- view/templates/widget_forumlist.tpl | 8 +- .../duepuntozero/templates/profile_vcard.tpl | 4 +- view/theme/frio/templates/admin/addons.tpl | 2 +- .../frio/templates/admin/contactblock.tpl | 8 +- view/theme/frio/templates/admin/queue.tpl | 12 +-- view/theme/frio/templates/admin/summary.tpl | 6 +- view/theme/frio/templates/admin/users.tpl | 24 +++--- view/theme/frio/templates/comment_item.tpl | 14 ++-- view/theme/frio/templates/common_tabs.tpl | 6 +- view/theme/frio/templates/contact_edit.tpl | 76 ++++++++--------- .../theme/frio/templates/contact_template.tpl | 40 ++++----- view/theme/frio/templates/credits.tpl | 4 +- view/theme/frio/templates/crepair.tpl | 2 +- view/theme/frio/templates/event.tpl | 10 +-- .../frio/templates/event_stream_item.tpl | 8 +- view/theme/frio/templates/events_js.tpl | 8 +- view/theme/frio/templates/filebrowser.tpl | 10 +-- view/theme/frio/templates/intros.tpl | 4 +- view/theme/frio/templates/jot.tpl | 2 +- view/theme/frio/templates/like_noshare.tpl | 2 +- view/theme/frio/templates/mail_conv.tpl | 4 +- view/theme/frio/templates/mail_list.tpl | 2 +- view/theme/frio/templates/nav.tpl | 84 +++++++++---------- view/theme/frio/templates/photo_item.tpl | 2 +- view/theme/frio/templates/photo_top.tpl | 2 +- view/theme/frio/templates/photo_view.tpl | 4 +- view/theme/frio/templates/profile_entry.tpl | 2 +- view/theme/frio/templates/profile_vcard.tpl | 46 +++++----- view/theme/frio/templates/search_item.tpl | 64 +++++++------- view/theme/frio/templates/vcard-widget.tpl | 10 +-- view/theme/frio/templates/wall_thread.tpl | 76 ++++++++--------- .../quattro/templates/contact_template.tpl | 8 +- view/theme/quattro/templates/events.tpl | 6 +- view/theme/quattro/templates/mail_conv.tpl | 18 ++-- .../theme/quattro/templates/profile_vcard.tpl | 8 +- view/theme/quattro/templates/search_item.tpl | 34 ++++---- .../theme/quattro/templates/wall_item_tag.tpl | 8 +- view/theme/quattro/templates/wall_thread.tpl | 10 +-- .../quattro/templates/widget_forumlist.tpl | 4 +- view/theme/vier/templates/ch_connectors.tpl | 2 +- .../vier/templates/ch_directory_item.tpl | 2 +- view/theme/vier/templates/comment_item.tpl | 16 ++-- .../theme/vier/templates/contact_template.tpl | 6 +- view/theme/vier/templates/nav.tpl | 48 +++++------ view/theme/vier/templates/photo_item.tpl | 30 +++---- view/theme/vier/templates/photo_view.tpl | 4 +- view/theme/vier/templates/profile_vcard.tpl | 6 +- view/theme/vier/templates/search_item.tpl | 36 ++++---- view/theme/vier/templates/wall_item_tag.tpl | 8 +- view/theme/vier/templates/wall_thread.tpl | 60 ++++++------- .../vier/templates/widget_forumlist_right.tpl | 12 +-- 60 files changed, 472 insertions(+), 476 deletions(-) diff --git a/src/Module/Contact.php b/src/Module/Contact.php index ec7e896925..66e8c97fdf 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -85,7 +85,7 @@ class Contact extends BaseModule /// @TODO Add nice spaces $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [ - '$name' => htmlentities($contact['name']), + '$name' => $contact['name'], '$photo' => $contact['photo'], '$url' => Model\Contact::MagicLink($contact['url']), '$addr' => defaults($contact, 'addr', ''), @@ -639,7 +639,7 @@ class Contact extends BaseModule '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'], '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')], '$photo' => $contact['photo'], - '$name' => htmlentities($contact['name']), + '$name' => $contact['name'], '$dir_icon' => $dir_icon, '$sparkle' => $sparkle, '$url' => $url, @@ -1033,14 +1033,14 @@ class Contact extends BaseModule 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, 'thumb' => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB), - 'name' => htmlentities($rr['name']), - 'username' => htmlentities($rr['name']), + 'name' => $rr['name'], + 'username' => $rr['name'], 'account_type' => Model\Contact::getAccountType($rr), 'sparkle' => $sparkle, 'itemurl' => defaults($rr, 'addr', $rr['url']), 'url' => $url, 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), - 'nick' => htmlentities($rr['nick']), + 'nick' => $rr['nick'], ]; } diff --git a/src/Object/Post.php b/src/Object/Post.php index e7a9e6b020..50d903f025 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -213,7 +213,7 @@ class Post extends BaseObject $filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? L10n::t("save to folder") : false); - $profile_name = htmlentities($item['author-name']); + $profile_name = $item['author-name']; if (!empty($item['author-link']) && empty($item['author-name'])) { $profile_name = $item['author-link']; } @@ -377,7 +377,7 @@ class Post extends BaseObject 'isevent' => $isevent, 'attend' => $attend, 'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']), - 'olinktitle' => L10n::t('View %s\'s profile @ %s', htmlentities($this->getOwnerName()), $item['owner-link']), + 'olinktitle' => L10n::t('View %s\'s profile @ %s', $this->getOwnerName(), $item['owner-link']), 'to' => L10n::t('to'), 'via' => L10n::t('via'), 'wall' => L10n::t('Wall-to-Wall'), @@ -399,7 +399,7 @@ class Post extends BaseObject 'shiny' => $shiny, 'owner_url' => $this->getOwnerUrl(), 'owner_photo' => $a->removeBaseURL(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)), - 'owner_name' => htmlentities($owner_name_e), + 'owner_name' => $owner_name_e, 'plink' => Item::getPlink($item), 'edpost' => $edpost, 'isstarred' => $isstarred, diff --git a/view/templates/admin/addon_details.tpl b/view/templates/admin/addon_details.tpl index fb908b7058..96b26d2d09 100644 --- a/view/templates/admin/addon_details.tpl +++ b/view/templates/admin/addon_details.tpl @@ -18,7 +18,7 @@

{{if $screenshot}} - {{$screenshot.1}} + {{$screenshot.1|escape}} {{/if}} {{if $admin_form}} diff --git a/view/templates/admin/contactblock.tpl b/view/templates/admin/contactblock.tpl index 152550f017..c9bfc2efd0 100644 --- a/view/templates/admin/contactblock.tpl +++ b/view/templates/admin/contactblock.tpl @@ -32,10 +32,10 @@ {{foreach $contacts as $contact}} - {{$contact.nickname}} + {{$contact.nickname|escape}} {{$contact.name}} {{$contact.addr}} - {{$contact.url}} + {{$contact.url}} {{/foreach}} diff --git a/view/templates/admin/users.tpl b/view/templates/admin/users.tpl index b2b0d615a4..f06b0f9734 100644 --- a/view/templates/admin/users.tpl +++ b/view/templates/admin/users.tpl @@ -35,8 +35,8 @@ {{$u.email}} - - + + @@ -79,8 +79,8 @@ {{foreach $users as $u}} - {{$u.nickname}} - {{$u.name}} + {{$u.nickname|escape}} + {{$u.name}} {{$u.email}} {{$u.register_date}} {{$u.login_date}} @@ -94,8 +94,8 @@ {{/if}} {{if $u.is_deletable}} - - + + {{else}}   {{/if}} @@ -122,8 +122,8 @@ {{foreach $deleted as $u}} - {{$u.nickname}} - {{$u.name}} + {{$u.nickname|escape}} + {{$u.name}} {{$u.email}} {{$u.register_date}} {{$u.login_date}} diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index 7bf37e74b3..74f2700052 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -3,12 +3,12 @@
- {{$profile.name}} + {{$profile.name|escape}}
-

{{$profile.name}}

{{if $profile.account_type}}{{$profile.account_type}}{{/if}} +

{{$profile.name|escape}}

{{if $profile.account_type}}{{$profile.account_type}}{{/if}}
{{$profile.addr}} @@ -21,13 +21,13 @@ {{* here are the differnt actions like privat message, poke, delete and so on *}} {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
- {{if $profile.actions.pm}}{{/if}} - {{if $profile.actions.poke}}{{/if}} + {{if $profile.actions.pm}}{{/if}} + {{if $profile.actions.poke}}{{/if}}
- {{if $profile.actions.network}}{{/if}} - {{if $profile.actions.edit}}{{/if}} - {{if $profile.actions.follow}}{{/if}} + {{if $profile.actions.network}}{{/if}} + {{if $profile.actions.edit}}{{/if}} + {{if $profile.actions.follow}}{{/if}}
diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index b56dd607ce..6f8e86b299 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -1,16 +1,16 @@
-
{{$profile.name}}
+
{{$profile.name|escape}}
{{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}} {{if $profile.picdate}} -
{{$profile.name}}
+
{{$profile.name|escape}}
{{else}} -
{{$profile.name}}
+
{{$profile.name|escape}}
{{/if}} {{if $account_type}}{{/if}} {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} diff --git a/view/templates/vcard-widget.tpl b/view/templates/vcard-widget.tpl index 47b64b68da..eed94193f5 100644 --- a/view/templates/vcard-widget.tpl +++ b/view/templates/vcard-widget.tpl @@ -1,14 +1,14 @@
-
{{$name}}
- {{if $addr}}
{{$addr}}
{{/if}} +
{{$name|escape}}
+ {{if $addr}}
{{$addr|escape}}
{{/if}} {{if $pdesc}}
{{$pdesc}}
{{/if}} {{if $url}} -
{{$name}}
+
{{$name|escape}}
{{else}} -
{{$name}}
+
{{$name|escape}}
{{/if}} - {{if $account_type}}{{/if}} + {{if $account_type}}{{/if}} {{if $network_name}}
{{$network}}
{{$network_name}}
{{/if}}
diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index a82efa7d1c..63a8364f88 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -19,15 +19,15 @@ {{if $item.owner_url}}
- {{$item.owner_name}} + {{$item.owner_name|escape}}
-
{{$item.wall}}
+
{{$item.wall|escape}}
{{/if}}
- {{$item.name}} + {{$item.name|escape}} menu
    @@ -38,7 +38,7 @@
- {{if $item.lock}}
{{$item.lock}}
+ {{if $item.lock}}
{{$item.lock|escape}}
{{else}}
{{/if}}
{{$item.location}}
diff --git a/view/templates/widget_forumlist.tpl b/view/templates/widget_forumlist.tpl index 32da71f816..da30967cd6 100644 --- a/view/templates/widget_forumlist.tpl +++ b/view/templates/widget_forumlist.tpl @@ -21,8 +21,8 @@ function showHideForumlist() { {{if $forum.id <= $visible_forums}} @@ -31,8 +31,8 @@ function showHideForumlist() { {{if $forum.id > $visible_forums}} diff --git a/view/theme/duepuntozero/templates/profile_vcard.tpl b/view/theme/duepuntozero/templates/profile_vcard.tpl index 186b7e4490..505cf560e3 100644 --- a/view/theme/duepuntozero/templates/profile_vcard.tpl +++ b/view/theme/duepuntozero/templates/profile_vcard.tpl @@ -1,12 +1,12 @@
-
{{$profile.name}}
+
{{$profile.name|escape}}
{{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}} -
{{$profile.name}}
+
{{$profile.name|escape}}
{{if $account_type}}{{/if}} diff --git a/view/theme/frio/templates/admin/addons.tpl b/view/theme/frio/templates/admin/addons.tpl index 220abdc2c4..38efb62bd4 100644 --- a/view/theme/frio/templates/admin/addons.tpl +++ b/view/theme/frio/templates/admin/addons.tpl @@ -12,7 +12,7 @@
  • - {{$p.2.name}} - {{$p.2.version}} + {{$p.2.name|escape}} - {{$p.2.version}} {{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
    {{$p.2.description}}
  • diff --git a/view/theme/frio/templates/admin/contactblock.tpl b/view/theme/frio/templates/admin/contactblock.tpl index 3173c238b6..3ac9a25173 100644 --- a/view/theme/frio/templates/admin/contactblock.tpl +++ b/view/theme/frio/templates/admin/contactblock.tpl @@ -67,9 +67,9 @@
    - {{$contact.nickname}} - {{$contact.name}} - {{$contact.url}} + {{$contact.nickname|escape}} + {{$contact.name|escape}} + {{$contact.url|escape}} {{/foreach}} @@ -78,7 +78,7 @@ {{* Checkbox to select all blocked contacts *}}
    - +
    diff --git a/view/theme/frio/templates/admin/queue.tpl b/view/theme/frio/templates/admin/queue.tpl index dde3863999..3ebe89052e 100644 --- a/view/theme/frio/templates/admin/queue.tpl +++ b/view/theme/frio/templates/admin/queue.tpl @@ -13,12 +13,12 @@ {{foreach $entries as $e}} - {{$e.id}} - {{$e.name}} - {{$e.nurl}} - {{$e.network}} - {{$e.created}} - {{$e.last}} + {{$e.id|escape}} + {{$e.name|escape}} + {{$e.nurl|escape}} + {{$e.network|escape}} + {{$e.created|escape}} + {{$e.last|escape}} {{/foreach}} diff --git a/view/theme/frio/templates/admin/summary.tpl b/view/theme/frio/templates/admin/summary.tpl index 66afda721b..c2bbf49a70 100644 --- a/view/theme/frio/templates/admin/summary.tpl +++ b/view/theme/frio/templates/admin/summary.tpl @@ -54,14 +54,14 @@ {{* The Friendica version. *}}

    -
    {{$version.0}}
    -
    {{$platform}} '{{$codename}}' {{$version.1}} - {{$build}}
    +
    {{$version.0|escape}}
    +
    {{$platform}} '{{$codename|escape}}' {{$version.1|escape}} - {{$build|escape}}
    {{* Server Settings. *}}

    -
    {{$serversettings.label}}
    +
    {{$serversettings.label|escape}}
    diff --git a/view/theme/frio/templates/admin/users.tpl b/view/theme/frio/templates/admin/users.tpl index 92ef9be6fa..031ffd0a47 100644 --- a/view/theme/frio/templates/admin/users.tpl +++ b/view/theme/frio/templates/admin/users.tpl @@ -46,11 +46,11 @@ - + {{if $u.note}} @@ -145,8 +145,8 @@   {{/if}} - - + + {{if $order_users == $th_users.2.1}} @@ -169,18 +169,18 @@ {{if $u.page_flags_raw==3}}fa-heart{{/if}} {{* PAGE_FREELOVE *}} {{if $u.page_flags_raw==4}}fa-rss{{/if}} {{* PAGE_BLOG *}} {{if $u.page_flags_raw==5}}fa-user-secret{{/if}} {{* PAGE_PRVGROUP *}} - " title="{{$u.page_flags}}"> + " title="{{$u.page_flags|escape}}"> {{if $u.page_flags_raw==0 && $u.account_type_raw > 0}} {{/if}} - {{if $u.is_admin}}{{/if}} - {{if $u.account_expired}}{{/if}} + {{if $u.is_admin}}{{/if}} + {{if $u.account_expired}}{{/if}} {{/if}} @@ -229,7 +229,7 @@ {{/if}} - + {{else}} @@ -297,8 +297,8 @@ {{foreach $deleted as $u}} - - + + diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index 4ef5f2caa1..804d07ac01 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -33,37 +33,37 @@ {{/if}}
    {{$u.created}}{{$u.name}}{{$u.name|escape}} {{$u.email}} - - + +
    {{$u.name}} {{$u.name|escape}} {{$u.email}}{{$u.register_date}}
    {{$u.name}}{{$u.name|escape}} {{$u.email}} {{$u.deleted}}