diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index 1884749..3d4ac71 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -517,7 +517,7 @@ class TorrentController extends AbstractController } return $this->render('default/torrent/list.html.twig', [ - 'torrents' => $torrents, + 'torrents' => $torrents, 'pagination' => [ 'page' => $page, @@ -552,9 +552,13 @@ class TorrentController extends AbstractController $activityService ); + // Init request + $query = $request->get('query') ? explode(' ', urldecode($request->get('query'))) : []; + $page = $request->get('page') ? (int) $request->get('page') : 1; + // Get total torrents $total = $torrentService->findTorrentsTotal( - [], + $query, $user->getLocales(), !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() ? true : null // show approved content only for regular users @@ -563,12 +567,12 @@ class TorrentController extends AbstractController // Create torrents list $torrents = []; foreach ($torrentService->findTorrents( - [], + $query, $user->getLocales(), !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() ? true : null, // show approved content only for regular users $this->getParameter('app.pagination'), - 0 + ($page - 1) * $this->getParameter('app.pagination') ) as $torrent) { // Read file diff --git a/templates/default/torrent/list.html.twig b/templates/default/torrent/list.html.twig index 613b959..4d8c6ea 100644 --- a/templates/default/torrent/list.html.twig +++ b/templates/default/torrent/list.html.twig @@ -2,14 +2,25 @@ {% block title %}{% if query %}{{ query }} - {{ 'Search' | trans }} - {% endif %}{{ name }}{% endblock %} {% block main_content %}
-

{{ 'Recent uploads' | trans }}

- - - - - - - + {% if query %} +

{{ 'Search results' | trans }}

+ + + + + + + + {% else %} +

{{ 'Recent uploads' | trans }}

+ + + + + + + + {% endif %}
{% if torrents %} {% for torrent in torrents %} diff --git a/translations/messages+intl-icu.cs.xlf b/translations/messages+intl-icu.cs.xlf index e31d182..33c94c0 100644 --- a/translations/messages+intl-icu.cs.xlf +++ b/translations/messages+intl-icu.cs.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.de.xlf b/translations/messages+intl-icu.de.xlf index ea05fbf..739d732 100644 --- a/translations/messages+intl-icu.de.xlf +++ b/translations/messages+intl-icu.de.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.en.xlf b/translations/messages+intl-icu.en.xlf index ce8592b..53aec08 100644 --- a/translations/messages+intl-icu.en.xlf +++ b/translations/messages+intl-icu.en.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.eo.xlf b/translations/messages+intl-icu.eo.xlf index f3109f7..8c9206b 100644 --- a/translations/messages+intl-icu.eo.xlf +++ b/translations/messages+intl-icu.eo.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.es.xlf b/translations/messages+intl-icu.es.xlf index 8214c8d..b20f791 100644 --- a/translations/messages+intl-icu.es.xlf +++ b/translations/messages+intl-icu.es.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.fr.xlf b/translations/messages+intl-icu.fr.xlf index a9ceeed..6f1894a 100644 --- a/translations/messages+intl-icu.fr.xlf +++ b/translations/messages+intl-icu.fr.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.he.xlf b/translations/messages+intl-icu.he.xlf index 57093c5..b5c3202 100644 --- a/translations/messages+intl-icu.he.xlf +++ b/translations/messages+intl-icu.he.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.it.xlf b/translations/messages+intl-icu.it.xlf index 40c0271..64f52bc 100644 --- a/translations/messages+intl-icu.it.xlf +++ b/translations/messages+intl-icu.it.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.ka.xlf b/translations/messages+intl-icu.ka.xlf index 9d4e4c3..d7546df 100644 --- a/translations/messages+intl-icu.ka.xlf +++ b/translations/messages+intl-icu.ka.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.lv.xlf b/translations/messages+intl-icu.lv.xlf index 4077e03..58d1372 100644 --- a/translations/messages+intl-icu.lv.xlf +++ b/translations/messages+intl-icu.lv.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.pl.xlf b/translations/messages+intl-icu.pl.xlf index 98a947a..3e87d08 100644 --- a/translations/messages+intl-icu.pl.xlf +++ b/translations/messages+intl-icu.pl.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.pt.xlf b/translations/messages+intl-icu.pt.xlf index e0d5cf7..46133ce 100644 --- a/translations/messages+intl-icu.pt.xlf +++ b/translations/messages+intl-icu.pt.xlf @@ -717,6 +717,10 @@ seconds ago seconds ago + + Search results + Search results + diff --git a/translations/messages+intl-icu.ru.xlf b/translations/messages+intl-icu.ru.xlf index 3d23486..e0bc111 100644 --- a/translations/messages+intl-icu.ru.xlf +++ b/translations/messages+intl-icu.ru.xlf @@ -717,6 +717,10 @@ seconds ago секунд назад + + Search results + Результаты поиска + diff --git a/translations/messages+intl-icu.uk.xlf b/translations/messages+intl-icu.uk.xlf index 090339d..802d8f2 100644 --- a/translations/messages+intl-icu.uk.xlf +++ b/translations/messages+intl-icu.uk.xlf @@ -7,7 +7,7 @@ File not found - Файл не знайдений + Файл не знайдено Users @@ -717,6 +717,10 @@ seconds ago секунд тому + + Search results + Результати пошуку +