diff --git a/.DS_Store b/.DS_Store index 754d560..91512b4 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/composer.json b/composer.json index 5174d0b..40799b2 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,9 @@ "Controleur\\": "src/Controleur/", "Model\\": "src/Model/", "Gateway\\": "src/Gateway/", - "Entity\\": "src/Entity/" + "Entity\\": "src/Entity/", + "Verification\\": "src/Verification/", + "Enum\\": "src/Enum" } } } diff --git a/config/config.php b/config/config.php index 2c604be..322a129 100644 --- a/config/config.php +++ b/config/config.php @@ -12,7 +12,7 @@ $base = ''; $login = ''; $mdp = ''; -$racine='/~kemondejar/WF-Website'; +$racine='/~lebeaulato/WF-Website'; // /~kekentin/WF/WF-Website //Vues @@ -27,6 +27,7 @@ $vues['favorite'] = 'vue/favorits.php'; $vues['quiz'] = 'vue/quiz.php'; $vues['endQuiz'] = 'vue/endQuiz.php'; +$vues['submitQuote'] = 'vue/submitQuote.php'; //Style css diff --git a/index.php b/index.php index a0bc58c..cdbd6fb 100644 --- a/index.php +++ b/index.php @@ -13,10 +13,9 @@ if(!isset($_SESSION['theme'])){ //chargement config require_once __DIR__ . '/config/config.php'; - require __DIR__ . '/vendor/autoload.php'; -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd');// ('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd') //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/public/script/changeData.js b/public/script/changeData.js index e76bb9f..b270748 100644 --- a/public/script/changeData.js +++ b/public/script/changeData.js @@ -1,97 +1,70 @@ +var racine = '/~lebeaulato/WF-Website'; //Mettre votre chemin à vous + +//=============================== USERNAME =============================== function editFieldUsername(id) { - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

+ var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant + var currentValue = pElement.textContent.trim(); // Obtenir le texte actuel du

// Créer un champ de saisie avec la valeur actuelle var input = document.createElement('input'); input.type = 'text'; - input.value = currentValue - input.class = 'changeValue'; - - input.setAttribute('onblur', 'saveFieldUsername("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus + input.value = currentValue; + input.class ='changeValue'; + input.name='pseudo'; + - // Remplacer le

par le champ + // Créer un bouton de validation + var button = document.createElement('button'); + button.textContent = 'Valider'; + button.classList.add('saveButtonPasswd'); + button.type ="submit"; + + // Remplacer le contenu du

par le champ et le bouton pElement.innerHTML = ''; pElement.appendChild(input); - - input.focus(); // Mettre le focus sur le champ de saisie -} + pElement.appendChild(button); -//Sauvegarder les changements sur la vue pour le username -function saveFieldUsername(id, newValue) { - if (id === 'username') { - if (newValue.trim() === "") { - alert('Le nom d\'utilisateur ne peut pas être vide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si le nom d'utilisateur est vide - } - } - - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - // Mettre à jour la valeur avec la nouvelle saisie - pElement.innerHTML = '' + newValue + ' '; + input.focus(); // Mettre le focus sur le champ de saisie } +//=============================== EMAIL =============================== function editFieldEmail(id) { - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

+ var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant + var currentValue = pElement.textContent.trim(); // Obtenir le texte actuel du

// Créer un champ de saisie avec la valeur actuelle var input = document.createElement('input'); input.type = 'email'; - input.value = currentValue - input.class = 'changeValue'; - - input.setAttribute('onblur', 'saveFieldEmail("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus - - // Remplacer le

par le champ - pElement.innerHTML = ''; - pElement.appendChild(input); - - input.focus(); // Mettre le focus sur le champ de saisie -} - -//Sauvegarder les changements sur la vue pour l'email -function saveFieldEmail(id, newValue) { - if (id === 'email') { - if (!validateEmail(newValue)) { - alert('Adresse email invalide. Veuillez entrer un email valide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si l'email n'est pas valide - } - } - + input.value = currentValue; + input.class= 'changeValue'; // Correction de l'attribut 'class' + input.name='email'; - var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant - - // Mettre à jour la valeur avec la nouvelle saisie - pElement.innerHTML = '' + newValue + ' '; -} + // Créer un bouton de validation + var button = document.createElement('button'); + button.textContent = 'Valider'; + button.classList.add('saveButtonPasswd'); + button.type ="submit"; + // Remplacer le contenu du

par le champ et le bouton + pElement.innerHTML = ''; + pElement.appendChild(input); + pElement.appendChild(button); -//Email valide -function validateEmail(email) { - var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;// Regex pour vérifier le format de l'email - return re.test(String(email).toLowerCase()); + input.focus(); // Mettre le focus sur le champ de saisie } - - - +//=============================== PASSWORD =============================== function editFieldPassWd(id) { var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - pElement.innerHTML = '';// Effacer le contenu actuel de

pour insérer les inputs // Créer le champ de saisie pour le nouveau mot de passe @@ -101,7 +74,8 @@ function editFieldPassWd(id) { inputNewPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input inputNewPass.setAttribute('id', 'newPassword'); // Ajouter un ID pour la gestion inputNewPass.classList.add('inputPasswd'); // Ajouter une classe au input - + inputNewPass.name='passwdFirst'; + // Créer le champ de saisie pour la confirmation du mot de passe var inputConfirmPass = document.createElement('input'); @@ -110,16 +84,13 @@ function editFieldPassWd(id) { inputConfirmPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input inputConfirmPass.setAttribute('id', 'confirmPassword'); // Ajouter un ID pour la gestion inputConfirmPass.classList.add('inputPasswd'); // Ajouter une classe au input - + inputConfirmPass.name='passwdSecond'; + // Ajouter un bouton de sauvegarde var saveButton = document.createElement('button'); saveButton.textContent = 'Sauvegarder le mot de passe'; saveButton.classList.add('saveButtonPasswd'); // Ajouter une classe au bouton - - saveButton.onclick = function() { - savePasswordFields(id, inputNewPass.value, inputConfirmPass.value); - - }; + saveButton.type="submit"; // Ajouter les deux champs de saisie et le bouton dans l'élément

