diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index f980fa10..97995fa7 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -43,7 +43,15 @@ class PostController extends AbstractController public function listRedirectAction($source = 'posts') { $context = Core::getContext(); + + if ($source == 'mass-tag') + Access::assert(new Privilege(Privilege::MassTag)); + + $oldPage = intval(InputHelper::get('old-page')); + $oldQuery = trim(InputHelper::get('old-query')); $query = trim(InputHelper::get('query')); + $additionalInfo = trim(InputHelper::get('tag')); + $context->transport->searchQuery = $query; $context->transport->lastSearchQuery = $query; if (strpos($query, '/') !== false) @@ -53,9 +61,14 @@ class PostController extends AbstractController $params['source'] = $source; if ($query) $params['query'] = $query; - #if ($additionalInfo) - # $params['additionalInfo'] = $additionalInfo; - $params['page'] = 1; + if ($additionalInfo) + $params['additionalInfo'] = $additionalInfo; + + if ($oldPage != 0 and $oldQuery == $query) + $params['page'] = $oldPage; + else + $params['page'] = 1; + $url = \Chibi\Router::linkTo(['PostController', 'listView'], $params); $this->redirect($url); diff --git a/src/Controllers/TagController.php b/src/Controllers/TagController.php index 5868c84d..eff9672e 100644 --- a/src/Controllers/TagController.php +++ b/src/Controllers/TagController.php @@ -131,30 +131,6 @@ class TagController extends AbstractController $this->renderViewWithSource('tag-list-wrapper', 'mass-tag'); } - public function massTagRedirectAction() - { - Access::assert(new Privilege(Privilege::MassTag)); - $suppliedOldPage = intval(InputHelper::get('old-page')); - $suppliedOldQuery = InputHelper::get('old-query'); - $suppliedQuery = InputHelper::get('query'); - $suppliedTag = InputHelper::get('tag'); - - $params = - [ - 'source' => 'mass-tag', - 'query' => trim($suppliedQuery ?: ''), - 'additionalInfo' => $suppliedTag ? $suppliedTag : '', - ]; - - if ($suppliedOldPage != 0 and $suppliedOldQuery == $suppliedQuery) - $params['page'] = $suppliedOldPage; - else - $params['page'] = 1; - - $url = \Chibi\Router::linkTo(['PostController', 'listView'], $params); - $this->redirect($url); - } - private function renderViewWithSource($viewName, $source) { diff --git a/src/Views/tag/tag-mass-tag.phtml b/src/Views/tag/tag-mass-tag.phtml index 3f6f959e..cf28eb79 100644 --- a/src/Views/tag/tag-mass-tag.phtml +++ b/src/Views/tag/tag-mass-tag.phtml @@ -1,5 +1,7 @@