From 82ca68fef0306d65b670a6475e79953d58d075a5 Mon Sep 17 00:00:00 2001 From: rem Date: Fri, 7 Jun 2024 15:02:16 +0200 Subject: [PATCH 1/6] moving nested folders + postcontroller --- src/Controller/PostController.php | 64 ++++++++++++++++--- src/Entity/{Entity => }/Commentary.php | 0 src/Entity/Entity/.gitignore | 0 src/Entity/{Entity => }/Post.php | 0 src/Entity/{Entity => }/Profil.php | 0 src/Entity/{Entity => }/Tags.php | 0 .../{Repository => }/CommentaryRepository.php | 0 .../{Repository => }/PostRepository.php | 0 .../{Repository => }/ProfilRepository.php | 0 src/Repository/Repository/.gitignore | 0 .../{Repository => }/TagsRepository.php | 0 11 files changed, 55 insertions(+), 9 deletions(-) rename src/Entity/{Entity => }/Commentary.php (100%) delete mode 100644 src/Entity/Entity/.gitignore rename src/Entity/{Entity => }/Post.php (100%) rename src/Entity/{Entity => }/Profil.php (100%) rename src/Entity/{Entity => }/Tags.php (100%) rename src/Repository/{Repository => }/CommentaryRepository.php (100%) rename src/Repository/{Repository => }/PostRepository.php (100%) rename src/Repository/{Repository => }/ProfilRepository.php (100%) delete mode 100644 src/Repository/Repository/.gitignore rename src/Repository/{Repository => }/TagsRepository.php (100%) diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index 9ca4c76..898fcec 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -1,17 +1,63 @@ +em = $em; + $this->serializer = $serializer; + } + + #[Route('/post/{id}', name: 'display post', methods: ['GET'])] + public function getPost(int $id): Response + { + $post = $this->em->getRepository(Post::class)->find($id); + + if(!$post) { + # Error 404 page + } + + # Return twig + return new Response(); + } + + #[Route('/post/', name: 'add_post', methods: ['POST'])] + public function addPost(Request $request) :Response + { + $data = json_decode($request->getContent(), true); + + try { + $post = $this->serializer->deserialize($data, Post::class, 'json'); + } catch (\Exception) { + return new Response("Invalid JSON data", Response::HTTP_BAD_REQUEST); + } + + # Handle error on data + $this->em->persist($post); + $this->em->flush(); + + return new Response(); + } -class PostController -{ - #[Route('/lucky/number/{max}', name: 'app_lucky_number')] - public function number(int $max): Response + #[Route('/post/{id}', name: 'remove_post', methods: ['DELETE'])] + public function removePost(int $id) :Response { - $number = random_int(0, $max); + $postRef = $this->em->getReference('Post', $id); + $this->em->remove($postRef); + $this->em->flush(); - return new Response( - 'Lucky number: '.$number.'' - ); - } + return new Response(); + } } diff --git a/src/Entity/Entity/Commentary.php b/src/Entity/Commentary.php similarity index 100% rename from src/Entity/Entity/Commentary.php rename to src/Entity/Commentary.php diff --git a/src/Entity/Entity/.gitignore b/src/Entity/Entity/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/src/Entity/Entity/Post.php b/src/Entity/Post.php similarity index 100% rename from src/Entity/Entity/Post.php rename to src/Entity/Post.php diff --git a/src/Entity/Entity/Profil.php b/src/Entity/Profil.php similarity index 100% rename from src/Entity/Entity/Profil.php rename to src/Entity/Profil.php diff --git a/src/Entity/Entity/Tags.php b/src/Entity/Tags.php similarity index 100% rename from src/Entity/Entity/Tags.php rename to src/Entity/Tags.php diff --git a/src/Repository/Repository/CommentaryRepository.php b/src/Repository/CommentaryRepository.php similarity index 100% rename from src/Repository/Repository/CommentaryRepository.php rename to src/Repository/CommentaryRepository.php diff --git a/src/Repository/Repository/PostRepository.php b/src/Repository/PostRepository.php similarity index 100% rename from src/Repository/Repository/PostRepository.php rename to src/Repository/PostRepository.php diff --git a/src/Repository/Repository/ProfilRepository.php b/src/Repository/ProfilRepository.php similarity index 100% rename from src/Repository/Repository/ProfilRepository.php rename to src/Repository/ProfilRepository.php diff --git a/src/Repository/Repository/.gitignore b/src/Repository/Repository/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/src/Repository/Repository/TagsRepository.php b/src/Repository/TagsRepository.php similarity index 100% rename from src/Repository/Repository/TagsRepository.php rename to src/Repository/TagsRepository.php -- 2.36.3 From ff31a89144369db6eb7cab868cba10e230d8117a Mon Sep 17 00:00:00 2001 From: "aurian.jault" Date: Fri, 7 Jun 2024 15:20:18 +0200 Subject: [PATCH 2/6] Changement de CE FOUTU .IDEA --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 13ff59d..0658310 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ # Embedded web-server pid file /.web-server-pid +.idea -- 2.36.3 From a07327dbc5a72e23a946641f85d08516d4aea3e2 Mon Sep 17 00:00:00 2001 From: rem Date: Tue, 11 Jun 2024 14:39:21 +0200 Subject: [PATCH 3/6] post form + controller --- .env | 4 ++-- config/services.yaml | 3 +++ src/Controller/PostController.php | 34 +++++++++++++++++++------------ src/Entity/Tags.php | 2 -- src/Form/Type/PostType.php | 27 ++++++++++++++++++++++++ templates/post/new.html.twig | 1 + 6 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 src/Form/Type/PostType.php create mode 100644 templates/post/new.html.twig diff --git a/.env b/.env index f81e782..6e5135c 100644 --- a/.env +++ b/.env @@ -23,10 +23,10 @@ APP_SECRET=5e7ed9de1fd633f917d0e87e2e05f923 # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # -# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" +DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" -DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" +# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" ###< doctrine/doctrine-bundle ### ###> symfony/messenger ### diff --git a/config/services.yaml b/config/services.yaml index 2d6a76f..09f3146 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -11,6 +11,9 @@ services: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + Symfony\Component\Serializer\Serializer: + autowire: true + # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App\: diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index 898fcec..241c67c 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -7,9 +7,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Attribute\Route; use Doctrine\ORM\EntityManagerInterface; use App\Entity\Post; +use App\Form\Type\PostType; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Serializer\Serializer; -class PostController { +class PostController extends AbstractController { private EntityManagerInterface $em; private Serializer $serializer; @@ -20,7 +22,7 @@ class PostController { $this->serializer = $serializer; } - #[Route('/post/{id}', name: 'display post', methods: ['GET'])] + #[Route('/post/{id}', name: 'display post', methods: ['POST'])] public function getPost(int $id): Response { $post = $this->em->getRepository(Post::class)->find($id); @@ -33,22 +35,28 @@ class PostController { return new Response(); } - #[Route('/post/', name: 'add_post', methods: ['POST'])] + #[Route('/post/new/', name: 'add_post', methods: ['GET','POST'])] public function addPost(Request $request) :Response { - $data = json_decode($request->getContent(), true); - - try { - $post = $this->serializer->deserialize($data, Post::class, 'json'); - } catch (\Exception) { - return new Response("Invalid JSON data", Response::HTTP_BAD_REQUEST); + $post = new Post(); + + $form = $this->createForm(PostType::class, $post); + + + $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { + $form = $form->getData(); + + $this->em->persist($post); + $this->em->flush(); } + return $this->render('post/new.html.twig', [ + 'form' => $form, + ]); + # Handle error on data - $this->em->persist($post); - $this->em->flush(); - - return new Response(); + } #[Route('/post/{id}', name: 'remove_post', methods: ['DELETE'])] diff --git a/src/Entity/Tags.php b/src/Entity/Tags.php index 817c672..0ce2dc4 100644 --- a/src/Entity/Tags.php +++ b/src/Entity/Tags.php @@ -2,14 +2,12 @@ namespace App\Entity; -use ApiPlatform\Metadata\ApiResource; use App\Repository\TagsRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: TagsRepository::class)] -#[ApiResource] class Tags { #[ORM\Id] diff --git a/src/Form/Type/PostType.php b/src/Form/Type/PostType.php new file mode 100644 index 0000000..3578cea --- /dev/null +++ b/src/Form/Type/PostType.php @@ -0,0 +1,27 @@ +add('title', TextType::class) + ->add('text', TextareaType::class) + ->add('dream', CheckboxType::class) + // ->add('tags', ChoiceType::class, [ + // "multiple" => true + // ]) + ->add('submit', SubmitType::class) + ; + } +} diff --git a/templates/post/new.html.twig b/templates/post/new.html.twig new file mode 100644 index 0000000..0c1a4ce --- /dev/null +++ b/templates/post/new.html.twig @@ -0,0 +1 @@ +{{ form(form) }} -- 2.36.3 From 1c7fc75662d9bc2dd58ee570b3573eca16c86e07 Mon Sep 17 00:00:00 2001 From: rem Date: Tue, 11 Jun 2024 22:28:52 +0200 Subject: [PATCH 4/6] add base view for detailed post --- public/css/components/post.css | 56 ++++++++++++++++++++++ src/Controller/PostController.php | 27 ++++------- src/Controller/RegistrationController.php | 1 - templates/post/post.html.twig | 25 ++++++++++ var/data.db | Bin 102400 -> 102400 bytes 5 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 public/css/components/post.css create mode 100644 templates/post/post.html.twig diff --git a/public/css/components/post.css b/public/css/components/post.css new file mode 100644 index 0000000..7c0bada --- /dev/null +++ b/public/css/components/post.css @@ -0,0 +1,56 @@ +:root { + font-family: "Helvetica", 'Courier New', Courier, monospace; +} + +#post-wrapper { + width: 70%; + background-color: #f2f2f7; + margin: 0 auto; + border: 3px solid black; + border-radius: 1rem; + padding: 20px; + margin-top: 25vh; +} + +#post-info { + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; +} + +h1 { + font-size: 3em; +} + +p { + white-space: pre-wrap; + font-size: 1.2em; +} + +#comments { + h2 { + font-size: 30px; + } +} + +hr { + color: black; +} + +html { + --s: 257px; + /* control the size */ + --c1: #38476b; + --c2: #bda3b6; + + --_c: var(--c1) calc(100% - var(--s)/2) 99%, #0000; + --_g: var(--s), #0000 calc(99% - var(--s)/2), var(--_c); + background: + radial-gradient(var(--s) at 100% var(--_g)), + radial-gradient(calc(var(--s)/4) at 50% calc(100%/3), var(--_c)) var(--s) 0, + radial-gradient(var(--s) at 0% var(--_g)) 0 calc(3*var(--s)) var(--c2); + background-size: + calc(2*var(--s)) calc(9*var(--s)/4), + calc(2*var(--s)) calc(3*var(--s)/4); +} diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index 62d8d7a..7548d15 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Attribute\Route; use Doctrine\ORM\EntityManagerInterface; use App\Entity\Post; -use App\Entity\Profil; use App\Form\Type\PostType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -32,20 +31,22 @@ class PostController extends AbstractController ]); } - #[Route('/post/{id}', + #[Route( + '/post/{id}', name: 'display post', methods: ['GET'], - requirements: ['id' => '\d+'])] + requirements: ['id' => '\d+'] + )] public function getPost(int $id): Response { $post = $this->em->getRepository(Post::class)->find($id); if (!$post) { - # Error 404 page } - # Return twig - return new Response(); + return $this->render('post/post.html.twig', [ + 'post' => $post + ]); } #[Route('/post/new/', name: 'add_post', methods: ['GET', 'POST'])] @@ -59,14 +60,7 @@ class PostController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $form = $form->getData(); - $user = $this->getUser(); - - $profil = new Profil(); - $profil->setId(11); - $profil->setName("coucou"); - - $post->setProfil($user); $this->em->persist($post); @@ -78,16 +72,13 @@ class PostController extends AbstractController return $this->render('post/new.html.twig', [ 'form' => $form, ]); - - # Handle error on data - } #[Route('/post/{id}', name: 'remove_post', methods: ['DELETE'])] public function removePost(int $id): Response { - $postRef = $this->em->getReference('Post', $id); - $this->em->remove($postRef); + $post = $this->em->getRepository(Post::class)->find($id); + $this->em->remove($post); $this->em->flush(); return new Response(); diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 2b47b0d..3028b08 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -33,7 +33,6 @@ class RegistrationController extends AbstractController $entityManager->persist($user); $entityManager->flush(); - return $security->login($user, 'form_login', 'main'); } diff --git a/templates/post/post.html.twig b/templates/post/post.html.twig new file mode 100644 index 0000000..8d4b20b --- /dev/null +++ b/templates/post/post.html.twig @@ -0,0 +1,25 @@ + + +{{ post.title }} + +{% block body %} +
+
+
+ + {{ post.profil.name }} + {# - {{ post.dateCreated }} #} + - Il y a 3 jours +
+ +

{{ post.title }}

+

{{ post.text }}

+
+ +
+ +
+

Comments

+
+
+{% endblock %} diff --git a/var/data.db b/var/data.db index 380e83c26d036f08d30309292cc1308603199aca..4747b9785c2c2404b9ff7663c4d25034de9e6509 100644 GIT binary patch delta 2047 zcmZ`)&ub(_6z*p7YvaTj4+{$$*zz=plffnI!3FWKcrduGBHlz&>8{CCsIKbNk0CiE zy>k>6amm#~*n>K`#R!Xd?1O)V>mRTuFM1JS{a*D<5(F7$rl6_c>`qT9X>H7Kh$)j}X;?GBGY_0P}(pr9!y#8YON$2s`@jnJEx1 z^jIiUmZ(#5OOZRsluB`%Be>+!4cJG*AzXVCtYZ~Qa4EEBLuG>NvjQ<}Pp}dv(xt;Q zNu_Yh)>HhH*fVLlF+ph^@azCpcy+4u@DEK8IF1 z$_CkBIEyuy0D+4@~ z8&`ZBXeJp~0S!}S#Vf#*2Yu{}1IE4Jz!55C^-rEK$I%Vg=Qu0dCdh5iR*|7 zW^>?U%&7opSLhoJpy?r(Kp*#Vrhxwn1@kCO95{)@0dhrX!8lZ9`;kMCk1l}g;2pjCQwEwK-)Evg?6HV1fT}ahV&Gh2rNqAOn|5WMMONf zfP6KoU0aXFR)8NR5m!Qrb0WC4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F8SdA+7PHE&Apx<+RV*7aPIz8aljs_1UJC=qR1Wm-~KXsC+QHm0XYcaR6}e}G*o zUg379&De!7s%D{5-%|Z}lZq2tg~(+@CIgn6W7>3$CZj4ljqtPD92sqEPy=B;%H%9l zGu_Qo~JW9J0cutT5KG^78U)$AnQ|#pP zz}^4sG8R>tF;fJGmjpTO`aWdL@NG{O2zg|YtJrV_nrpOsK`n*rD&`8o7>`J%bt4aa zvPWs^Cd2R~jhKu-kSAo1XIXZr&xaD{mnC%*v&fFytR&57%k!B@`2%bbDK4r}Q0IE4 zlqwhdpRtzdMi1)Y%A@5JTWE5U1_T66aB4FkAk1yh<{ITic;a}mubDC;R!6eh&RzXs z7YCVf%5cyj%UnMSca?Rg)0)+EHKJ9Qat1?*ajZCyA!)`?J)u19^l%+9S+bT;*Yd!f zeQX;k3jK@}i=tx-LD|%YqL>QHb#fLG+$z<$WyKi83enM -- 2.36.3 From b001f7ecd850d74889b231df58e7482f7447b2b7 Mon Sep 17 00:00:00 2001 From: "aurian.jault" Date: Wed, 12 Jun 2024 14:06:31 +0200 Subject: [PATCH 5/6] Adding roles and redirect on logout --- config/packages/security.yaml | 8 +++--- migrations/Version20240612112105.php | 35 +++++++++++++++++++++++ src/Controller/RegistrationController.php | 1 + src/Entity/Profil.php | 12 ++++---- src/Repository/TagsRepository.php | 2 +- 5 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 migrations/Version20240612112105.php diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 288ddbd..73a0545 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -22,8 +22,7 @@ security: enable_csrf: true logout: path: app_logout - # where to redirect after logout - # target: app_any_route + target: /login # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall @@ -34,8 +33,9 @@ security: # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } - # - { path: ^/profile, roles: ROLE_USER } + #- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY } + #- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } + #- { path: ^/logout, role: ROLE_USER} when@test: security: diff --git a/migrations/Version20240612112105.php b/migrations/Version20240612112105.php new file mode 100644 index 0000000..451d975 --- /dev/null +++ b/migrations/Version20240612112105.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil'); + $this->addSql('DROP TABLE profil'); + $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); + $this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil'); + $this->addSql('DROP TABLE __temp__profil'); + } +} diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 8c26f0b..e0138c4 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -29,6 +29,7 @@ class RegistrationController extends AbstractController $form->get('plainPassword')->getData() ) ); + $user->setRoles(['ROLE_USER']); $entityManager->persist($user); $entityManager->flush(); diff --git a/src/Entity/Profil.php b/src/Entity/Profil.php index 4647d0e..18a493d 100644 --- a/src/Entity/Profil.php +++ b/src/Entity/Profil.php @@ -19,6 +19,7 @@ class Profil implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\Column] private ?int $id = null; + #[ORM\Column(type: 'json', nullable: true)] private array $roles = []; #[ORM\Column(length: 255, nullable: true)] @@ -184,7 +185,7 @@ class Profil implements UserInterface, PasswordAuthenticatedUserInterface { $roles = $this->roles; // guarantee every user at least has ROLE_USER - $roles[] = 'ROLE_USER'; + // $roles[] = 'ROLE_USER'; return array_unique($roles); } @@ -192,17 +193,16 @@ class Profil implements UserInterface, PasswordAuthenticatedUserInterface public function setRoles(array $roles): self { $this->roles = $roles; - return $this; } - public function eraseCredentials(): void + public function getUserIdentifier(): string { - // TODO: Implement eraseCredentials() method. + return $this->name; } - public function getUserIdentifier(): string + public function eraseCredentials(): void { - return $this->name; + // TODO: Implement eraseCredentials() method. } } diff --git a/src/Repository/TagsRepository.php b/src/Repository/TagsRepository.php index 5116b48..01f3452 100644 --- a/src/Repository/TagsRepository.php +++ b/src/Repository/TagsRepository.php @@ -9,7 +9,7 @@ use Doctrine\Persistence\ManagerRegistry; /** * @extends ServiceEntityRepository */ -class agsRepository extends ServiceEntityRepository +class TagsRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { -- 2.36.3 From 2981f73c0a29191fa2a35e88d781f308cd7d6258 Mon Sep 17 00:00:00 2001 From: "aurian.jault" Date: Wed, 12 Jun 2024 17:06:21 +0200 Subject: [PATCH 6/6] changed database --- migrations/Version20240612121601.php | 35 +++++++++++++++++++++++++++ var/data.db | Bin 98304 -> 102400 bytes 2 files changed, 35 insertions(+) create mode 100644 migrations/Version20240612121601.php diff --git a/migrations/Version20240612121601.php b/migrations/Version20240612121601.php new file mode 100644 index 0000000..f40fbff --- /dev/null +++ b/migrations/Version20240612121601.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil'); + $this->addSql('DROP TABLE profil'); + $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); + $this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil'); + $this->addSql('DROP TABLE __temp__profil'); + } +} diff --git a/var/data.db b/var/data.db index 2101675596f80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