From fe77acc96471d579c85a861a9c8b4163ff381d70 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 13 Oct 2019 08:00:13 -0400 Subject: [PATCH 1/4] [frio] Fix nav bar search form text input name --- view/theme/frio/templates/nav.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index 4698fb657..bbbaaedc9 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -109,7 +109,7 @@ From c5f4f730e1961a249701624a9d83733c306142fe Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 13 Oct 2019 08:37:25 -0400 Subject: [PATCH 2/4] Use init() rather than rawContent() in Module\Search\Saved since there's no output --- src/Module/Search/Saved.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index 772f4782c..9a02c8a4e 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -10,7 +10,7 @@ use Friendica\Util\Strings; class Saved extends BaseModule { - public static function rawContent() + public static function init() { /** @var Arguments $args */ $args = self::getClass(Arguments::class); From 74bf3a4dc8cbcc46d9502ecc06246a5feb7d5971 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 13 Oct 2019 08:39:41 -0400 Subject: [PATCH 3/4] Replace path parameter with query string parameter in Module\Search\Saved --- src/Module/Search/Saved.php | 4 ++-- static/routes.config.php | 4 ++-- view/templates/searchbox.tpl | 2 +- view/templates/widget/saved_searches.tpl | 2 +- view/theme/frio/css/style.css | 2 +- view/theme/frio/js/theme.js | 2 +- view/theme/frio/templates/searchbox.tpl | 15 ++++++--------- .../frio/templates/widget/saved_searches.tpl | 2 +- .../quattro/templates/widget/saved_searches.tpl | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index 9a02c8a4e..9d8d84b55 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -16,11 +16,11 @@ class Saved extends BaseModule $args = self::getClass(Arguments::class); $action = $args->get(2, 'none'); - $search = Strings::escapeTags(trim(rawurldecode($args->get(3, '')))); + $search = Strings::escapeTags(trim(rawurldecode($_GET['term'] ?? ''))); $return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search); - if (local_user()) { + if (local_user() && $search) { switch ($action) { case 'add': $fields = ['uid' => local_user(), 'term' => $search]; diff --git a/static/routes.config.php b/static/routes.config.php index 841fd68f9..c52b5d802 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -191,8 +191,8 @@ return [ '/search' => [ '[/]' => [Module\Search\Index::class, [R::GET]], '/acl' => [Module\Search\Acl::class, [R::GET, R::POST]], - '/saved/add/{term}' => [Module\Search\Saved::class, [R::GET]], - '/saved/remove/{term}' => [Module\Search\Saved::class, [R::GET]], + '/saved/add' => [Module\Search\Saved::class, [R::GET]], + '/saved/remove' => [Module\Search\Saved::class, [R::GET]], ], '/settings' => [ diff --git a/view/templates/searchbox.tpl b/view/templates/searchbox.tpl index d566befba..8317c59b1 100644 --- a/view/templates/searchbox.tpl +++ b/view/templates/searchbox.tpl @@ -11,7 +11,7 @@ {{/if}} {{if $s}} - {{$save_label}} + {{$save_label}} {{/if}} {{/strip}} diff --git a/view/templates/widget/saved_searches.tpl b/view/templates/widget/saved_searches.tpl index 858e921f7..4e3a80b76 100644 --- a/view/templates/widget/saved_searches.tpl +++ b/view/templates/widget/saved_searches.tpl @@ -6,7 +6,7 @@