diff --git a/include/conversation.php b/include/conversation.php index a995ea4ad1..6bf511a6bc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -546,8 +546,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); - - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); + $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: ''); localize_item($item); if ($mode === 'network-new') { @@ -616,7 +615,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'text' => strip_tags($body), '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'])), - 'location' => $location, + 'location_html' => $location_html, 'indent' => '', 'owner_name' => $owner_name, 'owner_url' => $owner_url, @@ -1497,13 +1496,3 @@ function sort_thr_commented(array $a, array $b) { return strcmp($b['commented'], $a['commented']); } - -function render_location_dummy(array $item) { - if (!empty($item['location']) && !empty($item['location'])) { - return $item['location']; - } - - if (!empty($item['coord']) && !empty($item['coord'])) { - return $item['coord']; - } -} diff --git a/src/Object/Post.php b/src/Object/Post.php index d9f0d44d67..f5e91c07c5 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -254,7 +254,7 @@ class Post $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; Hook::callAll('render_location', $locate); - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); + $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: ''); // process action responses - e.g. like/dislike/attend/agree/whatever $response_verbs = ['like', 'dislike', 'announce']; @@ -371,7 +371,6 @@ class Post $title_e = $item['title']; } - $location_e = $location; $owner_name_e = $this->getOwnerName(); if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { @@ -457,7 +456,7 @@ class Post 'app' => $item['app'], 'created' => $ago, 'lock' => $lock, - 'location' => $location_e, + 'location_html' => $location_html, 'indent' => $indent, 'shiny' => $shiny, 'owner_self' => $item['author-link'] == Session::get('my_url'), diff --git a/view/templates/search_item.tpl b/view/templates/search_item.tpl index 1a756db8a3..82db4884c6 100644 --- a/view/templates/search_item.tpl +++ b/view/templates/search_item.tpl @@ -19,7 +19,7 @@
{{if $item.lock}}
{{$item.lock}}
{{else}}
{{/if}} -
{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index bd8a1a2309..13b358b520 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -48,7 +48,7 @@
{{if $item.lock}}
{{$item.lock}}
{{else}}
{{/if}} -
{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index 2cd231f8fb..e48a12b50b 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -66,9 +66,9 @@ {{$item.ago}}
- {{if $item.location}} + {{if $item.location_html}}
- ({{$item.location nofilter}}) + ({{$item.location_html nofilter}})
{{/if}} @@ -81,7 +81,7 @@
{{$item.name}}

- {{$item.ago}} {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + {{$item.ago}} {{if $item.location_html}} — ({{$item.location_html nofilter}}){{/if}}

diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 81532f943c..2b285456a9 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -186,9 +186,9 @@ as the value of $top_child_total (this is done at the end of this file) - {{if $item.location}} + {{if $item.location_html}}
- ({{$item.location nofilter}}) + ({{$item.location_html nofilter}})
{{/if}} @@ -202,7 +202,7 @@ as the value of $top_child_total (this is done at the end of this file)

{{$item.ago}} - {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + {{if $item.location_html}} — ({{$item.location_html nofilter}}){{/if}} {{if $item.owner_self}} {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{/if}} @@ -221,7 +221,7 @@ as the value of $top_child_total (this is done at the end of this file) {{$item.ago}} - {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + {{if $item.location_html}} — ({{$item.location_html nofilter}}){{/if}} {{if $item.owner_self}} {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{/if}} diff --git a/view/theme/quattro/templates/search_item.tpl b/view/theme/quattro/templates/search_item.tpl index cb400ac4f5..be9a43604a 100644 --- a/view/theme/quattro/templates/search_item.tpl +++ b/view/theme/quattro/templates/search_item.tpl @@ -19,7 +19,7 @@ -

{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
{{if $item.title}}

{{$item.title}}

{{/if}} diff --git a/view/theme/quattro/templates/wall_item_tag.tpl b/view/theme/quattro/templates/wall_item_tag.tpl index cb4b890153..e957e719a6 100644 --- a/view/theme/quattro/templates/wall_item_tag.tpl +++ b/view/theme/quattro/templates/wall_item_tag.tpl @@ -34,7 +34,7 @@
-
{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
{{$item.ago}} {{$item.body nofilter}} diff --git a/view/theme/quattro/templates/wall_thread.tpl b/view/theme/quattro/templates/wall_thread.tpl index 21de7db2df..7c8a567835 100644 --- a/view/theme/quattro/templates/wall_thread.tpl +++ b/view/theme/quattro/templates/wall_thread.tpl @@ -50,7 +50,7 @@
{{/if}} -
{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
{{if $item.title}}

{{$item.title}}

{{/if}} diff --git a/view/theme/smoothly/templates/search_item.tpl b/view/theme/smoothly/templates/search_item.tpl index b3ae01eb4e..284264f29b 100644 --- a/view/theme/smoothly/templates/search_item.tpl +++ b/view/theme/smoothly/templates/search_item.tpl @@ -15,7 +15,7 @@
-
{{if $item.location}}{{$item.location nofilter}} {{/if}}
+
{{if $item.location_html}}{{$item.location_html nofilter}} {{/if}}
{{if $item.lock}}
{{$item.lock}}
diff --git a/view/theme/smoothly/templates/wall_thread.tpl b/view/theme/smoothly/templates/wall_thread.tpl index 4ff34aed11..99d7020539 100644 --- a/view/theme/smoothly/templates/wall_thread.tpl +++ b/view/theme/smoothly/templates/wall_thread.tpl @@ -37,7 +37,7 @@
-
{{if $item.location}}{{$item.location nofilter}} {{/if}}
+
{{if $item.location_html}}{{$item.location_html nofilter}} {{/if}}
{{if $item.lock}} diff --git a/view/theme/vier/templates/search_item.tpl b/view/theme/vier/templates/search_item.tpl index 1da18b0867..1ab47844cc 100644 --- a/view/theme/vier/templates/search_item.tpl +++ b/view/theme/vier/templates/search_item.tpl @@ -51,7 +51,7 @@
-
{{$item.location nofilter}} 
+
{{$item.location_html nofilter}} 
{{if $item.star}} diff --git a/view/theme/vier/templates/wall_item_tag.tpl b/view/theme/vier/templates/wall_item_tag.tpl index 49fb26a83c..eedc51bf17 100644 --- a/view/theme/vier/templates/wall_item_tag.tpl +++ b/view/theme/vier/templates/wall_item_tag.tpl @@ -34,7 +34,7 @@
-
{{$item.location nofilter}}
+
{{$item.location_html nofilter}}
{{$item.ago}} {{$item.body nofilter}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index e52aab1814..60f0c796cb 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -150,7 +150,7 @@ {{/if}}
-
{{$item.location nofilter}} {{$item.postopts}}
+
{{$item.location_html nofilter}} {{$item.postopts}}