aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin/PostBookmarkController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/front/controller/admin/PostBookmarkController.php')
-rw-r--r--application/front/controller/admin/PostBookmarkController.php17
1 files changed, 10 insertions, 7 deletions
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;
19class PostBookmarkController extends ShaarliAdminController 19class 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