pElement.appendChild(inputNewPass); @@ -129,30 +100,4 @@ function editFieldPassWd(id) { pElement.appendChild(saveButton); inputNewPass.focus();// Mettre le focus sur le premier champ de saisie -} - - - -function savePasswordFields(id, newPassword, confirmPassword) { - // Vérification si les champs sont vides - if (newPassword.trim() === "" || confirmPassword.trim() === ""){ - alert("Le mot de passe n'a pas changé"); - } - - // Vérification de la correspondance des deux mots de passe - if (newPassword === confirmPassword) { - - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - - - // Remplacer les champs input par le texte masqué - pElement.innerHTML ='Votre mot de passe'; - alert('Mot de passe mis à jour avec succès'); - - // fonction pour envoyer les nouveaux mots de passe au serveur - - } else { - alert('Les mots de passe ne correspondent pas.'); - } -} +} \ No newline at end of file diff --git a/public/styles/styleSubmitQuote.css b/public/styles/styleSubmitQuote.css new file mode 100644 index 0000000..98ee5cd --- /dev/null +++ b/public/styles/styleSubmitQuote.css @@ -0,0 +1,57 @@ +@import url(./style.css); + +@import url('https://fonts.googleapis.com/css2?family=Lemon&display=swap'); + +body, html { + height: 100%; + overflow: hidden; +} + +/* ====== DARK MODE ====== */ +body.dark-mode h1, body.dark-mode h2, body.dark-mode p { + color: white; + font-family: "Lemon", serif; + text-align: center; +} + + +/* ====== LIGHT MODE ====== */ +body.light-mode h1, body.light-mode h2, body.light-mode p { + color: black; + font-family: "Lemon", serif; + text-align: center; +} + + +/* ====== OTHER ====== */ + + + + +#form { + width: 80%; + height: 83%; + display: flex; + justify-content: center; + align-items: center; +} + +body.dark-mode #box { + background-color: #1b0048; + padding: 20px; + width: 50%; + margin: auto; + border-radius: 15px; + border: 1px solid #6100ff; +} + + +/* ====== DIVERS ====== */ +#contentField, #characterField, #sourceField, #imageField { +} + +#contentField p, #characterField p, #sourceField p, #imageField p { +} + +#confirm { +} \ No newline at end of file diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index 42fae8d..ab3cb62 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -9,11 +9,14 @@ Class FrontControler{ private Connection $co; + /** + * @throws \Exception + */ public function __construct($co){ global $twig,$racine; $this->listAction = ['visitor' => array('accueil','search','quote','login','signin','validlogin','validsignin'), - 'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav'), + 'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit'), 'admin' => array('null')]; $dVueEreur = []; @@ -44,9 +47,12 @@ Class FrontControler{ $router->map('GET|POST', '/unlog', 'UserControler','unlog'); $router->map('GET|POST', '/signin', 'VisitorControler','signin'); $router->map('GET|POST', '/validlogin', 'VisitorControler','validlogin'); - $router->map('GET|POST', '/validsignin', 'VisitorControler','validsignin'); + $router->map('GET|POST', '/validsignin', 'VisitorControler','validsignin'); $router->map('GET|POST', '/addFav/[i:id]', 'UserControler','addFav'); $router->map('GET|POST', '/supFav/[i:id]', 'UserControler','supFav'); + $router->map('GET|POST', '/changedata', 'UserControler','changedata'); + $router->map('GET|POST', '/submit', 'UserControler', 'submit'); + $router->map('GET|POST', '/validsubmit', 'UserControler', 'validsubmit'); $match = $router->match(); diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index e2c09b5..9a1ad92 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -1,26 +1,26 @@ cMod->createComment($_POST['content'],$_POST['idQuote'],$this->uMod->getIdByUsername($_SESSION['user'])); + $this->cMod->createComment(Verification::verifChar($_POST['content']), + Verification::verifChar($_POST['idQuote']), + $this->uMod->getIdByUsername(Verification::verifChar($_SESSION['user']))); header("Location:".$racine."/quote/$id"); } @@ -81,7 +83,7 @@ class UserControler { switch ($action) { case 'canswer': if ($this->CorrectAnswer()) - $_SESSION['score'] = isset($_SESSION['score']) ? ($_SESSION['score'] + 1) : 1; + $_SESSION['score'] = Verification::verifChar( isset( $_SESSION['score']) ? ($_SESSION['score'] + 1) : 1 ) ; $this->continueQuiz($id, $nb_questions); break; default: @@ -91,8 +93,8 @@ class UserControler { // page erreur break; default: - $_SESSION['score'] = $_SESSION['score'] ?? 0; - $this->showQuestion($id, $_SESSION['no_question'] ?? 0); + $_SESSION['score'] = Verification::verifChar($_SESSION['score'] ?? 0); + $this->showQuestion($id, Verification::verifChar($_SESSION['no_question'] ?? 0)); break; } } @@ -107,9 +109,8 @@ class UserControler { { global $racine; $score = $_SESSION['score']; - $_SESSION['no_question'] = isset($_SESSION['no_question']) ? ($_SESSION['no_question'] + 1) : 1; + $_SESSION['no_question'] = Verification::verifChar( isset($_SESSION['no_question']) ? ($_SESSION['no_question'] + 1) : 1); if ($_SESSION['no_question'] >= $total_questions) { - // session_destroy(); $_SESSION['no_question'] = 0; $this->endQuiz($id_quiz, $score); } @@ -137,10 +138,10 @@ class UserControler { public function CorrectAnswer() : bool { - $answera = $_POST['answera'] ?? null; - $answerb = $_POST['answerb'] ?? null; - $answerc = $_POST['answerc'] ?? null; - $answerd = $_POST['answerd'] ?? null; + $answera = Verification::verifChar($_POST['answera'] ?? null); + $answerb = Verification::verifChar($_POST['answerb'] ?? null); + $answerc = Verification::verifChar($_POST['answerc'] ?? null); + $answerd = Verification::verifChar($_POST['answerd'] ?? null); $id= null; $answer = null; @@ -178,7 +179,7 @@ class UserControler { */ public function showQuestion(int $id, int $num) : void { - global $vues; + global $vues,$twig; $q = $this->GetQuestion($id); $question = $q[$num] ?? $q[0]; $idquestion = $question->getIdQuestion(); @@ -199,7 +200,7 @@ class UserControler { public function addFav(array $arg){ global $racine; $id= $arg['id'] ?? 1; - $this->uMod->addFavorite($_SESSION["user"],$id); + $this->uMod->addFavorite(Verification::verifChar($_SESSION["user"]),$id); header("Location:" . $racine . "/quote/$id"); } @@ -207,7 +208,145 @@ class UserControler { public function supFav(array $arg){ global $racine; $id= $arg['id'] ?? 1; - $this->uMod->supFavorite($_SESSION["user"],$id); + $this->uMod->supFavorite(Verification::verifChar($_SESSION["user"]),$id); header("Location:". $racine ."/quote/$id"); } + + public function changedata() : void + { + global $vues, $racine; + if ($_POST) + { + $newImage = $_POST['image'] ?? null; + $newPseudo = $_POST['pseudo'] ?? null; + $newEmail = $_POST['email'] ?? null; + $newMdpFirst = $_POST['passwdFirst'] ?? null; + $newMdpSecond = $_POST['passwdSecond'] ?? null; + + //Modif le pseudo + if($newPseudo){ + $user = $this-> uMod->setUsername($_SESSION['user'], $newPseudo); + if($user == $newPseudo){ //Si le pseudo existe déjà + $_SESSION['user'] = $newPseudo; + } + } + + else if($newEmail){ + $user = $this-> uMod->setEmail($_SESSION['user'], $newEmail); + } + + else if($newMdpFirst && $newMdpSecond){ + + if($newMdpFirst == $newMdpSecond){ + + $option = ['cost' => 12]; + $newPassWd = password_hash($newMdpFirst, PASSWORD_BCRYPT, $option); + $user = $this-> uMod->setPassWd($_SESSION['user'], $newPassWd); + } + } + + else if($newImage){ + $user = $this->uMod->setImage($_SESSION['user']); + } + } + header("Location: ". $racine."/profil"); + + } + + /** + * @throws SyntaxError + * @throws RuntimeError + * @throws LoaderError + */ + public function submit() : void + { + global $vues; + require_once $vues['submitQuote']; + } + + /** + * @throws SyntaxError + * @throws RuntimeError + * @throws LoaderError + */ + public function toSubmit() : ?array + { + global $co; + if ($_POST) + { + $content = $_POST['content'] ?? null; + $character = $_POST['character'] ?? null; + $source = $_POST['source'] ?? null; + //$img = $_POST['img'] ?? null; + + $errors = [null, null]; + + $gw = new CharacterGateway($co); + $mdl = new CharacterModel($gw); + + $character = $mdl -> getCharacterByName($character); + + $gw = new SourceGateway($co); + $mdl = new SourceModel($gw); + + $source = $mdl -> getSourceByTitle($source); + + if (!$character) + $errors[0] = "Personnage inexistant"; + if (!$source) + $errors[1] = "Source inexistante"; + if ($errors[0] || $errors[1]) + { + global $twig; + echo $twig->render("submitQuote.html.twig", ['errors' => $errors]); + exit(); + } + + $gw = new QuoteGateway($co); + $mdl = new QuoteModel($gw); + + $mdl -> insert4User($content, '/imgPath', 'fr', $this -> getIdOfUser(), $source->getIdSource(), $character->getIdCharacter()); + + return [$content, $_POST['character'], $_POST['source']]; + } + return null; + } + + /** + * @throws SyntaxError + * @throws RuntimeError + * @throws LoaderError + */ + public function validsubmit() : void + { + $recap = $this -> toSubmit(); + if ($recap) + { + $this -> recapSubmitQuote($recap); + } + } + + /** + * @throws RuntimeError + * @throws SyntaxError + * @throws LoaderError + */ + public function recapSubmitQuote(?array $recap) : void + { + global $twig; + echo $twig -> render("recapSubmitQuote.html.twig", ['content' => $recap[0], 'character' => $recap[1], 'source' => $recap[2]]); + } + + public function getIdOfUser() : ?int + { + if (isset($_SESSION['user'])) + { + global $co; + $gw = new UserGateway($co); + $mdl = new UserModel($gw); + + return $mdl -> getUsername($_SESSION['user']) -> getId(); + } + return null; + } } diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index a3f8350..99589af 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -13,6 +13,7 @@ use Twig\Error\LoaderError; use Twig\Error\RuntimeError; use Twig\Error\SyntaxError; +use Verification\Verification; Class VisitorControler { @@ -27,6 +28,7 @@ Class VisitorControler { private array $errors; + /** * @throws SyntaxError * @throws RuntimeError @@ -68,9 +70,9 @@ Class VisitorControler { public function search(array $arg){ global $vues; - $type = ($_POST['type'] ?? ""); - $search = ( $_POST['search'] ?? NULL); - $filtre = ($arg['filtre'] ?? []); + $type = ( Verification::verifChar( $_POST['type'] ?? "")); + $search = ( Verification::verifChar( $_POST['search'] ?? NULL)); + $filtre = ( Verification::verifArrayChar( $arg['filtre'] ?? [])); $tq=$this->sMod->searchQuote($type,$search,$filtre); @@ -88,9 +90,9 @@ Class VisitorControler { global $vues; require_once $vues['login']; - // global $twig; + //global $twig; - // echo $twig->render("login.html.twig"); + //echo $twig->render("login.html.twig"); //$this -> toLogIn(); } @@ -103,11 +105,14 @@ Class VisitorControler { public function signin(): void { global $vues; - require_once $vues['signin']; - } + require_once $vues['signin']; + //global $twig; + //echo $twig->render("login.html.twig"); + //$this -> signin(); + } public function validlogin() : void @@ -115,8 +120,8 @@ Class VisitorControler { global $vues,$racine; if ($_POST) { - $pseudo = $_POST['pseudo'] ?? null; - $mdp = $_POST['mdp'] ?? null; + $pseudo = Verification::verifChar($_POST['pseudo'] ?? null); + $mdp = Verification::verifChar($_POST['mdp'] ?? null); $user = $this -> uMod -> getUsername($pseudo); @@ -124,9 +129,9 @@ Class VisitorControler { { if (password_verify($mdp, $user->getPassword())) { - $_SESSION['user'] = $pseudo; + $_SESSION['user'] = Verification::verifChar($pseudo); $_SESSION['role'] = 'user'; - header("Location: ". $racine); ///~kekentin/WF/WF-Website/ + header("Location: ". $racine); exit(); }else { @@ -156,10 +161,10 @@ Class VisitorControler { global $vues,$racine; if ($_POST) { - $pseudo = $_POST['pseudo'] ?? null; - $email = $_POST['email'] ?? null; - $mdp = $_POST['mdp'] ?? null; - $cmdp = $_POST['cmdp'] ?? null; + $pseudo = Verification::verifChar($_POST['pseudo'] ?? null); + $email = Verification::verifChar($_POST['email'] ?? null); + $mdp = Verification::verifChar($_POST['mdp'] ?? null); + $cmdp = Verification::verifChar($_POST['cmdp'] ?? null); if ($mdp != $cmdp) { $errors[2] = "Mots de passe incorrects"; @@ -191,8 +196,8 @@ Class VisitorControler { } else echo $this->uMod->insertUser($pseudo, $email, $hmdp); - $_SESSION["role"] = 'user'; - $_SESSION["user"] = $pseudo; + $_SESSION["role"] = Verification::verifChar('user'); + $_SESSION["user"] = Verification::verifChar($pseudo); header("Location: ". $racine); } diff --git a/src/Entity/sourceEntity.php b/src/Entity/SourceEntity.php similarity index 74% rename from src/Entity/sourceEntity.php rename to src/Entity/SourceEntity.php index 8a41c86..48f6ea0 100644 --- a/src/Entity/sourceEntity.php +++ b/src/Entity/SourceEntity.php @@ -1,6 +1,8 @@ id_source = $id_source; $this->title = $title; $this->date = $date; + //$this->type = $type; } /** @@ -69,9 +74,17 @@ class SourceEntity $this->date = $date; } + + public function getType(): TypeSourceEnum + { + return $this->type; + } - - + public function setType(TypeSourceEnum $type): void + { + $this->type = $type; + } + } diff --git a/src/Enum/TypeSourceEnum.php b/src/Enum/TypeSourceEnum.php new file mode 100644 index 0000000..dbc5bfa --- /dev/null +++ b/src/Enum/TypeSourceEnum.php @@ -0,0 +1,9 @@ + co -> executeQuery($query, [ - 'id_char' => array($id_character, PDO::PARAM_INT), - 'name' => array($name, PDO::PARAM_STR), - 'img_char' => array($img_char, PDO::PARAM_STR) + 'id_caracter' => array($id_character, PDO::PARAM_INT), + 'caracter' => array($name, PDO::PARAM_STR), + 'id_img' => array($img_char, PDO::PARAM_STR) ]); } public function findById(int $id) : array { - $query = "SELECT * FROM Characters WHERE id_char = :id_c"; + $query = "SELECT * FROM caracter WHERE id_caracter = :id_c"; $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); return $this -> co -> getResults(); } public function findByName(string $name) : array { - $query = "SELECT * FROM Characters WHERE name = :n"; + $query = "SELECT * FROM caracter WHERE caracter = :n"; $this -> co -> executeQuery($query, ["n" => array($name, PDO::PARAM_STR)]); return $this -> co -> getResults(); } public function findAll() : array { - $query = "SELECT * FROM Characters"; + $query = "SELECT * FROM caracter"; $this -> co -> executeQuery($query); return $this -> co -> getResults(); } public function delete(int $id) : bool { - $query = "DELETE FROM Characters WHERE id_char = :id_c"; + $query = "DELETE FROM caracter WHERE id_caracter = :id_c"; return $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); } public function update(int $id_char, string $name, string $img_char) : bool { $query = " - UPDATE Characters - SET name = :n, img_char = :i - WHERE id_char = :id_c + UPDATE caracter + SET caracter = :n, id_img = :i + WHERE id_caracter = :id_c "; return $this -> co -> executeQuery($query, [ "id_c" => array($id_char, PDO::PARAM_INT), - "name" => array($name, PDO::PARAM_STR), + "caracter" => array($name, PDO::PARAM_STR), "i" => array($img_char, PDO::PARAM_STR) ]); } diff --git a/src/Gateway/QuoteGateway.php b/src/Gateway/QuoteGateway.php index c6bdc91..d5ace1f 100644 --- a/src/Gateway/QuoteGateway.php +++ b/src/Gateway/QuoteGateway.php @@ -1,22 +1,30 @@ co->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); - $result=$this->co->getResults(); - return $result; + $query="SELECT q.id_quote, q.content, q.id_caracter, c.img_char, s.title, s.date, q.likes, q.langue + FROM Quote q + JOIN Source s ON s.id_source = q.id_source + WHERE content LIKE '%:quote%' AND is_valid = true AND langue = :langue + LIMIT 20 OFFSET :page*20;"; + $this->co->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':langue' => array($language,PDO::PARAM_STR))); + return $this->co->getResults(); } 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->co->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); + $query="SELECT q.id_quote, q.content, c.character, c.img_path, s.title, s.date, q.likes, q.langue + FROM Quote q + JOIN Caracter c ON c.id_caracter = q.character + JOIN Source s ON s.id_source = q.id_source + WHERE s.title LIKE '%:source%' AND q.is_valid = true AND langue = :langue + LIMIT 20 OFFSET :page*20;"; + $this->co->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':langue' => array($language,PDO::PARAM_STR))); $result=$this->co->getResults(); return $result; } @@ -24,8 +32,13 @@ Class QuoteGateway extends Gateway{ 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->co->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); + $query="SELECT q.id_quote, q.content, c.character, c.img_path, s.title, s.date, q.likes, q.langue + FROM Quote q + JOIN Caracter c ON c.id_caracter = q.character + JOIN Source s ON s.id_source = q.id_source + WHERE c.character LIKE '%:pers%' AND q.is_valid = true AND langue = :langue + LIMIT 20 OFFSET :page*20;"; + $this->co->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':langue' => array($language,PDO::PARAM_STR))); $result=$this->co->getResults(); return $result; } @@ -33,7 +46,12 @@ Class QuoteGateway extends Gateway{ public function searchId(string $id):array{ //recherche par id - $query="SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dates, q.likes, q.langue FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source JOIN Image i ON c.id_img = i.id_img WHERE q.id_quote = :id AND q.isvalide = true;"; + $query="SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dates, q.likes, q.langue + FROM Quote q + JOIN Caracter c ON c.id_caracter = q.id_caracter + JOIN Source s ON s.id_source = q.id_source + JOIN Image i ON c.id_img = i.id_img + WHERE q.id_quote = :id AND q.isvalide = true;"; $this->co->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); $result=$this->co->getResults(); return $result; @@ -46,7 +64,7 @@ Class QuoteGateway extends Gateway{ JOIN Source s ON s.id_source = q.id_source JOIN Image i ON c.id_img = i.id_img WHERE lower("; - + if($type=='personnage'){ $query = $query . "c.caracter) LIKE lower('%" . $search . "%')"; } @@ -62,21 +80,21 @@ Class QuoteGateway extends Gateway{ }*/ $this->co->executeQuery($query,array()); - + $result=$this->co->getResults(); return $result; } public function getQuoteOfTheDay(string $language): array { $query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue - FROM DailyQuote dq - JOIN Quote q ON dq.citation_id = q.id_quote - JOIN Caracter c ON c.id_caracter = q.id_caracter - JOIN Source s ON s.id_source = q.id_source - JOIN Image i ON c.id_img = i.id_img - WHERE q.isValide = true AND q.langue = :language - ORDER BY q.id_quote DESC - LIMIT 1;"; + FROM DailyQuote dq + JOIN Quote q ON dq.citation_id = q.id_quote + JOIN Caracter c ON c.id_caracter = q.id_caracter + JOIN Source s ON s.id_source = q.id_source + JOIN Image i ON c.id_img = i.id_img + WHERE q.isValide = true AND q.langue = :language + ORDER BY q.id_quote DESC + LIMIT 1;"; try { $this->co->executeQuery($query, [':language' => [$language, PDO::PARAM_STR]]); $result = $this->co->getResults(); @@ -85,9 +103,9 @@ Class QuoteGateway extends Gateway{ echo "Erreur dans getQuoteOfTheDay: " . $e->getMessage(); return []; } - } + } + - public function getSuggestions(int $numpage, string $language): array { $query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue @@ -126,6 +144,32 @@ Class QuoteGateway extends Gateway{ } } + public function autoincrement() : int + { + $query = "SELECT Max(id_quote) + 1 as id FROM Quote;"; + $this->co->executeQuery($query); + return ($this -> co ->getResults())[0]['id']; + } + + public function insert4User(string $content, string $img_path, string $langage, int $user, int $source, int $character) : bool + { + $query = " + INSERT INTO Quote (id_quote, content, langue, reason, id_source, id_caracter, id_user_verif, img_path) + VALUES (:id, :content, :langage, :reason, :source, :character, :user, :img_path) + "; + + return $this->co->executeQuery($query, [ + ':id' => array($this->autoincrement(), PDO::PARAM_INT), + ':content' => array($content, PDO::PARAM_STR), + ':img_path' => array($img_path, PDO::PARAM_STR), + ':langage' => array($langage, PDO::PARAM_STR), + ':user' => array($user, PDO::PARAM_INT), + ':reason' => array('À vérifier', PDO::PARAM_STR), + ':source' => array($source, PDO::PARAM_STR), + ':character' => array($character, PDO::PARAM_STR) + ]); + } + //======================== PARTI ADMIN ======================== //Probablement à déplacer dans un autre fichier @@ -133,8 +177,7 @@ Class QuoteGateway extends Gateway{ //obtenir les quotes en attentes de validation par l'admin $query = 'SELECT * FROM Quote WHERE isValid=:bool'; $this->co->executeQuery($query,array(':bool' => array(false, PDO::PARAM_BOOL))); - $result=$this->co->getResults(); - return $result; + return $this->co->getResults(); } public function validQuote(int $id){ @@ -152,61 +195,56 @@ Class QuoteGateway extends Gateway{ public function updateContent(int $id, string $newContent):array{ //Update le contexte de quote passé en paramètre $queryUpdate = 'UPDATE Quote SET content=:newContent WHERE id_quote=:idQuote'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newContent'=> array($newContent, PDO::PARAM_STR))); + $this->co->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newContent'=> array($newContent, PDO::PARAM_STR))); //Renvoie le nouveau contexte de quote - $queryReponse = 'SELECT content FROM Quote WHERE id_quote=:idQuote'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; + $queryReponse = 'SELECT content FROM Quote WHERE id_quote=:idQuote'; + $this->co->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + return $this->co->getResults(); } public function updateTimeCode(int $id, string $newTimeCode):array{ //Update le time code de quote passé en paramètre $queryUpdate = 'UPDATE Quote SET timecode=:newTimeCode WHERE id_quote=:idQuote'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTimeCode'=> array($newTimeCode, PDO::PARAM_STR))); + $this->co->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTimeCode'=> array($newTimeCode, PDO::PARAM_STR))); //Renvoie le nouveau contexte de quote - $queryReponse = 'SELECT timecode FROM Quote WHERE id_quote=:idQuote'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; + $queryReponse = 'SELECT timecode FROM Quote WHERE id_quote=:idQuote'; + $this->co->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + return $this->co->getResults(); } public function updateDate(int $id, int $newDate):array{ //Update la date de quote passé en paramètre $queryUpdate = 'UPDATE Source SET dateSource =:newdate WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newDate'=> array($newDate, PDO::PARAM_INT))); + $this->co->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newDate'=> array($newDate, PDO::PARAM_INT))); //Renvoie la nouvelle date de quote - $queryReponse = 'SELECT s.dateSource FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; + $queryReponse = 'SELECT s.dateSource FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; + $this->co->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + return $this->co->getResults(); } public function updateTitle(int $id, string $newTitle):array{ //Update le titre de l'oeuvre de quote passé en paramètre $queryUpdate = 'UPDATE Source SET title =:newTitle WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTitle'=> array($newTitle, PDO::PARAM_STR))); + $this->co->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTitle'=> array($newTitle, PDO::PARAM_STR))); //Renvoie le nouveau titre de quote - $queryReponse = 'SELECT s.title FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; + $queryReponse = 'SELECT s.title FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; + $this->co->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + return $this->co->getResults(); } public function updateNameCharacter(int $id, string $newNameCharacter):array{ //Update le personnage de l'oeuvre de quote passé en paramètre $queryUpdate = 'UPDATE Character SET name =:newNameCharacter WHERE idCharacter = (SELECT idCharacter FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newNameCharacter'=> array($newNameCharacter, PDO::PARAM_STR))); + $this->co->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newNameCharacter'=> array($newNameCharacter, PDO::PARAM_STR))); //Renvoie le nouveau personnage de quote - $queryReponse = 'SELECT c.title FROM Character c, Quote q WHERE id_quote=:idQuote AND c.idCharacter = q.idCharacter'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; + $queryReponse = 'SELECT c.title FROM Character c, Quote q WHERE id_quote=:idQuote AND c.idCharacter = q.idCharacter'; + $this->co->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + return $this->co->getResults(); } } diff --git a/src/Gateway/sourceGateway.php b/src/Gateway/SourceGateway.php similarity index 68% rename from src/Gateway/sourceGateway.php rename to src/Gateway/SourceGateway.php index a746ec8..ed540b3 100644 --- a/src/Gateway/sourceGateway.php +++ b/src/Gateway/SourceGateway.php @@ -1,20 +1,22 @@ 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) + "date" => array($s->getDate(), PDO::PARAM_STR), + "type" => array($s->getType(), PDO::PARAM_STR) ]); } @@ -30,7 +32,7 @@ class SourceGateway extends Gateway{ { $query = "SELECT * FROM Source WHERE title = :t"; - $this -> co -> executeQuery($query, ["title" => array($t, PDO::PARAM_STR)]); + $this -> co -> executeQuery($query, ["t" => array($t, PDO::PARAM_STR)]); return $res = $this -> co -> getResults(); // if ($res) @@ -44,19 +46,21 @@ class SourceGateway extends Gateway{ public function findByDate(string $d) : array { - $query = "SELECT * FROM Source WHERE date = :d"; + $query = "SELECT * FROM Source WHERE dates = :d"; - $this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]); - $res = $this -> co -> getResults(); + $this -> co -> executeQuery($query, ["d" => array($d, PDO::PARAM_STR)]); + return $this -> co -> getResults(); + } + + /* + public function findByType(TypeSourceEnum $type) : array + { + $query = "SELECT * FROM Source WHERE type = :t"; - if ($res) - return new sourceEntity( - $res["id_source"], - $res["title"], - $res["date"] - ); - return null; + $this -> co -> executeQuery($query, ["t" => array($type, PDO::PARAM_STR)]); + return $this -> co -> getResults(); } + */ public function findAll() : array { @@ -71,7 +75,8 @@ class SourceGateway extends Gateway{ $sources[] = new sourceEntity( $source["id_source"], $source["title"], - $source["date"] + $source["date"], + TypeSourceEnum::Movie//$res["source"] ); } return $sources; diff --git a/src/Gateway/UserGateway.php b/src/Gateway/UserGateway.php index a211518..450feb0 100644 --- a/src/Gateway/UserGateway.php +++ b/src/Gateway/UserGateway.php @@ -70,7 +70,7 @@ Class UserGateway extends Gateway{ //obtenir les information d'un user public function findDataUser(int $id):array{ - $query = 'SELECT * FROM Users WHERE id_user=:idUser'; + $query = 'SELECT u.id_user , u.username , u.email , u.password , i.imgPath , u.creation FROM Users WHERE id_user=:idUser'; $this->co->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR))); $result = $this->co->getResults(); return $result; @@ -78,7 +78,7 @@ Class UserGateway extends Gateway{ // obtenir les informations d'un user selon son pseudo public function findUsername(string $username):array{ - $query = 'SELECT u.id_user , u.username , u.email , u.password , i.imgPath , u.creation FROM Users u Join Image i on i.id_img=u.img WHERE username= :username'; + $query = 'SELECT * FROM Users u Join Image i on i.id_img=u.img WHERE username= :username'; $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR))); return $this->co->getResults(); } @@ -89,47 +89,76 @@ Class UserGateway extends Gateway{ return $this->co->getResults(); } + public function IsExisteUsername(string $username): bool { + $query = 'SELECT COUNT(*) as count FROM Users WHERE username = :username'; + $this->co->executeQuery($query, array(':username' => array($username, PDO::PARAM_STR))); + $results = $this->co->getResults(); + + return $results[0]['count'] > 0; // retourne true si "count" > 0) + } + + public function IsExisteEmail(string $email): bool { + $query = 'SELECT COUNT(*) as count FROM Users WHERE email = :email'; + $this->co->executeQuery($query, array(':email' => array($email, PDO::PARAM_STR))); + $results = $this->co->getResults(); + + return $results[0]['count'] > 0; // retourne true si "count" > 0) + } + // ===================== UPDATE FUNCTION ===================== - public function updateUsername(int $id, string $newUsername):bool{ + //Update Username + public function updateUsername(string $username, string $newUsername):array{ //Update le nom du user passé en paramètre - $queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; - $this->co->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR))); + $queryUpdate = 'UPDATE Users SET username=:newUsername WHERE username=:username'; + $this->co->executeQuery($queryUpdate, array(':username'=>array($username, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR))); //Renvoie le nouveau nom du user - $queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser'; + $queryReponse = 'SELECT username FROM Users WHERE username=:idUser'; - return $this->co->executeQuery($queryReponse, array($id=>array($newUsername, PDO::PARAM_STR))); + $this->co->executeQuery($queryReponse, array(':idUser'=>array($newUsername, PDO::PARAM_STR))); + return $this->co->getResults(); } - public function updateEmail(int $id, string $newEmail):bool{ + + //Update Email + public function updateEmail(string $username, string $newEmail):array{ //Update le email du user passé en paramètre - $queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; - $this->co->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR))); + $queryUpdate = 'UPDATE Users SET email=:newEmail WHERE username=:username'; + $this->co->executeQuery($queryUpdate, array(':username'=>array($username, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR))); //Renvoie le nouveau email du user - $queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser'; - return $this->co->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); + $queryReponse = 'SELECT email FROM Users WHERE username=:username'; + + $this->co->executeQuery($queryReponse, array(':username'=>array($username, PDO::PARAM_STR))); + return $this->co->getResults(); } - public function updateImg(int $id, int $newImg):array{ + + + public function updateImg(string $username):array{ + $id_image = $this->randomImg(); //Update l'image du user passé en paramètre - $query = 'UPDATE Users SET img_prfl=:newImg WHERE id_user=:idUser'; - $this->co->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newImg'=> array($newImg, PDO::PARAM_STR))); + $query = 'UPDATE Users SET img=:id_image WHERE username=:username'; + $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR), ':id_image'=> array($id_image, PDO::PARAM_INT))); //Renvoie la nouvelle image du user - $queryReponse = 'SELECT img_prfl FROM Users WHERE id_user=:idUser'; - $this->co->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); - $result = $this->co->getResults(); - return $result; + $queryReponse = 'SELECT img FROM Users WHERE username=:username'; + $this->co->executeQuery($queryReponse, array(':username'=>array($username, PDO::PARAM_STR))); + return $this->co->getResults(); } - public function updatePasswd(int $id, string $newPassWd):array{ + + public function updatePasswd(string $username, string $newPassWd):void{ //Update le passwd du user passé en paramètre - $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; - $this->co->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); + $query = 'UPDATE Users SET password=:newPassWd WHERE username=:username'; + $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); } + + + + public function getIdUser(string $username):array{ $query = 'SELECT id_user FROM Users WHERE username=:username'; $this->co->executeQuery($query, array(':username'=>array($username, PDO::PARAM_STR))); diff --git a/src/Model/CharacterModel.php b/src/Model/CharacterModel.php index 53eb21c..fa1e074 100644 --- a/src/Model/CharacterModel.php +++ b/src/Model/CharacterModel.php @@ -19,9 +19,9 @@ class CharacterModel extends Model $c = $this -> gateway -> findById($id_character); if ($c) return new CharacterEntity( - $c['id_character'], - $c['name'], - $c['img_path'] + $c['id_caracter'], + $c['caracter'], + $c['id_img'] ); return null; } @@ -31,9 +31,9 @@ class CharacterModel extends Model $c = $this -> gateway -> findByName($name); if ($c) return new CharacterEntity( - $c[0]['id_character'], - $c[0]['name'], - $c[0]['img_path'] + $c[0]['id_caracter'], + $c[0]['caracter'], + $c[0]['id_img'] ); return null; } @@ -47,9 +47,9 @@ class CharacterModel extends Model foreach ($c as $character) { $characters[] = new CharacterEntity( - $character['id_character'], - $character['name'], - $character['img_path'] + $character['id_caracter'], + $character['caracter'], + $character['id_img'] ); } return $characters; diff --git a/src/Model/QuoteModel.php b/src/Model/QuoteModel.php index 7d1af63..b0bcff3 100644 --- a/src/Model/QuoteModel.php +++ b/src/Model/QuoteModel.php @@ -45,6 +45,12 @@ } return $tabQ; } + + public function insert4User(string $content, string $img_path, string $langage, int $user, int $source, int $character) : bool + { + return $this->gateway->insert4User($content, $img_path, $langage, $user, $source, $character); + } + } ?> diff --git a/src/Model/UserModel.php b/src/Model/UserModel.php index 41cffc0..5f2a99d 100644 --- a/src/Model/UserModel.php +++ b/src/Model/UserModel.php @@ -76,39 +76,60 @@ return null; } - public function setUsername(int $id, string $newUsername){ - $res = $this->gateway->updateUsername($id,$newUsername); - $src[] = $res[0]['username']; + public function IsExisteUsername(string $username):bool{ + return $this->gateway->IsExisteUsername($username); + } - return $src; + public function IsExisteEmail(string $email):bool{ + return $this->gateway->IsExisteEmail($email); } - public function setEmail(int $id, string $newEmail){ - $res = $this->gateway->updateEmail($id,$newEmail); - $src[] = $res[0]['email']; - return $src; + public function setUsername(string $username, string $newUsername): string { + + if ($this->IsExisteUsername($newUsername)) {// Vérifier si le nouveau nom d'utilisateur existe déjà + return $username;// Retourne l'ancien nom d'utilisateur sans modification + } + + $res = $this->gateway->updateUsername($username, $newUsername);// Sinon, mettre à jour le nom d'utilisateur + + // Retourner le nouveau nom d'utilisateur après modification + if (!empty($res) && isset($res[0]['username'])) { + return $res[0]['username']; + } + + // En cas d'échec, retourne l'ancien nom d'utilisateur + return $username; } + - public function setImg(int $id, int $newImg){ - $res = $this->gateway->updateImg($id,$newImg); - $src[] = $res[0]['img']; + public function setEmail(string $username, string $newEmail){ + if ($this->IsExisteEmail($newEmail)) { + return $email; + } - return $src; + $res = $this->gateway->updateEmail($username,$newEmail); + + if (!empty($res) && isset($res[0]['email'])) { + return $res[0]['email']; + } + + return $username;// En cas d'échec, retourne l'ancien email } - public function setPassWd(int $id, string $newPassWd){ - $res = $this->gateway->updatePasswd($id,$newPassWd); - $src[] = $res[0]['pssword']; + public function setImage(string $username){ + $res = $this->gateway->updateImg($username); + $src[] = $res[0]['img']; return $src; } - public function getIdByUsername(string $username){ - $res = $this->gateway->getIdUser($username); - return $res[0]['id_user']; + public function setPassWd(string $username, string $newPassWd):void{ + $res = $this->gateway->updatePasswd($username,$newPassWd); } + + public function isFavorite(?string $username, int $idq): bool { if($_SESSION["user"] == NULL){ return false; @@ -119,6 +140,7 @@ } } + public function addFavorite(string $username, int $id){ $this->gateway->addFavorite($username,$id); } @@ -126,6 +148,11 @@ public function supFavorite(string $username, int $id){ $this->gateway->supFavorite($username,$id); } + + public function getIdByUsername(string $username){ + $res = $this->gateway->getIdUser($username); + return $res[0]['id_user']; + } } ?> diff --git a/src/Model/sourceModel.php b/src/Model/sourceModel.php index 9430baa..baf1c37 100644 --- a/src/Model/sourceModel.php +++ b/src/Model/sourceModel.php @@ -1,17 +1,17 @@ gateway -> create($q); + } public function getSourceById(int $id_source) : ?SourceEntity @@ -22,40 +22,68 @@ class SourceModel extends Model return new sourceEntity( $res[0]["id_source"], $res[0]["title"], - $res[0]["date"] + $res[0]["dates"], + TypeSourceEnum::Movie//from($res[0]["type"]) ); return null; } - public function getSourceByTitle(string $title) : array + public function getSourceByTitle(string $title) : ?SourceEntity { $res = $this->gateway->findByTitle($title); + if ($res) + return new sourceEntity( + $res[0]["id_source"], + $res[0]["title"], + $res[0]["dates"], + TypeSourceEnum::Movie//from($res[0]["type"]) + ); + return null; + } + + public function getSourceByDate(string $date) : array + { + $res = $this->gateway->findByDate($date); + $src = []; foreach ($res as $sources) { $src[] = new sourceEntity( - $sources["id_source"], - $sources["title"], - $sources["date"] - ); + $sources["id_source"], + $sources["title"], + $sources["dates"], + TypeSourceEnum::from($sources["type"]) + ); } return $src; } - public function getSourceByDate(string $date) : array + public function getSourceByType(TypeSourceEnum $type) : array { - $res = $this->gateway->findByDate($date); + $res = $this->gateway->findByType($type); + $src = []; foreach ($res as $sources) { $src[] = new sourceEntity( - $sources["id_source"], - $sources["title"], - $sources["date"] - ); + $sources["id_source"], + $sources["title"], + $sources["dates"], + TypeSourceEnum::from($sources["type"]) + ); } return $src; } - public function getSources() : array + public function getAllSources() : array { - return $this -> gateway -> findAll(); + $res = $this -> gateway -> findAll(); + $src = []; + foreach ($res as $sources) { + $src[] = new sourceEntity( + $sources["id_source"], + $sources["title"], + $sources["dates"], + TypeSourceEnum::from($sources["type"]) + ); + } + return $src; } public function deleteSource(int $id_source) : bool diff --git a/src/Verification/Verification.php b/src/Verification/Verification.php index a607afa..a849265 100644 --- a/src/Verification/Verification.php +++ b/src/Verification/Verification.php @@ -1,18 +1,44 @@ ','(',')']; + $chaineInterdi=["AND","OR","WHERE","FROM","SELECT"]; + $textVerif=""; + + foreach( str_split($text,1) as $char){ + if( !in_array($char,$charInterdi) ){ + $textVerif=$textVerif.$char; + } + } + + $text=$textVerif; + $textVerif=""; + $tabText=explode(" ",$text); + for( $i=0 ; $iverifChar($tabText[$i]); + } + return $tabText; } - return $textVerif; + } -} ?> \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php index d1915e7..8890569 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -1,25 +1,25 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - /** @var \Closure(string):void */ - private static $includeFile; - - /** @var string|null */ - private $vendorDir; - - // PSR-4 - /** - * @var array> - */ - private $prefixLengthsPsr4 = array(); - /** - * @var array> - */ - private $prefixDirsPsr4 = array(); - /** - * @var list - */ - private $fallbackDirsPsr4 = array(); - - // PSR-0 - /** - * List of PSR-0 prefixes - * - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) - * - * @var array>> - */ - private $prefixesPsr0 = array(); - /** - * @var list - */ - private $fallbackDirsPsr0 = array(); - - /** @var bool */ - private $useIncludePath = false; - - /** - * @var array - */ - private $classMap = array(); - - /** @var bool */ - private $classMapAuthoritative = false; - - /** - * @var array - */ - private $missingClasses = array(); - - /** @var string|null */ - private $apcuPrefix; - - /** - * @var array - */ - private static $registeredLoaders = array(); - - /** - * @param string|null $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); - } - - /** - * @return array> - */ - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); - } - - return array(); - } - - /** - * @return array> - */ - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - /** - * @return list - */ - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - /** - * @return list - */ - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - /** - * @return array Array of classname => path - */ - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - * - * @return void - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void - */ - public function add($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 base directories - * - * @return void - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - * - * @return void - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - * - * @return void - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - * - * @return void - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } - } - - /** - * Unregisters this instance as an autoloader. - * - * @return void - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); - - return true; - } - - return null; - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - /** - * Returns the currently registered loaders keyed by their corresponding vendor directories. - * - * @return array - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } -} + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 6256709..f27399a 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,21 +1,21 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 18f62d5..f135834 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1,13 +1,13 @@ - $vendorDir . '/altorouter/altorouter/AltoRouter.php', - 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', -); + $vendorDir . '/altorouter/altorouter/AltoRouter.php', + 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 57f11ef..7498c74 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -1,17 +1,17 @@ - $vendorDir . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', - '89efb1254ef2d1c5d80096acd12c4098' => $vendorDir . '/twig/twig/src/Resources/core.php', - 'ffecb95d45175fd40f75be8a23b34f90' => $vendorDir . '/twig/twig/src/Resources/debug.php', - 'c7baa00073ee9c61edf148c51917cfb4' => $vendorDir . '/twig/twig/src/Resources/escaper.php', - 'f844ccf1d25df8663951193c3fc307c8' => $vendorDir . '/twig/twig/src/Resources/string_loader.php', -); + $vendorDir . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', + '89efb1254ef2d1c5d80096acd12c4098' => $vendorDir . '/twig/twig/src/Resources/core.php', + 'ffecb95d45175fd40f75be8a23b34f90' => $vendorDir . '/twig/twig/src/Resources/debug.php', + 'c7baa00073ee9c61edf148c51917cfb4' => $vendorDir . '/twig/twig/src/Resources/escaper.php', + 'f844ccf1d25df8663951193c3fc307c8' => $vendorDir . '/twig/twig/src/Resources/string_loader.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index ff5488f..15a2ff3 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -1,9 +1,9 @@ - array($vendorDir . '/twig/twig/src'), - 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), - 'Model\\' => array($baseDir . '/src/Model'), - 'Gateway\\' => array($baseDir . '/src/Gateway'), - 'Entity\\' => array($baseDir . '/src/Entity'), - 'Controleur\\' => array($baseDir . '/src/Controleur'), -); + array($baseDir . '/src/Verification'), + 'Twig\\' => array($vendorDir . '/twig/twig/src'), + 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Model\\' => array($baseDir . '/src/Model'), + 'Gateway\\' => array($baseDir . '/src/Gateway'), + 'Enum\\' => array($baseDir . '/src/Enum'), + 'Entity\\' => array($baseDir . '/src/Entity'), + 'Controleur\\' => array($baseDir . '/src/Controleur'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 605d150..fd08c64 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -1,50 +1,50 @@ -register(true); - - $filesToLoad = \Composer\Autoload\ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$files; - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } - }, null, null); - foreach ($filesToLoad as $fileIdentifier => $file) { - $requireFile($fileIdentifier, $file); - } - - return $loader; - } -} +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index c1bdb2a..f4ba755 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1,100 +1,113 @@ - __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', - '89efb1254ef2d1c5d80096acd12c4098' => __DIR__ . '/..' . '/twig/twig/src/Resources/core.php', - 'ffecb95d45175fd40f75be8a23b34f90' => __DIR__ . '/..' . '/twig/twig/src/Resources/debug.php', - 'c7baa00073ee9c61edf148c51917cfb4' => __DIR__ . '/..' . '/twig/twig/src/Resources/escaper.php', - 'f844ccf1d25df8663951193c3fc307c8' => __DIR__ . '/..' . '/twig/twig/src/Resources/string_loader.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'T' => - array ( - 'Twig\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Php81\\' => 23, - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Polyfill\\Ctype\\' => 23, - ), - 'M' => - array ( - 'Model\\' => 6, - ), - 'G' => - array ( - 'Gateway\\' => 8, - ), - 'E' => - array ( - 'Entity\\' => 7, - ), - 'C' => - array ( - 'Controleur\\' => 11, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/src', - ), - 'Symfony\\Polyfill\\Php81\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - 'Model\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Model', - ), - 'Gateway\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Gateway', - ), - 'Entity\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Entity', - ), - 'Controleur\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Controleur', - ), - ); - - public static $classMap = array ( - 'AltoRouter' => __DIR__ . '/..' . '/altorouter/altorouter/AltoRouter.php', - 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$classMap; - - }, null, ClassLoader::class); - } -} + __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', + '89efb1254ef2d1c5d80096acd12c4098' => __DIR__ . '/..' . '/twig/twig/src/Resources/core.php', + 'ffecb95d45175fd40f75be8a23b34f90' => __DIR__ . '/..' . '/twig/twig/src/Resources/debug.php', + 'c7baa00073ee9c61edf148c51917cfb4' => __DIR__ . '/..' . '/twig/twig/src/Resources/escaper.php', + 'f844ccf1d25df8663951193c3fc307c8' => __DIR__ . '/..' . '/twig/twig/src/Resources/string_loader.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'V' => + array ( + 'Verification\\' => 13, + ), + 'T' => + array ( + 'Twig\\' => 5, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php81\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, + ), + 'M' => + array ( + 'Model\\' => 6, + ), + 'G' => + array ( + 'Gateway\\' => 8, + ), + 'E' => + array ( + 'Enum\\' => 5, + 'Entity\\' => 7, + ), + 'C' => + array ( + 'Controleur\\' => 11, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Verification\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Verification', + ), + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), + 'Symfony\\Polyfill\\Php81\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Model\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Model', + ), + 'Gateway\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Gateway', + ), + 'Enum\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Enum', + ), + 'Entity\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Entity', + ), + 'Controleur\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Controleur', + ), + ); + + public static $classMap = array ( + 'AltoRouter' => __DIR__ . '/..' . '/altorouter/altorouter/AltoRouter.php', + 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 5ffde28..4c3a5d6 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -1,26 +1,26 @@ -= 80100)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR - ); -} += 80100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vue/submitQuote.php b/vue/submitQuote.php new file mode 100644 index 0000000..f36cb2c --- /dev/null +++ b/vue/submitQuote.php @@ -0,0 +1,18 @@ +render('head.html.twig', [ + 'title' => "Submit Quote", + 'style' => "public/styles/styleSubmitQuote.css", + 'scripts' => array("public/script/theme-toggle.js") +]); + + +// Rendu du bandeau +echo $twig->render('bandeau.html.twig'); + +echo $twig -> render("submitQuote.html.twig"); +?> + + diff --git a/vue/templates/profil.html.twig b/vue/templates/profil.html.twig index 26dc88b..b46eaa7 100644 --- a/vue/templates/profil.html.twig +++ b/vue/templates/profil.html.twig @@ -2,32 +2,36 @@

▶ Profil ◀

+
+ + - -

{{ srcUsername }}

+

{{ srcUsername }}

-

{{ srcEmail }}

+

{{ srcEmail }}

-

Votre mot de passe

+

Votre mot de passe

-
-

Language :

-
- - - - +
+

Language :

+
+ + +
+ +
+ Ajouter une citation +
+ -
- - - -
+
+ + + +
diff --git a/vue/templates/recapSubmitQuote.html.twig b/vue/templates/recapSubmitQuote.html.twig new file mode 100644 index 0000000..d542dd3 --- /dev/null +++ b/vue/templates/recapSubmitQuote.html.twig @@ -0,0 +1,51 @@ + + + + + + Wiki Fantasy : Submit Quote + + + + + + + +{% include "bandeau.html.twig" %} + +

▶ Your quote has been submitted successfully ◀

+ +
+ +
+ +
+ +

Contenu *

+

{{ content }}

+ +
+ +
+ +

Personnage *

+

{{ character }}

+ +
+ +
+ +

Source *

+

{{ source }}

+ +
+ +
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/vue/templates/submitQuote.html.twig b/vue/templates/submitQuote.html.twig new file mode 100644 index 0000000..e0df0c2 --- /dev/null +++ b/vue/templates/submitQuote.html.twig @@ -0,0 +1,48 @@ +

▶ Submit a Quote ◀

+ +
+ +
+ +
+ +

Contenu *

+ +
+ +
+ +

Personnage *

+ + {% if errors[0] is defined and errors[0] is not empty %} +

{{ errors[0] }}

+ {% endif %} + +
+ +
+ +

Source *

+ + {% if errors[1] is defined and errors[1] is not empty %} +

{{ errors[1] }}

+ {% endif %} + +
+ +
+ +

Image *

+ +
+ +
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/vue/test.php b/vue/test.php new file mode 100644 index 0000000..e69de29