$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];
'/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' => [
{{/if}}
<input type="submit" name="submit" id="search-submit" value="{{$search_label}}"/>
{{if $s}}
- <a href="search/saved/add/{{$q}}?return_url={{$return_url}}">{{$save_label}}</a>
+ <a href="search/saved/add?term={{$q}}&return_url={{$return_url}}">{{$save_label}}</a>
{{/if}}
{{/strip}}
</form>
<ul role="menu" id="saved-search-ul">
{{foreach $saved as $search}}
<li role="menuitem" class="saved-search-li clear">
- <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
+ <a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
</li>
{{/foreach}}
.search-content-wrapper > .section-title-wrapper {
display: none;
}
-#navbar-button > #search-save-form > #search-save {
+#navbar-button > #search-save {
margin-top: 3px;
}
/* Section-Content-Wrapper */
}
// move the "Save the search" button to the second navbar
- $(".search-content-wrapper #search-save-form ").appendTo("#topbar-second > .container > #navbar-button");
+ $(".search-content-wrapper #search-save").appendTo("#topbar-second > .container > #navbar-button");
// append the vcard-short-info to the second nav after passing the element
// with .fn (vcard username). Use scrollspy to get the scroll position.
<div class="col-md-8">
{{* The button to save searches *}}
{{if $s}}
- <a href="search/saved/add/{{$q}}?return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
+ <a href="search/saved/add?term={{$q}}&return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
{{/if}}
{{* The select popup menu to select what kind of results the user would like to search for *}}
</div>
{{if $s}}
- <form id="search-save-form" action="search/saved/add/{{$q}}" method="get">
- <input type="hidden" name="return_url" value="{{$return_url}}">
- <button class="btn btn-sm btn-main pull-right" type="submit" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
+ <a href="search/saved/add?term={{$q}}&return_url={{$return_url}}" class="btn btn-sm btn-main pull-right" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
{{if $mode == "tag"}}
- <i class="fa fa-plus fa-2x" aria-hidden="true"></i>
+ <i class="fa fa-plus fa-2x" aria-hidden="true"></i>
{{else}}
- <i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
+ <i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
{{/if}}
- <span class="sr-only">{{$save_label}}</span>
- </button>
- </form>
+ <span class="sr-only">{{$save_label}}</span>
+ </a>
{{/if}}
</div>
<ul role="menu" id="saved-search-ul">
{{foreach $saved as $search}}
<li role="menuitem" class="saved-search-li clear">
- <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
+ <a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
<i class="fa fa-trash" aria-hidden="true"></i>
</a>
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
{{foreach $saved as $search}}
<li class="tool {{if $search.selected}}selected{{/if}}">
<a href="search?q={{$search.encodedterm}}" class="label">{{$search.term}}</a>
- <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
+ <a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
</li>
{{/foreach}}
</ul>