From 1ce5b1d65b26aade0077b7825b76f6dca0070813 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 11 Feb 2020 21:38:42 -0500 Subject: [PATCH] Remove profile about field double HTML escaping - Add BBcode conversion for profile.about in widget/vcard.tpl --- mod/cal.php | 5 +++-- mod/common.php | 2 +- mod/photos.php | 4 ++-- mod/videos.php | 5 +++-- view/templates/profile/vcard.tpl | 2 +- view/templates/widget/vcard.tpl | 2 +- view/theme/duepuntozero/templates/profile/vcard.tpl | 2 +- view/theme/frio/templates/profile/vcard.tpl | 2 +- view/theme/frio/templates/widget/vcard.tpl | 2 +- view/theme/quattro/templates/profile/vcard.tpl | 2 +- view/theme/vier/templates/profile/vcard.tpl | 2 +- 11 files changed, 16 insertions(+), 14 deletions(-) diff --git a/mod/cal.php b/mod/cal.php index 835291778..5903ea63f 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -10,6 +10,7 @@ use Friendica\App; use Friendica\Content\Feature; use Friendica\Content\Nav; +use Friendica\Content\Text\BBCode; use Friendica\Content\Widget; use Friendica\Core\Renderer; use Friendica\Core\Session; @@ -54,14 +55,14 @@ function cal_init(App $a) $account_type = Contact::getAccountType($profile); - $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); + $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl'); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?: '', '$account_type' => $account_type, - '$about' => $profile['about'] ?: '', + '$about' => BBCode::convert($profile['about'] ?: ''), ]); $cal_widget = Widget\CalendarExport::getHTML(); diff --git a/mod/common.php b/mod/common.php index 7e1dcc185..8ab8434cf 100644 --- a/mod/common.php +++ b/mod/common.php @@ -47,7 +47,7 @@ function common_content(App $a) $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]); if (DBA::isResult($contact)) { - $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("widget/vcard.tpl"), [ + $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ '$name' => $contact['name'], '$photo' => $contact['photo'], 'url' => 'contact/' . $cid diff --git a/mod/photos.php b/mod/photos.php index 13fa855c9..724859733 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -58,14 +58,14 @@ function photos_init(App $a) { $account_type = Contact::getAccountType($profile); - $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); + $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl'); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?? '', '$account_type' => $account_type, - '$about' => $profile['about'] ?? '', + '$about' => BBCode::convert($profile['about'] ?? ''), ]); $albums = Photo::getAlbums($a->data['user']['uid']); diff --git a/mod/videos.php b/mod/videos.php index b8119a686..7cc544c1c 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Content\Nav; use Friendica\Content\Pager; +use Friendica\Content\Text\BBCode; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Database\DBA; @@ -43,14 +44,14 @@ function videos_init(App $a) $account_type = Contact::getAccountType($profile); - $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); + $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl'); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?? '', '$account_type' => $account_type, - '$about' => $profile['about'] ?? '', + '$about' => BBCode::convert($profile['about'] ?? ''), ]); // If not there, create 'aside' empty diff --git a/view/templates/profile/vcard.tpl b/view/templates/profile/vcard.tpl index b8fc807fa..2b11bc4a3 100644 --- a/view/templates/profile/vcard.tpl +++ b/view/templates/profile/vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $profile.about}}
{{$profile.about}}
{{/if}} + {{if $profile.about}}
{{$profile.about nofilter}}
{{/if}} {{if $profile.picdate}}
{{$profile.name}}
diff --git a/view/templates/widget/vcard.tpl b/view/templates/widget/vcard.tpl index 135d90a61..1bd0690a2 100644 --- a/view/templates/widget/vcard.tpl +++ b/view/templates/widget/vcard.tpl @@ -2,7 +2,7 @@
{{$name}}
{{if $addr}}
{{$addr}}
{{/if}} - {{if $about}}
{{$about}}
{{/if}} + {{if $about}}
{{$about nofilter}}
{{/if}} {{if $url}}
{{$name}}
{{else}} diff --git a/view/theme/duepuntozero/templates/profile/vcard.tpl b/view/theme/duepuntozero/templates/profile/vcard.tpl index 02187d954..793b82386 100644 --- a/view/theme/duepuntozero/templates/profile/vcard.tpl +++ b/view/theme/duepuntozero/templates/profile/vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $profile.about}}
{{$profile.about}}
{{/if}} + {{if $profile.about}}
{{$profile.about nofilter}}
{{/if}}
{{$profile.name}}
{{if $account_type}}{{/if}} diff --git a/view/theme/frio/templates/profile/vcard.tpl b/view/theme/frio/templates/profile/vcard.tpl index 2765dbc39..4f7683dc0 100644 --- a/view/theme/frio/templates/profile/vcard.tpl +++ b/view/theme/frio/templates/profile/vcard.tpl @@ -41,7 +41,7 @@ {{if $profile.addr}}
{{include file="sub/punct_wrap.tpl" text=$profile.addr}}
{{/if}} - {{if $profile.about}}
{{$profile.about}}
{{/if}} + {{if $profile.about}}
{{$profile.about nofilter}}
{{/if}} {{if $account_type}}{{/if}}
diff --git a/view/theme/frio/templates/widget/vcard.tpl b/view/theme/frio/templates/widget/vcard.tpl index fa65de0dc..210edbe44 100644 --- a/view/theme/frio/templates/widget/vcard.tpl +++ b/view/theme/frio/templates/widget/vcard.tpl @@ -30,7 +30,7 @@ {{if $account_type}}
({{$account_type}})
{{/if}} - {{if $about}}
{{$about}}
{{/if}} + {{if $about}}
{{$about nofilter}}
{{/if}} {{if $network_link}}
{{$network}}
{{$network_link nofilter}}
{{/if}} diff --git a/view/theme/quattro/templates/profile/vcard.tpl b/view/theme/quattro/templates/profile/vcard.tpl index 6f9e5cffb..107e7850f 100644 --- a/view/theme/quattro/templates/profile/vcard.tpl +++ b/view/theme/quattro/templates/profile/vcard.tpl @@ -17,7 +17,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $about}}
{{$profile.about}}
{{/if}} + {{if $about}}
{{$profile.about nofilter}}
{{/if}}
{{$profile.name}}
{{if $account_type}}
{{$account_type}}
{{/if}} diff --git a/view/theme/vier/templates/profile/vcard.tpl b/view/theme/vier/templates/profile/vcard.tpl index 940bdd016..d6cf873b4 100644 --- a/view/theme/vier/templates/profile/vcard.tpl +++ b/view/theme/vier/templates/profile/vcard.tpl @@ -11,7 +11,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $profile.about}}
{{$profile.about}}
{{/if}} + {{if $profile.about}}
{{$profile.about nofilter}}
{{/if}} {{if $profile.picdate}}
{{$profile.name}}