diff options
Diffstat (limited to 'src/Controller/HeadFootController.php')
| -rw-r--r-- | src/Controller/HeadFootController.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Controller/HeadFootController.php b/src/Controller/HeadFootController.php index e39c07b..2bf210e 100644 --- a/src/Controller/HeadFootController.php +++ b/src/Controller/HeadFootController.php | |||
| @@ -28,14 +28,19 @@ class HeadFootController | |||
| 28 | $node_data = $model->getNode()->getNodeData(); | 28 | $node_data = $model->getNode()->getNodeData(); |
| 29 | 29 | ||
| 30 | // liens réseaux sociaux | 30 | // liens réseaux sociaux |
| 31 | $link = trim($json['new_text'] ?? ''); // trim n'aime pas recevoir un NULL | ||
| 31 | if(in_array($params_array[1], NodeData::$social_networks)){ | 32 | if(in_array($params_array[1], NodeData::$social_networks)){ |
| 33 | if($link !== '' && !Security::validateURL($link)){ | ||
| 34 | return new JsonResponse(['success' => false, 'error' => 'invalid_url']); | ||
| 35 | } | ||
| 36 | |||
| 32 | $social = $node_data->getData()['social'] ?? []; | 37 | $social = $node_data->getData()['social'] ?? []; |
| 33 | $social[$params_array[1]] = $json['new_text']; | 38 | $social[$params_array[1]] = $link; |
| 34 | $node_data->updateData('social', $social); | 39 | $node_data->updateData('social', $social); |
| 35 | } | 40 | } |
| 36 | // autres textes | 41 | // autres textes |
| 37 | else{ | 42 | else{ |
| 38 | $node_data->updateData($params_array[1], $json['new_text']); // $params_array[1] n'est pas contrôlé | 43 | $node_data->updateData($params_array[1], $link); // $params_array[1] n'est pas contrôlé |
| 39 | } | 44 | } |
| 40 | 45 | ||
| 41 | $entityManager->flush(); | 46 | $entityManager->flush(); |
