|
@@ -81,7 +81,7 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
|
|
82
|
82
|
$token = (string) $request->request->get('token'); |
|
83
|
83
|
if (!$this->isCsrfTokenValid('image_upload', $token)) { |
|
84
|
|
- return $this->json([ 'error' => 'Invalid CSRF token'], 401); |
|
|
84
|
+ return $this->json(['error' => 'Invalid CSRF token'], 401); |
|
85
|
85
|
} |
|
86
|
86
|
|
|
87
|
87
|
$file = $request->files->get('file'); |
|
@@ -158,7 +158,7 @@ discard block |
|
|
block discarded – undo |
|
158
|
158
|
Image $image, |
|
159
|
159
|
ManagerRegistry $managerRegistry |
|
160
|
160
|
): Response { |
|
161
|
|
- if ($this->isCsrfTokenValid('delete'.$image->getId(), (string) $request->request->get('_token'))) { |
|
|
161
|
+ if ($this->isCsrfTokenValid('delete' . $image->getId(), (string) $request->request->get('_token'))) { |
|
162
|
162
|
$entityManager = $managerRegistry->getManager(); |
|
163
|
163
|
$entityManager->remove($image); |
|
164
|
164
|
$entityManager->flush(); |
|
@@ -172,8 +172,8 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
*/ |
|
173
|
173
|
public function setLocation(Request $request, Image $image, LocationService $locationService, EntityManagerInterface $entityManager): Response |
|
174
|
174
|
{ |
|
175
|
|
- if ($this->isCsrfTokenValid('set_location'.$image->getId(), (string) $request->request->get('_token'))) { |
|
176
|
|
- $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
|
175
|
+ if ($this->isCsrfTokenValid('set_location' . $image->getId(), (string) $request->request->get('_token'))) { |
|
|
176
|
+ $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
177
|
177
|
if ($neighbourhood !== null) { |
|
178
|
178
|
$image->setLocation($neighbourhood); |
|
179
|
179
|
$entityManager->persist($image); |
|
@@ -189,7 +189,7 @@ discard block |
|
|
block discarded – undo |
|
189
|
189
|
*/ |
|
190
|
190
|
public function setAutoTags(Request $request, Image $image, MessageBusInterface $messageBus): Response |
|
191
|
191
|
{ |
|
192
|
|
- if ($this->isCsrfTokenValid('set_auto_tags'.$image->getId(), (string) $request->request->get('_token'))) { |
|
|
192
|
+ if ($this->isCsrfTokenValid('set_auto_tags' . $image->getId(), (string) $request->request->get('_token'))) { |
|
193
|
193
|
$imageId = $image->getId(); |
|
194
|
194
|
if ($imageId === null) { |
|
195
|
195
|
throw new InvalidParameterException('No image id in setAutoTags'); |