From: Hypolite Petovan Date: Sun, 13 Oct 2019 12:39:41 +0000 (-0400) Subject: Replace path parameter with query string parameter in Module\Search\Saved X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=74bf3a4dc8cbcc46d9502ecc06246a5feb7d5971;p=friendica.git Replace path parameter with query string parameter in Module\Search\Saved --- diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index 9a02c8a4e4..9d8d84b55a 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 841fd68f99..c52b5d8026 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 d566befba0..8317c59b1d 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 858e921f78..4e3a80b765 100644 --- a/view/templates/widget/saved_searches.tpl +++ b/view/templates/widget/saved_searches.tpl @@ -6,7 +6,7 @@