diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..de75220
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,13 @@
+{
+ "require": {
+ "twig/twig": "^3.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Controleu\\": "src/Controleur/",
+ "config\\": "config/",
+ "Model\\": "src/Model/",
+ "Entity\\": "src/Entity/"
+ }
+ }
+}
\ No newline at end of file
diff --git a/config/autoload.php b/config/autoload.php
deleted file mode 100644
index 473ed0f..0000000
--- a/config/autoload.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
\ No newline at end of file
diff --git a/config/config.php b/config/config.php
index 32da453..9ffcef9 100644
--- a/config/config.php
+++ b/config/config.php
@@ -13,15 +13,33 @@ $base = 'dbkemondejar';
$login = '';
$mdp = '';
-//Vues
-$vues['erreur'] = 'views/erreur.php';
-$vues['accueil'] = 'views/accueil.php';
-$vues['bandeau'] = 'views/HeaderView.php';
-$vues['citation']= 'views/CitationView.php';
+//Entitées
+$entity['user'] = 'src/Entity/userEntity';
+$entity['quote'] = 'src/Entity/quoteEntity';
+$entity['question'] = 'src/Entity/questionEntity';
+
+//Model
+$model['user'] = 'src/Model/userModel.php';
+$model['quote'] = 'src/Model/quoteModel.php';
+
+//Gateway
+$gateway['user'] = 'src/Gateway/userGateway';
+$gateway['quote'] = 'src/Gateway/quoteGateway';
-$model['citation'] = 'models/CitationModel.php';
+//Controleur
+
+//Vues
+$vues['erreur'] = 'vue/erreur.php';
+
+//Style css
$style['accueil'] = 'public/styles/styleAccueil.css';
+//Script js
+
+
+//Images
+$image['default'] = 'public/images/default.jpg';
+
?>
\ No newline at end of file
diff --git a/public/images/Boromir.jpg b/public/images/Boromir.jpg
new file mode 100644
index 0000000..6e4719d
Binary files /dev/null and b/public/images/Boromir.jpg differ
diff --git a/public/images/Dark_Vador.jpg b/public/images/Dark_Vador.jpg
new file mode 100644
index 0000000..9336947
Binary files /dev/null and b/public/images/Dark_Vador.jpg differ
diff --git a/public/images/Drago_Malefoy.jpg b/public/images/Drago_Malefoy.jpg
new file mode 100644
index 0000000..382e316
Binary files /dev/null and b/public/images/Drago_Malefoy.jpg differ
diff --git a/public/images/Dumbledore.jpg b/public/images/Dumbledore.jpg
new file mode 100644
index 0000000..45f35ab
Binary files /dev/null and b/public/images/Dumbledore.jpg differ
diff --git a/public/images/Frodon.jpg b/public/images/Frodon.jpg
new file mode 100644
index 0000000..4ceaa55
Binary files /dev/null and b/public/images/Frodon.jpg differ
diff --git a/public/images/Gandalf.jpg b/public/images/Gandalf.jpg
new file mode 100644
index 0000000..a1e68b8
Binary files /dev/null and b/public/images/Gandalf.jpg differ
diff --git a/public/images/Gimli.jpg b/public/images/Gimli.jpg
new file mode 100644
index 0000000..e4c4528
Binary files /dev/null and b/public/images/Gimli.jpg differ
diff --git a/public/images/Ginny_Weasley.jpg b/public/images/Ginny_Weasley.jpg
new file mode 100644
index 0000000..c907227
Binary files /dev/null and b/public/images/Ginny_Weasley.jpg differ
diff --git a/public/images/Gollum.jpg b/public/images/Gollum.jpg
new file mode 100644
index 0000000..62a6519
Binary files /dev/null and b/public/images/Gollum.jpg differ
diff --git a/public/images/Harry.jpg b/public/images/Harry.jpg
new file mode 100644
index 0000000..8379435
Binary files /dev/null and b/public/images/Harry.jpg differ
diff --git a/public/images/Hermione.jpg b/public/images/Hermione.jpg
new file mode 100644
index 0000000..b56846b
Binary files /dev/null and b/public/images/Hermione.jpg differ
diff --git a/public/images/Kylo_Ren.jpg b/public/images/Kylo_Ren.jpg
new file mode 100644
index 0000000..5c5f90f
Binary files /dev/null and b/public/images/Kylo_Ren.jpg differ
diff --git a/public/images/Legolas.jpg b/public/images/Legolas.jpg
new file mode 100644
index 0000000..473624b
Binary files /dev/null and b/public/images/Legolas.jpg differ
diff --git a/public/images/Leia.jpg b/public/images/Leia.jpg
new file mode 100644
index 0000000..b373167
Binary files /dev/null and b/public/images/Leia.jpg differ
diff --git a/public/images/Logo.png b/public/images/Logo.png
new file mode 100644
index 0000000..39faaa4
Binary files /dev/null and b/public/images/Logo.png differ
diff --git a/public/images/Lord_Voldemort.jpg b/public/images/Lord_Voldemort.jpg
new file mode 100644
index 0000000..a7805b6
Binary files /dev/null and b/public/images/Lord_Voldemort.jpg differ
diff --git a/public/images/Luke.jpg b/public/images/Luke.jpg
new file mode 100644
index 0000000..ca42e19
Binary files /dev/null and b/public/images/Luke.jpg differ
diff --git a/public/images/Obi-Wan.jpg b/public/images/Obi-Wan.jpg
new file mode 100644
index 0000000..8dbcc62
Binary files /dev/null and b/public/images/Obi-Wan.jpg differ
diff --git a/public/images/Qui-Gon_Jinn.jpg b/public/images/Qui-Gon_Jinn.jpg
new file mode 100644
index 0000000..56ef6f5
Binary files /dev/null and b/public/images/Qui-Gon_Jinn.jpg differ
diff --git a/public/images/Remus_Lupin.jpg b/public/images/Remus_Lupin.jpg
new file mode 100644
index 0000000..86ddcb9
Binary files /dev/null and b/public/images/Remus_Lupin.jpg differ
diff --git a/public/images/Rey.jpg b/public/images/Rey.jpg
new file mode 100644
index 0000000..94f3705
Binary files /dev/null and b/public/images/Rey.jpg differ
diff --git a/public/images/Sam.jpg b/public/images/Sam.jpg
new file mode 100644
index 0000000..eb4abe7
Binary files /dev/null and b/public/images/Sam.jpg differ
diff --git a/public/images/Sirius_Black.jpg b/public/images/Sirius_Black.jpg
new file mode 100644
index 0000000..6a6f799
Binary files /dev/null and b/public/images/Sirius_Black.jpg differ
diff --git a/public/images/WIKIFANTASY.png b/public/images/WIKIFANTASY.png
new file mode 100644
index 0000000..2dffdee
Binary files /dev/null and b/public/images/WIKIFANTASY.png differ
diff --git a/public/images/Yoda.jpg b/public/images/Yoda.jpg
new file mode 100644
index 0000000..de57e57
Binary files /dev/null and b/public/images/Yoda.jpg differ
diff --git a/public/images/coeur.svg b/public/images/coeur.svg
new file mode 100644
index 0000000..4ac9bb7
--- /dev/null
+++ b/public/images/coeur.svg
@@ -0,0 +1,3 @@
+
diff --git a/public/images/dark.svg b/public/images/dark.svg
new file mode 100644
index 0000000..442157b
--- /dev/null
+++ b/public/images/dark.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/public/images/drapeauFrance.png b/public/images/drapeauFrance.png
new file mode 100644
index 0000000..f6de078
Binary files /dev/null and b/public/images/drapeauFrance.png differ
diff --git a/public/images/iconeClaire.ico b/public/images/iconeClaire.ico
new file mode 100644
index 0000000..87a6e54
Binary files /dev/null and b/public/images/iconeClaire.ico differ
diff --git a/public/images/iconeSombre.ico b/public/images/iconeSombre.ico
new file mode 100644
index 0000000..5710f06
Binary files /dev/null and b/public/images/iconeSombre.ico differ
diff --git a/public/images/imageProfil.png b/public/images/imageProfil.png
new file mode 100644
index 0000000..2515991
Binary files /dev/null and b/public/images/imageProfil.png differ
diff --git a/public/images/light.svg b/public/images/light.svg
new file mode 100644
index 0000000..ad790ed
--- /dev/null
+++ b/public/images/light.svg
@@ -0,0 +1,10 @@
+
diff --git a/public/images/modify.svg b/public/images/modify.svg
new file mode 100644
index 0000000..98fbe6f
--- /dev/null
+++ b/public/images/modify.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/images/numerobis.jpeg b/public/images/numerobis.jpeg
new file mode 100644
index 0000000..144d17f
Binary files /dev/null and b/public/images/numerobis.jpeg differ
diff --git a/public/images/quizz.svg b/public/images/quizz.svg
new file mode 100644
index 0000000..4b7c2c3
--- /dev/null
+++ b/public/images/quizz.svg
@@ -0,0 +1,3 @@
+
diff --git a/public/images/tyler.jpg b/public/images/tyler.jpg
new file mode 100644
index 0000000..7f511c6
Binary files /dev/null and b/public/images/tyler.jpg differ
diff --git a/public/images/user_dark.png b/public/images/user_dark.png
new file mode 100644
index 0000000..0b8974e
Binary files /dev/null and b/public/images/user_dark.png differ
diff --git a/public/images/vador.webp b/public/images/vador.webp
new file mode 100644
index 0000000..006c5de
Binary files /dev/null and b/public/images/vador.webp differ
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..253993e
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,16 @@
+ 'cache',
+]);
+
+$cont = new FrontControleur();
+
+?>
\ No newline at end of file
diff --git a/public/pages/.DS_Store b/public/pages/.DS_Store
deleted file mode 100644
index 9dac593..0000000
Binary files a/public/pages/.DS_Store and /dev/null differ
diff --git a/public/script/afficheQuote.php b/public/script/afficheQuote.php
deleted file mode 100644
index e018a0e..0000000
--- a/public/script/afficheQuote.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
-query("SELECT *
-# FROM utilisateur
-# WHERE nom LIKE ?
-# LIMIT 10",
-# array("$user%"));
-#
-#$req = $req->fetchALL();
-$req=query(array('nom'=>'nom1','prenom'=>'prenom1'),array('nom'=>'nom2','prenom'=>'prenom2'),array('nom'=>'nom3','prenom'=>'prenom3'));
-$req = $req->fetchALL();
-
-foreach($req as $r){
- ?>
-
= $r['nom'] . " " . $r['prenom'] ?>
\ No newline at end of file
diff --git a/public/script/comment.php b/public/script/comment.php
deleted file mode 100644
index e69de29..0000000
diff --git a/public/script/signin.php b/public/script/signin.php
deleted file mode 100644
index 15c5adc..0000000
--- a/public/script/signin.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/src/Controleur/FrontControleur.php b/src/Controleur/FrontControleur.php
new file mode 100644
index 0000000..078717f
--- /dev/null
+++ b/src/Controleur/FrontControleur.php
@@ -0,0 +1,32 @@
+map('GET', '/', 'FrontController');
+ $router->map('GET', '/user/quote/[p1:param1]?', 'UserController');
+
+ $match = $routeur->match();
+ if(!$match){
+ $dVueEreur[] = "Requette introuvable";
+ $this->vueErreur($dVueEreur);
+ }
+ else{
+
+ }
+
+
+ }
+
+ private function vueErreur(array $dVueErreur){
+
+ }
+}
\ No newline at end of file
diff --git a/src/Entity/characterEntity.php b/src/Entity/characterEntity.php
new file mode 100644
index 0000000..bac366e
--- /dev/null
+++ b/src/Entity/characterEntity.php
@@ -0,0 +1,46 @@
+ id_character = $id_character;
+ $this -> name = $name;
+ $this -> img_path = $img_path;
+ }
+
+ public function getIdCharacter() : int
+ {
+ return $this -> id_character;
+ }
+ public function getName() : string
+ {
+ return $this -> name;
+ }
+ public function getImgPath() : string
+ {
+ return $this -> img_path;
+ }
+
+ public function setIdCharacter(int $id_character) : void
+ {
+ $this -> id_character = $id_character;
+ }
+ public function setName(string $name) : void
+ {
+ $this -> name = $name;
+ }
+ public function setImgPath(string $img_path) : void
+ {
+ $this -> img_path = $img_path;
+ }
+
+}
+
diff --git a/src/Entity/commentaryEntity.php b/src/Entity/commentaryEntity.php
new file mode 100644
index 0000000..ccd8f1a
--- /dev/null
+++ b/src/Entity/commentaryEntity.php
@@ -0,0 +1,39 @@
+id_comment = $id_comment;
+ $this->comment = $comment;
+ $this->date = $date;
+ }
+
+ public function getIdComment(): int {
+ return $this->id_comment;
+ }
+ public function getComment(): string {
+ return $this->comment;
+ }
+ public function getDate(): string {
+ return $this->date;
+ }
+
+ public function setIdComment(int $id_comment): void {
+ $this->id_comment = $id_comment;
+ }
+
+ public function setComment(string $comment): void {
+ $this->comment = $comment;
+ }
+
+ public function setDate(string $date): void {
+ $this->date = $date;
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/Entity/questionEntity.php b/src/Entity/questionEntity.php
new file mode 100644
index 0000000..6b3dcc9
--- /dev/null
+++ b/src/Entity/questionEntity.php
@@ -0,0 +1,88 @@
+ id_question = $id_question;
+ $this -> question = $question;
+ $this -> answerA = $answerA;
+ $this -> answerB = $answerB;
+ $this -> answerC = $answerC;
+ $this -> answerD = $answerD;
+ $this -> cAnswer = $cAnswer;
+ }
+
+ public function getIdQuestion() : int
+ {
+ return $this -> id_question;
+ }
+
+ public function getQuestion() : string
+ {
+ return $this -> question;
+ }
+
+ public function getAnswerA() : string
+ {
+ return $this -> answerA;
+ }
+
+ public function getAnswerB() : string
+ {
+ return $this -> answerB;
+ }
+
+ public function getAnswerC() : string
+ {
+ return $this -> answerC;
+ }
+
+ public function getAnswerD() : string
+ {
+ return $this -> answerD;
+ }
+
+ public function getCAnswer() : string
+ {
+ return $this -> cAnswer;
+ }
+
+ public function setQuestion(string $newQuestion) : void
+ {
+ $this -> question = $question;
+ }
+
+ public function setAnswerA(string $newAnswerA) : void
+ {
+ $this -> answerA = $newAnswerA;
+ }
+
+ public function setAnswerB(string $newAnswerB) : void
+ {
+ $this -> answerB = $newAnswerB;
+ }
+
+ public function setAnswerC(string $newAnswerC) : void
+ {
+ $this -> answerC = $newAnswerC;
+ }
+
+ public function setAnswerD(string $newAnswerD) : void
+ {
+ $this -> answerD = $newAnswerD;
+ }
+
+ public function setCAnswer(string $newCAnswer) : void
+ {
+ $this -> cAnswer = $newCAnswer;
+ }
+ }
\ No newline at end of file
diff --git a/src/Entity/quoteEntity.php b/src/Entity/quoteEntity.php
new file mode 100644
index 0000000..02d6851
--- /dev/null
+++ b/src/Entity/quoteEntity.php
@@ -0,0 +1,89 @@
+id = $id;
+ $this->content = $content;
+ $this->carac = $carac;
+ $this->imgPath = $imgPath;
+ $this->titleSrc = $titleSrc;
+ $this->dateSrc = $dateSrc;
+ $this->like = $like;
+ $this->langue = $langue;
+ }
+
+ public function getId() : int{
+ return $id;
+ }
+
+ public function getContent() : string{
+ return $content;
+ }
+
+ public function getCarac() : string{
+ return $content;
+ }
+
+ public function getImgPath() : string{
+ return $imgPath;
+ }
+
+ public function getTitleSrc() : string{
+ return $titleSrc;
+ }
+
+ public function getDateSrc() : string{
+ return $dateSrc;
+ }
+
+ public function getLike() : int{
+ return $like;
+ }
+
+ public function getLangue() : string{
+ return $langue;
+ }
+
+ public function setId(int $id){
+ $this->id = $id;
+ }
+
+ public function setContent(string $content){
+ $this->content = $content;
+ }
+
+ public function setCarac(string $carac){
+ $this->carac = $carac;
+ }
+
+ public function setImgPath(string $imgPat){
+ $this->imgPath = $imgPath;
+ }
+
+ public function setTitleSrc(string $titleSrc){
+ $this->titleSrc = $titleSrc;
+ }
+
+ public function setDateSrc(string $dateSrc){
+ $this->datesrc = $dateSrc;
+ }
+
+ public function setLike(int $like){
+ $this->like = $like;
+ }
+
+ public function setlangue(string $langue){
+ $this->langue = $langue;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/src/Entity/sourceEntity.php b/src/Entity/sourceEntity.php
new file mode 100644
index 0000000..5a983d5
--- /dev/null
+++ b/src/Entity/sourceEntity.php
@@ -0,0 +1,47 @@
+ id_source = $id_source ;
+ $this -> title = $title ;
+ $this -> date = $date;
+ }
+
+ public function getIdSource() : int
+ {
+ return $this -> id_source ;
+ }
+
+ public function getTitle() : string
+ {
+ return $this -> title ;
+ }
+
+ public function getDate() : string
+ {
+ return $this -> date ;
+ }
+
+ public function setIdSource(int $id_source) : void
+ {
+ $this -> id_source = $id_source ;
+ }
+
+ public function setTitle(string $title): void{
+ $this -> title = $title ;
+ }
+
+ public function setDate(string $date) : void
+ {
+ $this -> date = $date ;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Entity/userEntity.php b/src/Entity/userEntity.php
new file mode 100644
index 0000000..9315392
--- /dev/null
+++ b/src/Entity/userEntity.php
@@ -0,0 +1,64 @@
+id = $id;
+ $this->username = $pseudo;
+ $this->passwd = $password;
+ $this->hidenPasswd = hidenPassWd($password);
+ $this->img = $image;
+ $this->email = $mail;
+ }
+
+ public function getId() : string{
+ return $this->id;
+ }
+
+ public function getUsername() : string{
+ return $this->username;
+ }
+
+ public function getPasswd() : string{
+ return $this->passwd;
+ }
+
+ public function getImg() : string{
+ return $this->img;
+ }
+
+ public function getEmail() : string{
+ return $this->email;
+ }
+
+ public function setUsername(string $username){
+ $this->username = $username;
+ }
+
+ public function setPasswd(string $passwd){
+ $this->passwd = $passwd;
+ $this->hidenPassWd = hidenPassWd($passwd);
+ }
+
+ public function setImg(string $img){
+ $this->img = $img;
+ }
+
+ public function setEmail(string $email){
+ $this->email = $email;
+ }
+ }
+
+
+ function hidenPassWd(string $passwd){
+ if(strlen($passwd) >= 16) return str_repeat('*', 16);
+ return str_repeat('*', strlen($passwd));
+ }
+?>
\ No newline at end of file
diff --git a/src/Gateway/Connection.php b/src/Gateway/Connection.php
new file mode 100644
index 0000000..dfc9f8e
--- /dev/null
+++ b/src/Gateway/Connection.php
@@ -0,0 +1,31 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+
+
+ /** * @param string $query
+ * @param array $parameters *
+ * @return bool Returns `true` on success, `false` otherwise
+ */
+
+ public function executeQuery(string $query, array $parameters = []) : bool{
+ $this->stmt = parent::prepare($query);
+ foreach ($parameters as $name => $value) {
+ $this->stmt->bindValue($name, $value[0], $value[1]);
+ }
+
+ return $this->stmt->execute();
+ }
+
+ public function getResults() : array {
+ return $this->stmt->fetchall();
+ }
+ }
+
+?>
diff --git a/src/Gateway/characterGateway.php b/src/Gateway/characterGateway.php
new file mode 100644
index 0000000..36bf969
--- /dev/null
+++ b/src/Gateway/characterGateway.php
@@ -0,0 +1,105 @@
+ co = $co;
+ }
+
+ public function create(characterEntity $c) : bool
+ {
+ $query = "
+ INSERT INTO Character
+ VALUES(:id_character, :name, :img_path)
+ ";
+
+ return $this -> co -> executeQuery($query, [
+ "id_character" => array($c -> getIdCharacter(), PDO::PARAM_INT),
+ "name" => array($c -> getName(), PDO::PARAM_STR),
+ "img_path" => array($c -> getImgPath(), PDO::PARAM_STR)
+ ]);
+
+ }
+
+ public function findById(int $id) : ?characterEntity
+ {
+ $query = "SELECT * FROM Character WHERE id_character = :id_c";
+
+ $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]);
+ $res = $this ->co -> getResults();
+
+ if($res)
+ return new characterEntity(
+ $res["id_character"],
+ $res["name"],
+ $res["img_path"]
+ );
+ return null;
+ }
+
+ public function findByName(string $name) : ?characterEntity
+ {
+ $query = "SELECT * FROM Character WHERE name = :n";
+
+ $this -> co -> executeQuery($query, ["n" => array($name, PDO::PARAM_STR)]);
+ $res = $this ->co -> getResults();
+
+ if($res)
+ return new characterEntity(
+ $res["id_character"],
+ $res["name"],
+ $res["img_path"]
+ );
+ return null;
+ }
+
+ public function findAll() : array
+ {
+ $query = "SELECT * FROM Character";
+
+ $this -> co -> executeQuery($query);
+ $res = $this ->co -> getResults();
+
+ $characters = [];
+
+ foreach ($res as $character)
+ {
+ $characters[] = new characterEntity(
+ $character["id_character"],
+ $character["name"],
+ $character["img_path"]
+ );
+ }
+ return $characters;
+ }
+
+ public function delete(int $id) : bool
+ {
+ $query = "DELETE FROM Character WHERE id_character = :id_c";
+
+ return $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]);
+ }
+
+ public function update(characterEntity $c) : bool
+ {
+ $query = "
+ UPDATE Character
+ SET name = :n, img_path = :i
+ WHERE id_character = :id_c
+ ";
+
+ return $this -> co -> executeQuery($query, [
+ "id_c" => array($c -> getIdCharacter(), PDO::PARAM_INT),
+ "name" => array($c -> getName(), PDO::PARAM_STR),
+ "i" => array($c -> getImgPath(), PDO::PARAM_STR)
+ ]);
+ }
+
+}
\ No newline at end of file
diff --git a/src/Gateway/commentaryGateway.php b/src/Gateway/commentaryGateway.php
new file mode 100644
index 0000000..4643478
--- /dev/null
+++ b/src/Gateway/commentaryGateway.php
@@ -0,0 +1,68 @@
+co = $co;
+ }
+
+ public function create(commentaryEntity $c) :bool {
+
+ $query="INSERT INTO Commentary VALUES(:id_comment, :comment , :date)";
+
+ return $this -> co -> executeQuery($query, array(
+ "id_comment" => array($c->getIdComment(), PDO::PARAM_INT),
+ "comment" => array($c->getComment(), PDO::PARAM_STR),
+ "date" => array($c->getDate(), PDO::PARAM_STR)));
+ }
+
+ public function findById(int $id) : ?commentaryEntity {
+
+ $query="SELECT * FROM Commentary WHERE id_comment = :id_comment";
+
+ $this -> co -> executeQuery($query, array("id_comment" => $id));
+ $res = $this -> co -> getResults();
+ if($res)
+ return new commentaryEntity($res["id_comment"], $res["comment"], $res["date"]);
+ return null;
+ }
+
+
+ public function findAll() : array {
+ $query="SELECT * FROM Commentary";
+ $this -> co -> executeQuery($query);
+ $res = $this -> co -> getResults();
+
+ $comments = [];
+ foreach ($res as $comment) {
+
+ $comments[] = new commentaryEntity(
+ $comment["id_comment"],
+ $comment["comment"],
+ $comment["date"]
+ );
+ }
+
+ return $comments;
+ }
+
+ public function delete(int $id) : bool {
+ $query="DELETE FROM Commentary WHERE id_comment = :id_comment";
+ return $this -> co -> executeQuery($query, array("id_comment" => $id));
+
+ }
+
+ public function update(commentaryEntity $c) : bool {
+
+ $query="UPDATE Commentary SET comment = :comment WHERE id_comment = :id_comment";
+
+ return $this -> co -> executeQuery($query, array(
+ "comment" => array($c->getComment(),PDO::PARAM_STR),
+ "id_comment" => array($c->getIdComment(),PDO::PARAM_INT))
+ );
+
+ }
+}
\ No newline at end of file
diff --git a/src/Gateway/quoteGateway.php b/src/Gateway/quoteGateway.php
new file mode 100644
index 0000000..a1429f6
--- /dev/null
+++ b/src/Gateway/quoteGateway.php
@@ -0,0 +1,49 @@
+con=$con;
+ }
+
+ public function searchQuote(string $quote,int $numpage,string $language):array{
+
+ //recherche par citation
+ $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE content LIKE '%:quote%' AND isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
+ $this->con->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
+ $result=$this->con->getResults();
+ return $result;
+ }
+
+ public function searchSource(string $source,int $numpage,string $language):array{
+
+ //recherche par source
+ $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE s.title LIKE '%:source%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
+ $this->con->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
+ $result=$this->con->getResults();
+ return $result;
+ }
+
+ public function searchPers(string $Carac,int $numpage,string $language):array{
+
+ //recherche par personnage
+ $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE c.caracter LIKE '%:pers%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
+ $this->con->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
+ $result=$this->con->getResults();
+ return $result;
+ }
+
+ public function getComment(int $id):array{
+
+ //obtention des commentaire d'une citation
+ $query="SELECT c.id_comment u.username, u.imgPath, c.comment, c.date FROM Commentary c JOIN Quote q ON c.quote = q.id_quote JOIN User u ON u.id_user = c.user JOIN Image i ON i.id_img = u.img WHERE id_quote = :id;";
+ $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
+ $result=$this->con->getResults();
+ return $result;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/src/Gateway/sourceGateway.php b/src/Gateway/sourceGateway.php
new file mode 100644
index 0000000..8389526
--- /dev/null
+++ b/src/Gateway/sourceGateway.php
@@ -0,0 +1,116 @@
+ co = $co;
+ }
+
+ public function create(sourceEntity $s) : bool
+ {
+ $query = "
+ INSERT INTO Source
+ VALUES(:id_source, :title, :date)
+ ";
+
+ return $this -> co -> executeQuery($query, [
+ "id_source" => array($s->getIdSource(), PDO::PARAM_INT),
+ "title" => array($s->getTitle(), PDO::PARAM_STR),
+ "date" => array($s->getDate(), PDO::PARAM_STR)
+ ]);
+ }
+
+ public function findById(int $id) : ?sourceEntity
+ {
+ $query = "SELECT * FROM Source WHERE id_source = :id";
+
+ $this -> co -> executeQuery($query, array("id_source" => array($id, PDO::PARAM_INT)));
+ $res = $this -> co -> getResults();
+
+ if ($res)
+ return new sourceEntity(
+ $res["id_source"],
+ $res["title"],
+ $res["date"]
+ );
+ return null;
+ }
+
+ public function findByTitle(string $t) : ?sourceEntity
+ {
+ $query = "SELECT * FROM Source WHERE title = :t";
+
+ $this -> co -> executeQuery($query, ["title" => array($t, PDO::PARAM_STR)]);
+ $res = $this -> co -> getResults();
+
+ if ($res)
+ return new sourceEntity(
+ $res["id_source"],
+ $res["title"],
+ $res["date"]
+ );
+ return null;
+ }
+
+ public function findByDate(string $d) : ?sourceEntity
+ {
+ $query = "SELECT * FROM Source WHERE date = :d";
+
+ $this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]);
+ $res = $this -> co -> getResults();
+
+ if ($res)
+ return new sourceEntity(
+ $res["id_source"],
+ $res["title"],
+ $res["date"]
+ );
+ return null;
+ }
+
+ public function findAll() : array
+ {
+ $query = "SELECT * FROM Source";
+
+ $this -> co -> executeQuery($query);
+ $res = $this -> co -> getResults();
+
+ $sources = [];
+
+ foreach ($res as $source) {
+ $sources[] = new sourceEntity(
+ $source["id_source"],
+ $source["title"],
+ $source["date"]
+ );
+ }
+ return $sources;
+ }
+
+ public function delete(int $id) : bool
+ {
+ $query = "DELETE FROM Source WHERE id_source = :id_s";
+
+ $this -> co -> executeQuery($query, ["id_s" => array($id, PDO::PARAM_INT)]);
+ }
+
+ public function update(sourceEntity $s) : bool
+ {
+ $query = "
+ UPDATE Source
+ SET title = :t, date = :d
+ WHERE id_source = :id_s
+ ";
+ return $this->co->executeQuery($query, [
+ "id_s" => array($s -> getIdSource(), PDO::PARAM_INT),
+ "t" => array($s -> getTitle(), PDO::PARAM_STR),
+ "d" => array($s -> getDate(), PDO::PARAM_STR)
+ ]);
+ }
+
+}
\ No newline at end of file
diff --git a/src/Gateway/userGateway.php b/src/Gateway/userGateway.php
new file mode 100644
index 0000000..b171f43
--- /dev/null
+++ b/src/Gateway/userGateway.php
@@ -0,0 +1,43 @@
+con=$con;
+ }
+
+ public function insert(string $username,string $email,string $passwd):string{
+
+ // récupération id
+ $query='SELECT id_user FROM Users WHERE id_user >= ALL (SELECT id_user FROM Users);';
+ $this->con->executeQuery($query);
+ $result=$this->con->getResults();
+ foreach($result as $row){
+ $id=$row['id_user'] + 1;
+ }
+ // insertion user
+ $query='INSERT INTO Users VALUES (:id,:username,:email,:passwd,CURRENT_DATE,false);';
+ $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR),':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwd,PDO::PARAM_STR)));
+ return $id;
+ }
+
+ public function delete(string $id) : bool{
+
+ // supretion user
+ $query='DELETE FROM Users WHERE id_user = :id;';
+ return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
+ }
+
+ public function getFavorite(string $id):array{
+
+ //obtention favoris d'un user
+ $query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);';
+ $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
+ $result=$this->con->getResults();
+ return $result;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/src/Model/characterModel.php b/src/Model/characterModel.php
new file mode 100644
index 0000000..a9769b0
--- /dev/null
+++ b/src/Model/characterModel.php
@@ -0,0 +1,54 @@
+ gateway = $gateway;
+ }
+
+ public function createCharacter(int $id_character, string $name , string $img_path) : bool
+ {
+ $q = new CharacterEntity($id_character, $name, $img_path);
+
+ return $this -> gateway -> create($q);
+ }
+ public function getCharacterById(int $id_character) : ?CharacterEntity
+ {
+ return $this -> gateway -> findById($id_character);
+ }
+
+ public function getCharacterByName(string $name) : ?CharacterEntity
+ {
+ return $this -> gateway -> findByName($name);
+ }
+
+ public function getAllCharacters() : array
+ {
+ return $this -> gateway -> findAll();
+ }
+
+ public function deleteCharacter(int $id_character) : bool
+ {
+ return $this -> gateway -> delete($id_character);
+ }
+
+ public function updateCharacter(int $id_character, string $name, string $img_path) : bool
+ {
+ $q = $this -> gateway -> findById($id_character);
+
+ if($q){
+ $q -> setName($name);
+ $q -> setImgPath($img_path);
+ return $this -> gateway -> update($q);
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Model/commentaryModel.php b/src/Model/commentaryModel.php
new file mode 100644
index 0000000..c104f9b
--- /dev/null
+++ b/src/Model/commentaryModel.php
@@ -0,0 +1,42 @@
+gw = $gw;
+ }
+
+ public function createComment(int $id_comment, string $comment, string $date): bool {
+
+ $c = new CommentaryEntity($id_comment, $comment, $date);
+ return $this->gw->create($c);
+ }
+
+ public function getComment(int $id_comment): ?commentaryEntity {
+ return $this -> gw -> findById($id_comment);
+ }
+
+ public function getComments(): array {
+ return $this -> gw -> findAll();
+ }
+
+ public function deleteComment(int $id_comment): bool {
+ return $this -> gw -> delete($id_comment);
+ }
+
+ public function updateComment(int $id_comment, string $comment): bool {
+
+ $c = $this -> gw -> findById($id_comment);
+
+ if($c){
+ $c -> setComment($comment);
+ return $this->gw -> update($c);
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Model/quoteModel.php b/src/Model/quoteModel.php
new file mode 100644
index 0000000..99827b3
--- /dev/null
+++ b/src/Model/quoteModel.php
@@ -0,0 +1,19 @@
+gateway = $gate;
+ }
+
+ public function searchQuote(string $quote,int $numpage,string $language) : Quote{
+ $res = $this->gateway->searchQuote($quote,$numpage,$language);
+ return new Quote($res[0]['']);
+ }
+ }
+
+?>
\ No newline at end of file
diff --git a/src/Model/sourceModel.php b/src/Model/sourceModel.php
new file mode 100644
index 0000000..4a4a7e2
--- /dev/null
+++ b/src/Model/sourceModel.php
@@ -0,0 +1,61 @@
+ gateway = $gateway;
+ }
+
+ public function createSource(int $id_source, string $title, string $date) : bool
+ {
+ $q = new SourceEntity($id_source , $title, $date);
+
+ return $this -> gateway -> create($q);
+ }
+
+ public function getSourceById(int $id_source) : ?SourceEntity
+ {
+ return $this -> gateway -> findById($id_source);
+ }
+
+ public function getSourceByTitle(string $title) : ?SourceEntity
+ {
+ return $this -> gateway -> findByTitle($title);
+ }
+
+ public function getSourceByDate(string $date) : ?SourceEntity
+ {
+ return $this -> gateway -> findByDate($date);
+ }
+
+ public function getSources() : array
+ {
+ return $this -> gateway -> findAll();
+ }
+
+ public function deleteSource(int $id_source) : bool
+ {
+ return $this -> gateway -> delete($id_source);
+ }
+
+ public function updateSource(int $id_source, string $title, string $date) : bool
+ {
+ $q = $this -> gateway -> findById($id_source);
+
+ if ($q){
+ $q -> setTitle($title);
+ $q -> setDate($date);
+ return $this -> gateway -> update($q);
+ }
+ return false;
+ }
+
+}
+
diff --git a/src/Model/userModel.php b/src/Model/userModel.php
new file mode 100644
index 0000000..92251bc
--- /dev/null
+++ b/src/Model/userModel.php
@@ -0,0 +1,33 @@
+gateway = $gate;
+ }
+
+ public function insertUser(string $username,string $email,string $passwd) : User{
+ global $rep,$image;
+ $id = $this->gateway->insert($username,$email,$passwd);
+ $u = new User($id,$usename,$passwd,$rep.$image['default'],$email);
+ }
+
+ public function deletUser(string $id) : bool{
+ return $this->gateway->delete($id);
+ }
+
+ // public function getFavoriteUser(string $id) : array{
+ // $res = array();
+ // $data = $this->gateway->getFavorite($id);
+ // foreach ($data as $favoris) {
+ // $res[] = new Quote();
+ // }
+ // }
+ }
+
+?>
\ No newline at end of file
diff --git a/src/user.txt b/src/user.txt
deleted file mode 100644
index 44492d5..0000000
--- a/src/user.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-TesteurFichier
-motDepasseFichier
-../images/imageProfil.png
-testeurFichier.compte@wikifantasy.com
\ No newline at end of file
diff --git a/vue/CitationView.php b/vue/CitationView.php
new file mode 100644
index 0000000..4b26bf2
--- /dev/null
+++ b/vue/CitationView.php
@@ -0,0 +1,64 @@
+";
+
+ // Afficher la citation du jour
+ if ($citationDuJour) {
+ $quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ
+ $movie = htmlspecialchars(trim($citationDuJour[2]));
+ $character = htmlspecialchars(trim($citationDuJour[3]));
+ $year = htmlspecialchars(trim($citationDuJour[4]));
+ $imagePath = htmlspecialchars(trim($citationDuJour[5]));
+
+ echo "
Citation du jour
";
+ echo "
";
+ echo "";
+ echo "
";
+ echo "
\"$quote\"
";
+ echo "
- $movie
";
+ echo "
Personnage : $character
";
+ echo "
Année : $year
";
+ echo "
";
+ echo "
";
+ } else {
+ echo "
Aucune citation du jour n'a été trouvée.
";
+ }
+
+ // Filtrer les suggestions pour éviter de reprendre la citation du jour
+ $filteredSuggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) {
+ // Vérifie que les deux citations ne sont pas identiques
+ return isset($suggestion[0]) && trim($suggestion[0]) !== trim($citationDuJour[1]);
+ });
+
+ // Afficher les suggestions
+ if (!empty($filteredSuggestions)) {
+ echo "
Suggestions
";
+ echo "
"; // Conteneur pour gérer les colonnes
+ foreach ($filteredSuggestions as $suggestion) {
+ // Vérifier si tous les éléments requis sont bien présents dans $suggestion
+ $quote = isset($suggestion[0]) ? htmlspecialchars(trim($suggestion[0])) : '';
+ $movie = isset($suggestion[1]) ? htmlspecialchars(trim($suggestion[1])) : '';
+ $character = isset($suggestion[2]) ? htmlspecialchars(trim($suggestion[2])) : 'Inconnu';
+ $year = isset($suggestion[3]) ? htmlspecialchars(trim($suggestion[3])) : 'Inconnue';
+ $imagePath = isset($suggestion[4]) ? htmlspecialchars(trim($suggestion[4])) : 'images/default.jpg';
+
+ echo "
";
+ echo "";
+ echo "
";
+ echo "
\"$quote\"
";
+ echo "
- $movie
";
+ echo "
- Personnage : $character
";
+ echo "
- Année : $year
";
+ echo "
";
+ echo "
";
+ }
+ echo "
"; // Fin du conteneur suggestions
+ }
+
+ echo ""; // Fin de la section des citations
+ echo "