|
@@ -79,7 +79,7 @@ discard block |
|
|
block discarded – undo |
|
79
|
79
|
|
|
80
|
80
|
$token = $request->request->get('token'); |
|
81
|
81
|
if (!$this->isCsrfTokenValid('image_upload', $token)) { |
|
82
|
|
- return $this->json([ 'error' => 'Invalid CSRF token'], 401); |
|
|
82
|
+ return $this->json(['error' => 'Invalid CSRF token'], 401); |
|
83
|
83
|
} |
|
84
|
84
|
|
|
85
|
85
|
$file = $request->files->get('file'); |
|
@@ -150,7 +150,7 @@ discard block |
|
|
block discarded – undo |
|
150
|
150
|
*/ |
|
151
|
151
|
public function delete(Request $request, Image $image): Response |
|
152
|
152
|
{ |
|
153
|
|
- if ($this->isCsrfTokenValid('delete'.$image->getId(), $request->request->get('_token'))) { |
|
|
153
|
+ if ($this->isCsrfTokenValid('delete' . $image->getId(), $request->request->get('_token'))) { |
|
154
|
154
|
$entityManager = $this->getDoctrine()->getManager(); |
|
155
|
155
|
$entityManager->remove($image); |
|
156
|
156
|
$entityManager->flush(); |
|
@@ -164,8 +164,8 @@ discard block |
|
|
block discarded – undo |
|
164
|
164
|
*/ |
|
165
|
165
|
public function setLocation(Request $request, Image $image, LocationService $locationService, EntityManagerInterface $entityManager): Response |
|
166
|
166
|
{ |
|
167
|
|
- if ($this->isCsrfTokenValid('set_location'.$image->getId(), $request->request->get('_token'))) { |
|
168
|
|
- $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
|
167
|
+ if ($this->isCsrfTokenValid('set_location' . $image->getId(), $request->request->get('_token'))) { |
|
|
168
|
+ $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
169
|
169
|
if ($neighbourhood !== null) { |
|
170
|
170
|
$image->setLocation($neighbourhood); |
|
171
|
171
|
$entityManager->persist($image); |
|
@@ -181,7 +181,7 @@ discard block |
|
|
block discarded – undo |
|
181
|
181
|
*/ |
|
182
|
182
|
public function setAutoTags(Request $request, Image $image, MessageBusInterface $messageBus): Response |
|
183
|
183
|
{ |
|
184
|
|
- if ($this->isCsrfTokenValid('set_auto_tags'.$image->getId(), $request->request->get('_token'))) { |
|
|
184
|
+ if ($this->isCsrfTokenValid('set_auto_tags' . $image->getId(), $request->request->get('_token'))) { |
|
185
|
185
|
$imageId = $image->getId(); |
|
186
|
186
|
if ($imageId === null) { |
|
187
|
187
|
throw new InvalidParameterException('No image id in setAutoTags'); |