diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/legacy/LegacyController.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/application/legacy/LegacyController.php b/application/legacy/LegacyController.php index e16dd0f4..826604e7 100644 --- a/application/legacy/LegacyController.php +++ b/application/legacy/LegacyController.php | |||
@@ -39,13 +39,23 @@ class LegacyController extends ShaarliVisitorController | |||
39 | /** Legacy route: ?post= */ | 39 | /** Legacy route: ?post= */ |
40 | public function post(Request $request, Response $response): Response | 40 | public function post(Request $request, Response $response): Response |
41 | { | 41 | { |
42 | $parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : ''; | ||
43 | $route = '/admin/shaare'; | 42 | $route = '/admin/shaare'; |
43 | $buildParameters = function (?array $parameters, bool $encode) { | ||
44 | if ($encode) { | ||
45 | $parameters = array_map('urlencode', $parameters); | ||
46 | } | ||
47 | |||
48 | return count($parameters) > 0 ? '?' . http_build_query($parameters) : ''; | ||
49 | }; | ||
50 | |||
44 | 51 | ||
45 | if (!$this->container->loginManager->isLoggedIn()) { | 52 | if (!$this->container->loginManager->isLoggedIn()) { |
53 | $parameters = $buildParameters($request->getQueryParams(), true); | ||
46 | return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters); | 54 | return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters); |
47 | } | 55 | } |
48 | 56 | ||
57 | $parameters = $buildParameters($request->getQueryParams(), false); | ||
58 | |||
49 | return $this->redirect($response, $route . $parameters); | 59 | return $this->redirect($response, $route . $parameters); |
50 | } | 60 | } |
51 | 61 | ||