From 703ad99464751a2e9452c028b19624e978a6ef04 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 31 Jan 2020 19:39:15 -0500 Subject: [PATCH 1/3] Add Util\Network::appendQueryParam method --- src/Util/Network.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Util/Network.php b/src/Util/Network.php index e2cfc3e84..17ddd048a 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -870,4 +870,27 @@ class Network return $url; } + + /** + * Adds query string parameters to the provided URI. Replace the value of existing keys. + * + * @param string $path + * @param array $additionalParams Associative array of parameters + * @return string + */ + public static function appendQueryParam(string $path, array $additionalParams) + { + $parsed = parse_url($path); + + $params = []; + if (!empty($parsed['query'])) { + parse_str($parsed['query'], $params); + } + + $params = array_merge($params, $additionalParams); + + $parsed['query'] = http_build_query($params); + + return self::unparseURL($parsed); + } } From 42990ac0f4371d1c9b27be0ae2b81c4a077d076f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 31 Jan 2020 19:41:20 -0500 Subject: [PATCH 2/3] Append version parameter to script and stylesheets paths in App\Page --- src/App/Page.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/App/Page.php b/src/App/Page.php index 8dd876346..4b1929a99 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -15,6 +15,7 @@ use Friendica\Core\Renderer; use Friendica\Core\Theme; use Friendica\Module\Special\HTTPException as ModuleHTTPException; use Friendica\Network\HTTPException; +use Friendica\Util\Network; use Friendica\Util\Strings; /** @@ -151,6 +152,8 @@ class Page implements ArrayAccess */ public function registerStylesheet($path) { + $path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]); + if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) { $path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR)); } @@ -334,6 +337,8 @@ class Page implements ArrayAccess */ public function registerFooterScript($path) { + $path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]); + $url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path); $this->footerScripts[] = trim($url, '/'); From 71cefc7c9e997bbb7c6d01cb930649a3968ea688 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 31 Jan 2020 19:42:02 -0500 Subject: [PATCH 3/3] Add version parameter to scripts and stylesheet paths in view/ --- view/templates/admin/federation.tpl | 2 +- view/templates/event_head.tpl | 8 +- view/templates/filebrowser.tpl | 4 +- view/templates/head.tpl | 38 ++++---- view/templates/jot-header.tpl | 2 +- view/templates/msg-header.tpl | 2 +- .../templates/settings/profile/index_head.tpl | 2 +- .../settings/profile/photo/crop_head.tpl | 4 +- .../duepuntozero/templates/theme_settings.tpl | 2 +- .../templates/admin/blocklist/contact.tpl | 4 +- view/theme/frio/templates/admin/site.tpl | 2 +- view/theme/frio/templates/admin/users.tpl | 4 +- view/theme/frio/templates/contacts-head.tpl | 2 +- view/theme/frio/templates/event_form.tpl | 2 +- view/theme/frio/templates/event_head.tpl | 12 +-- view/theme/frio/templates/group_edit.tpl | 2 +- view/theme/frio/templates/head.tpl | 92 +++++++++---------- view/theme/frio/templates/jot-header.tpl | 6 +- .../templates/notifications/notifications.tpl | 4 +- view/theme/frio/templates/photos_head.tpl | 2 +- view/theme/frio/templates/theme_settings.tpl | 4 +- .../frio/templates/threaded_conversation.tpl | 4 +- .../quattro/templates/events_reminder.tpl | 8 +- .../quattro/templates/theme_settings.tpl | 2 +- view/theme/smoothly/templates/bottom.tpl | 2 +- view/theme/smoothly/templates/jot-header.tpl | 2 +- view/theme/vier/templates/event_head.tpl | 8 +- 27 files changed, 113 insertions(+), 113 deletions(-) diff --git a/view/templates/admin/federation.tpl b/view/templates/admin/federation.tpl index 9850a3741..177d5406f 100644 --- a/view/templates/admin/federation.tpl +++ b/view/templates/admin/federation.tpl @@ -1,4 +1,4 @@ - +

{{$title}} - {{$page}}

diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index baa031f04..463ba720e 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -1,8 +1,8 @@ - - - - + + + + - + + - - - - - - - - - - - - + + + + + + + + + + + + + - + - + \ No newline at end of file + \ No newline at end of file diff --git a/view/templates/settings/profile/photo/crop_head.tpl b/view/templates/settings/profile/photo/crop_head.tpl index 3fd15796e..357cc1861 100644 --- a/view/templates/settings/profile/photo/crop_head.tpl +++ b/view/templates/settings/profile/photo/crop_head.tpl @@ -1,2 +1,2 @@ - - + + diff --git a/view/theme/duepuntozero/templates/theme_settings.tpl b/view/theme/duepuntozero/templates/theme_settings.tpl index a5f406f7a..f7052e77f 100644 --- a/view/theme/duepuntozero/templates/theme_settings.tpl +++ b/view/theme/duepuntozero/templates/theme_settings.tpl @@ -1,4 +1,4 @@ - + {{include file="field_select.tpl" field=$colorset}} diff --git a/view/theme/frio/templates/admin/blocklist/contact.tpl b/view/theme/frio/templates/admin/blocklist/contact.tpl index 59f02dba5..d8b209640 100644 --- a/view/theme/frio/templates/admin/blocklist/contact.tpl +++ b/view/theme/frio/templates/admin/blocklist/contact.tpl @@ -1,5 +1,5 @@ - - + +

{{$title}} - {{$page}}

diff --git a/view/theme/frio/templates/admin/site.tpl b/view/theme/frio/templates/admin/site.tpl index 12ea0b83a..e13b2960e 100644 --- a/view/theme/frio/templates/admin/site.tpl +++ b/view/theme/frio/templates/admin/site.tpl @@ -18,7 +18,7 @@ }); }); - +

{{$title}} - {{$page}}

diff --git a/view/theme/frio/templates/admin/users.tpl b/view/theme/frio/templates/admin/users.tpl index fb2a49f67..256d5cdae 100644 --- a/view/theme/frio/templates/admin/users.tpl +++ b/view/theme/frio/templates/admin/users.tpl @@ -1,5 +1,5 @@ - - + +

{{$title}} - {{$page}}

diff --git a/view/theme/frio/templates/contacts-head.tpl b/view/theme/frio/templates/contacts-head.tpl index d51d76b44..ebdf2a29a 100644 --- a/view/theme/frio/templates/contacts-head.tpl +++ b/view/theme/frio/templates/contacts-head.tpl @@ -1,2 +1,2 @@ - + diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index c48d5c7fc..1d4f26a6b 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,5 +1,5 @@ - +

{{$title}}

diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index 43c7be944..cb1a4685b 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -1,10 +1,10 @@ - - - - - - + + + + + + +
{{if $editable == 1}} diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index eea3e738a..b539a90d9 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -7,31 +7,31 @@ {{* All needed css files - Note: css must be inserted before js files *}} - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + {{foreach $stylesheets as $stylesheetUrl}} {{/foreach}} {{* own css files *}} - - + + @@ -51,40 +51,40 @@ {{* The js files we use *}} - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + {{* own js files *}} - - + + {{if ! $block_public}} - + {{/if}} - + {{* Include the strings which are needed for some js functions (e.g. translation) They are loaded into the html so that js functions can use them *}} diff --git a/view/theme/frio/templates/jot-header.tpl b/view/theme/frio/templates/jot-header.tpl index 67b136ae1..f9e10ca8c 100644 --- a/view/theme/frio/templates/jot-header.tpl +++ b/view/theme/frio/templates/jot-header.tpl @@ -1,7 +1,7 @@ - - - + + + - + +
{{include file="section_title.tpl" title=$header}} diff --git a/view/theme/frio/templates/photos_head.tpl b/view/theme/frio/templates/photos_head.tpl index 965245aea..8399b413c 100644 --- a/view/theme/frio/templates/photos_head.tpl +++ b/view/theme/frio/templates/photos_head.tpl @@ -1,5 +1,5 @@ - + diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 9c32558b8..c3456a484 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -1,5 +1,5 @@ - - + + {{include file="field_select.tpl" field=$scheme}} diff --git a/view/theme/frio/templates/threaded_conversation.tpl b/view/theme/frio/templates/threaded_conversation.tpl index f8e222290..b1039d947 100644 --- a/view/theme/frio/templates/threaded_conversation.tpl +++ b/view/theme/frio/templates/threaded_conversation.tpl @@ -1,5 +1,5 @@ - -{{if $mode == display}}{{/if}} + +{{if $mode == display}}{{/if}} {{$live_update nofilter}} diff --git a/view/theme/quattro/templates/events_reminder.tpl b/view/theme/quattro/templates/events_reminder.tpl index 49846cbfa..d0bc1f481 100644 --- a/view/theme/quattro/templates/events_reminder.tpl +++ b/view/theme/quattro/templates/events_reminder.tpl @@ -1,8 +1,8 @@ - - - - + + + + + {{include file="field_select.tpl" field=$color}} diff --git a/view/theme/smoothly/templates/bottom.tpl b/view/theme/smoothly/templates/bottom.tpl index a5c13e0bf..d68320716 100644 --- a/view/theme/smoothly/templates/bottom.tpl +++ b/view/theme/smoothly/templates/bottom.tpl @@ -1,5 +1,5 @@ - + - - + + + +