diff options
Diffstat (limited to 'application/front/controller/admin')
5 files changed, 22 insertions, 19 deletions
diff --git a/application/front/controller/admin/ConfigureController.php b/application/front/controller/admin/ConfigureController.php index 5a482d8e..44971c43 100644 --- a/application/front/controller/admin/ConfigureController.php +++ b/application/front/controller/admin/ConfigureController.php | |||
@@ -19,7 +19,7 @@ use Throwable; | |||
19 | class ConfigureController extends ShaarliAdminController | 19 | class ConfigureController extends ShaarliAdminController |
20 | { | 20 | { |
21 | /** | 21 | /** |
22 | * GET /configure - Displays the configuration page | 22 | * GET /admin/configure - Displays the configuration page |
23 | */ | 23 | */ |
24 | public function index(Request $request, Response $response): Response | 24 | public function index(Request $request, Response $response): Response |
25 | { | 25 | { |
@@ -56,7 +56,7 @@ class ConfigureController extends ShaarliAdminController | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * POST /configure - Update Shaarli's configuration | 59 | * POST /admin/configure - Update Shaarli's configuration |
60 | */ | 60 | */ |
61 | public function save(Request $request, Response $response): Response | 61 | public function save(Request $request, Response $response): Response |
62 | { | 62 | { |
@@ -115,6 +115,6 @@ class ConfigureController extends ShaarliAdminController | |||
115 | 115 | ||
116 | $this->saveSuccessMessage(t('Configuration was saved.')); | 116 | $this->saveSuccessMessage(t('Configuration was saved.')); |
117 | 117 | ||
118 | return $response->withRedirect('./configure'); | 118 | return $this->redirect($response, '/admin/configure'); |
119 | } | 119 | } |
120 | } | 120 | } |
diff --git a/application/front/controller/admin/LogoutController.php b/application/front/controller/admin/LogoutController.php index 41e81984..c5984814 100644 --- a/application/front/controller/admin/LogoutController.php +++ b/application/front/controller/admin/LogoutController.php | |||
@@ -22,8 +22,8 @@ class LogoutController extends ShaarliAdminController | |||
22 | $this->container->sessionManager->logout(); | 22 | $this->container->sessionManager->logout(); |
23 | 23 | ||
24 | // TODO: switch to a simple Cookie manager allowing to check the session, and create mocks. | 24 | // TODO: switch to a simple Cookie manager allowing to check the session, and create mocks. |
25 | setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, $this->container->webPath); | 25 | setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, $this->container->basePath . '/'); |
26 | 26 | ||
27 | return $response->withRedirect('./'); | 27 | return $this->redirect($response, '/'); |
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/application/front/controller/admin/ManageTagController.php b/application/front/controller/admin/ManageTagController.php index e015e613..7dab288a 100644 --- a/application/front/controller/admin/ManageTagController.php +++ b/application/front/controller/admin/ManageTagController.php | |||
@@ -16,7 +16,7 @@ use Slim\Http\Response; | |||
16 | class ManageTagController extends ShaarliAdminController | 16 | class ManageTagController extends ShaarliAdminController |
17 | { | 17 | { |
18 | /** | 18 | /** |
19 | * GET /manage-tags - Displays the manage tags page | 19 | * GET /admin/tags - Displays the manage tags page |
20 | */ | 20 | */ |
21 | public function index(Request $request, Response $response): Response | 21 | public function index(Request $request, Response $response): Response |
22 | { | 22 | { |
@@ -32,7 +32,7 @@ class ManageTagController extends ShaarliAdminController | |||
32 | } | 32 | } |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * POST /manage-tags - Update or delete provided tag | 35 | * POST /admin/tags - Update or delete provided tag |
36 | */ | 36 | */ |
37 | public function save(Request $request, Response $response): Response | 37 | public function save(Request $request, Response $response): Response |
38 | { | 38 | { |
@@ -46,7 +46,7 @@ class ManageTagController extends ShaarliAdminController | |||
46 | if (0 === strlen($fromTag) || false === $isDelete && 0 === strlen($toTag)) { | 46 | if (0 === strlen($fromTag) || false === $isDelete && 0 === strlen($toTag)) { |
47 | $this->saveWarningMessage(t('Invalid tags provided.')); | 47 | $this->saveWarningMessage(t('Invalid tags provided.')); |
48 | 48 | ||
49 | return $response->withRedirect('./manage-tags'); | 49 | return $this->redirect($response, '/admin/tags'); |
50 | } | 50 | } |
51 | 51 | ||
52 | // TODO: move this to bookmark service | 52 | // TODO: move this to bookmark service |
@@ -80,8 +80,8 @@ class ManageTagController extends ShaarliAdminController | |||
80 | 80 | ||
81 | $this->saveSuccessMessage($alert); | 81 | $this->saveSuccessMessage($alert); |
82 | 82 | ||
83 | $redirect = true === $isDelete ? './manage-tags' : './?searchtags='. urlencode($toTag); | 83 | $redirect = true === $isDelete ? '/admin/tags' : '/?searchtags='. urlencode($toTag); |
84 | 84 | ||
85 | return $response->withRedirect($redirect); | 85 | return $this->redirect($response, $redirect); |
86 | } | 86 | } |
87 | } | 87 | } |
diff --git a/application/front/controller/admin/PasswordController.php b/application/front/controller/admin/PasswordController.php index 6e8f0bcb..bcce01a6 100644 --- a/application/front/controller/admin/PasswordController.php +++ b/application/front/controller/admin/PasswordController.php | |||
@@ -29,7 +29,7 @@ class PasswordController extends ShaarliAdminController | |||
29 | } | 29 | } |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * GET /password - Displays the change password template | 32 | * GET /admin/password - Displays the change password template |
33 | */ | 33 | */ |
34 | public function index(Request $request, Response $response): Response | 34 | public function index(Request $request, Response $response): Response |
35 | { | 35 | { |
@@ -37,7 +37,7 @@ class PasswordController extends ShaarliAdminController | |||
37 | } | 37 | } |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * POST /password - Change admin password - existing and new passwords need to be provided. | 40 | * POST /admin/password - Change admin password - existing and new passwords need to be provided. |
41 | */ | 41 | */ |
42 | public function change(Request $request, Response $response): Response | 42 | public function change(Request $request, Response $response): Response |
43 | { | 43 | { |
diff --git a/application/front/controller/admin/PostBookmarkController.php b/application/front/controller/admin/PostBookmarkController.php index dbe570e2..f3ee5dea 100644 --- a/application/front/controller/admin/PostBookmarkController.php +++ b/application/front/controller/admin/PostBookmarkController.php | |||
@@ -19,7 +19,7 @@ use Slim\Http\Response; | |||
19 | class PostBookmarkController extends ShaarliAdminController | 19 | class PostBookmarkController extends ShaarliAdminController |
20 | { | 20 | { |
21 | /** | 21 | /** |
22 | * GET /add-shaare - Displays the form used to create a new bookmark from an URL | 22 | * GET /admin/add-shaare - Displays the form used to create a new bookmark from an URL |
23 | */ | 23 | */ |
24 | public function addShaare(Request $request, Response $response): Response | 24 | public function addShaare(Request $request, Response $response): Response |
25 | { | 25 | { |
@@ -32,7 +32,7 @@ class PostBookmarkController extends ShaarliAdminController | |||
32 | } | 32 | } |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * GET /shaare - Displays the bookmark form for creation. | 35 | * GET /admin/shaare - Displays the bookmark form for creation. |
36 | * Note that if the URL is found in existing bookmarks, then it will be in edit mode. | 36 | * Note that if the URL is found in existing bookmarks, then it will be in edit mode. |
37 | */ | 37 | */ |
38 | public function displayCreateForm(Request $request, Response $response): Response | 38 | public function displayCreateForm(Request $request, Response $response): Response |
@@ -93,7 +93,7 @@ class PostBookmarkController extends ShaarliAdminController | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * GET /shaare-{id} - Displays the bookmark form in edition mode. | 96 | * GET /admin/shaare/{id} - Displays the bookmark form in edition mode. |
97 | */ | 97 | */ |
98 | public function displayEditForm(Request $request, Response $response, array $args): Response | 98 | public function displayEditForm(Request $request, Response $response, array $args): Response |
99 | { | 99 | { |
@@ -106,7 +106,7 @@ class PostBookmarkController extends ShaarliAdminController | |||
106 | } catch (BookmarkNotFoundException $e) { | 106 | } catch (BookmarkNotFoundException $e) { |
107 | $this->saveErrorMessage(t('Bookmark not found')); | 107 | $this->saveErrorMessage(t('Bookmark not found')); |
108 | 108 | ||
109 | return $response->withRedirect('./'); | 109 | return $this->redirect($response, '/'); |
110 | } | 110 | } |
111 | 111 | ||
112 | $formatter = $this->container->formatterFactory->getFormatter('raw'); | 112 | $formatter = $this->container->formatterFactory->getFormatter('raw'); |
@@ -116,7 +116,7 @@ class PostBookmarkController extends ShaarliAdminController | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * POST /shaare | 119 | * POST /admin/shaare |
120 | */ | 120 | */ |
121 | public function save(Request $request, Response $response): Response | 121 | public function save(Request $request, Response $response): Response |
122 | { | 122 | { |
@@ -170,11 +170,14 @@ class PostBookmarkController extends ShaarliAdminController | |||
170 | ); | 170 | ); |
171 | } | 171 | } |
172 | 172 | ||
173 | /** | ||
174 | * GET /admin/shaare/delete | ||
175 | */ | ||
173 | public function deleteBookmark(Request $request, Response $response): Response | 176 | public function deleteBookmark(Request $request, Response $response): Response |
174 | { | 177 | { |
175 | $this->checkToken($request); | 178 | $this->checkToken($request); |
176 | 179 | ||
177 | $ids = escape(trim($request->getParam('lf_linkdate'))); | 180 | $ids = escape(trim($request->getParam('id'))); |
178 | if (strpos($ids, ' ') !== false) { | 181 | if (strpos($ids, ' ') !== false) { |
179 | // multiple, space-separated ids provided | 182 | // multiple, space-separated ids provided |
180 | $ids = array_values(array_filter(preg_split('/\s+/', $ids), 'strlen')); | 183 | $ids = array_values(array_filter(preg_split('/\s+/', $ids), 'strlen')); |
@@ -207,7 +210,7 @@ class PostBookmarkController extends ShaarliAdminController | |||
207 | } | 210 | } |
208 | 211 | ||
209 | // Don't redirect to where we were previously because the datastore has changed. | 212 | // Don't redirect to where we were previously because the datastore has changed. |
210 | return $response->withRedirect('./'); | 213 | return $this->redirect($response, '/'); |
211 | } | 214 | } |
212 | 215 | ||
213 | protected function displayForm(array $link, bool $isNew, Request $request, Response $response): Response | 216 | protected function displayForm(array $link, bool $isNew, Request $request, Response $response): Response |