diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-04 13:47:07 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-28 10:11:49 +0200 |
commit | 96295ec84796551590d24a3516ccbba43469b6f6 (patch) | |
tree | c24fbedd0a61f23665a7dcf32ec830f937b8cc47 /src/Wallabag/CoreBundle/Controller/EntryController.php | |
parent | f9987d4a213627c6e09eee80743d42c344482e69 (diff) | |
download | wallabag-96295ec84796551590d24a3516ccbba43469b6f6.tar.gz wallabag-96295ec84796551590d24a3516ccbba43469b6f6.tar.zst wallabag-96295ec84796551590d24a3516ccbba43469b6f6.zip |
Validate sort field
Just to avoid people to sort on crazy unexistant field
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index cef29990..ff90957b 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -532,8 +532,12 @@ class EntryController extends Controller | |||
532 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); | 532 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); |
533 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); | 533 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); |
534 | 534 | ||
535 | $sortBy = $request->get('sort', 'id'); | 535 | $sortBy = 'id'; |
536 | $direction = $request->get('direction', 'DESC'); | 536 | if (in_array($request->get('sort', 'id'), ['id', 'created_at', 'title', 'updated_at'], true)) { |
537 | $sortBy = $request->get('sort', 'id'); | ||
538 | } | ||
539 | |||
540 | $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC'; | ||
537 | 541 | ||
538 | switch ($type) { | 542 | switch ($type) { |
539 | case 'search': | 543 | case 'search': |