diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index e006c5c1..ea0bda07 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -178,6 +178,19 @@ class PostController + /** + * @route /random + * @route /random/{page} + * @validate page \d* + */ + public function randomAction($page = 1) + { + $this->listAction('order:random', $page); + $this->context->viewName = 'post-list'; + } + + + /** * @route /post/upload */ diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index b4a2b8f5..10575411 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -27,6 +27,9 @@ if (PrivilegesHelper::confirm(Privilege::ListPosts)) $nav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')]; + if (PrivilegesHelper::confirm(Privilege::ListPosts)) + $nav []= ['Random', \Chibi\UrlHelper::route('post', 'random')]; + if (PrivilegesHelper::confirm(Privilege::ListPosts)) $nav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];