diff --git a/src/config/Validation.php b/src/config/Validation.php index e79c088..d31d86a 100755 --- a/src/config/Validation.php +++ b/src/config/Validation.php @@ -22,6 +22,21 @@ class Validation { // $dVueEreur[] = "Veuillez revoir le mail*"; // } +<<<<<<< HEAD + //Vérification Email + if (!isset($email)||$email=="") { + $dVueEreur[] = "L'email est obligatoire."; + $pseudo=""; + $i++; + } + + if ($email != filter_var($email, FILTER_SANITIZE_STRING)) + { + $dVueEreur[] = "Tentative d'injection de code (attaque sécurité)"; + $nom=""; + $i++; + } +======= // //Vérification Pseudo // if (!isset($pseudo)||$pseudo=="") { // $dVueEreur[] = "pas de pseudo"; @@ -30,6 +45,7 @@ class Validation { // } // val_string($pseudo,$i,$dVueEreur); +>>>>>>> master // //Vérification Mot de Passe // if (!isset($mdp)||$mdp=="") { @@ -38,7 +54,27 @@ class Validation { // $i++; // } +<<<<<<< HEAD + //Vérification Pseudo + if (!isset($pseudo)||$pseudo=="") { + $dVueEreur[] = "Le pseudonyme est obligatoire."; + $pseudo=""; + $i++; + } + + val_string($pseudo,$i,$dVueEreur); + + //Vérification Mot de Passe + if (!isset($mdp)||$mdp=="") { + $dVueEreur[] = "Veuillez renseignez votre mot de passe."; + $mdp=""; + $i++; + } + + val_string($mdp,$i,$dVueEreur); +======= // val_string($mdp,$i,$dVueEreur); +>>>>>>> master // if (!preg_match('/^.{5,}$/', $mdp)) { @@ -57,7 +93,13 @@ class Validation { $str = preg_replace('/[^A-Za-z\-]/', '', $str); if($str == null || $str == '') { +<<<<<<< HEAD + $dVueEreur[] = "Tentative d'injection de code (attaque sécurité)"; + $str=""; + $i++; +======= return null; +>>>>>>> master } return $str; } diff --git a/src/config/config.php b/src/config/config.php index 3ccb279..97db9eb 100755 --- a/src/config/config.php +++ b/src/config/config.php @@ -15,4 +15,5 @@ $vues['listPublic']='vue/html/PageListePublic.php'; $vues['login']='vue/html/login.php'; $vues['NavBar']='vue/html/NavBar.php'; + ?> diff --git a/src/controller/CtrlVisiteur.php b/src/controller/CtrlVisiteur.php index d622572..c642aa3 100644 --- a/src/controller/CtrlVisiteur.php +++ b/src/controller/CtrlVisiteur.php @@ -41,6 +41,14 @@ class CtrlVisiteur { $this->redirectionInscription($dVueEreur); break; + case "SupprimerTache": + $this->SupprimerTache(); + break; + + case "SupprimerListe": + $this->SupprimerListe(); + break; + //mauvaise action default: $dVueEreur[] = "Erreur d'appel php"; @@ -98,11 +106,29 @@ class CtrlVisiteur { function ConsulterListePublic(array $dVueEreur) { global $rep,$vues; $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); require ($rep.$vues['listPublic']); } + function SupprimerTache(){ + global $rep,$vues; + $id = $_GET['idTache']; + $tache = MdlVisiteur::SupprimerTache($id); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + require ($rep.$vues['listPublic']); + } + + function SupprimerListe(){ + global $rep,$vues; + $id = $_GET['idListe']; + $liste = MdlVisiteur::SupprimerListe($id); + $listes = MdlVisiteur::RecupererListePublic(); + $taches = MdlVisiteur::RecupererTache(); + require ($rep.$vues['listPublic']); + } }//fin class ?> diff --git a/src/modele/MdlUtilisateur.php b/src/modele/MdlUtilisateur.php index 00dca6c..998a590 100644 --- a/src/modele/MdlUtilisateur.php +++ b/src/modele/MdlUtilisateur.php @@ -23,6 +23,26 @@ class MdlUtilisateur return $userGtw->getListePublic(0,10); } +<<<<<<< HEAD:src/Modele/MdlVisiteur.php + public static function RecupererTache(){ + $userGtw = new TacheGateway(); + + return $userGtw->getTache(); + } + + public static function SupprimerTache(string $id){ + $userGtw = new TacheGateway(); + + return $userGtw->Supprimer($id); + } + + public static function SupprimerListe(string $id){ + $userGtw = new ListeGateway(); + + return $userGtw->Supprimer($id); + } +======= +>>>>>>> master:src/modele/MdlUtilisateur.php } diff --git a/src/modele/MdlVisiteur.php b/src/modele/MdlVisiteur.php index e5ba57a..158706d 100644 --- a/src/modele/MdlVisiteur.php +++ b/src/modele/MdlVisiteur.php @@ -24,4 +24,22 @@ class MdlVisiteur return $userGtw->getListePublic(0,10); } + public static function RecupererTache(){ + $userGtw = new TacheGateway(); + + return $userGtw->getTache(); + } + + public static function SupprimerTache(string $id){ + $userGtw = new TacheGateway(); + + return $userGtw->Supprimer($id); + } + + public static function SupprimerListe(string $id){ + $userGtw = new ListeGateway(); + + return $userGtw->Supprimer($id); + } + } diff --git a/src/modele/gateway/ListeGateway.php b/src/modele/gateway/ListeGateway.php index 257ae58..5e4ec24 100644 --- a/src/modele/gateway/ListeGateway.php +++ b/src/modele/gateway/ListeGateway.php @@ -17,13 +17,13 @@ class ListeGateway{ } public function Editer(Liste $Liste){ - $query='UPDATE ToDoListe_Liste SET nom=:nom WHERE id=:id'; + $query='UPDATE ToDoList_Liste SET nom=:nom WHERE id=:id'; $this->con->executeQuery($query, array('nom' => array($Liste->getNom(), PDO::PARAM_STRING)), array('id' => array($Liste->getId()),PDO::PARAM_INT)); } public function Supprimer(int $id){ - $query='DELETE FROM ToDoListe_Liste WHERE id=:id'; - $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_STRING))); + $query='DELETE FROM ToDoList_Liste WHERE id=:id'; + $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); } public function getListe(int $offset, int $limit){ @@ -34,14 +34,14 @@ class ListeGateway{ } public function getTacheListe(Liste $liste){ - $query = 'SELECT tache FROM ToDoListe_Liste WHERE id=:id '; + $query = 'SELECT tache FROM ToDoList_Liste WHERE id=:id '; $this->con->executeQuery($query, array('id' => array($liste->getId, PDO::PARAM_INT))); $results=$this->con->getResults(); return $results; } public function getListePublic($offset,$limit){ - $query = "SELECT * FROM ToDoList_Liste "; + $query = "SELECT * FROM ToDoList_Liste WHERE estPublic LIMIT $offset, $limit"; $this->con->executeQuery($query); $listes = []; foreach ($this->con->getResults() as $liste) { diff --git a/src/modele/gateway/TacheGateway.php b/src/modele/gateway/TacheGateway.php index 28c98c3..150c97d 100644 --- a/src/modele/gateway/TacheGateway.php +++ b/src/modele/gateway/TacheGateway.php @@ -2,6 +2,7 @@ class TacheGateway{ private $con; public function __construct(){ + global $dsn,$user,$pass; $this->con=new Connection($dsn,$user,$pass); } @@ -19,9 +20,19 @@ class TacheGateway{ $this->con->executeQuery($query, array('nom' => array($tache->getNom(), PDO::PARAM_STRING)), array('description' => array($tache->getdescription(), PDO::PARAM_STRING)), array('id' => array($tache->getId(),PDO::PARAM_INT))); } - public function Supprimer(Tache $tache){ + public function Supprimer(string $id){ $query='DELETE FROM ToDoList_Tache WHERE id=:id'; - $this->con->executeQuery($query,'id' => array($tache->getId(), PDO::PARAM_STRING)); + $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); + } + + public function getTache(){ + $query='SELECT * FROM ToDoList_Tache'; + $this->con->executeQuery($query); + $taches = []; + foreach ($this->con->getResults() as $tache) { + $taches[] = new Tache($tache["id"],$tache["nom"],$tache["description"],$tache["dateCreation"],$tache["estValide"],$tache["idListe"]); + } + return $taches; } } ?> \ No newline at end of file diff --git a/src/modele/gateway/UtilisateurGateway.php b/src/modele/gateway/UtilisateurGateway.php index 199e0e1..3631a96 100644 --- a/src/modele/gateway/UtilisateurGateway.php +++ b/src/modele/gateway/UtilisateurGateway.php @@ -20,7 +20,19 @@ class UtilisateurGateway{ public function SupprimerUtilisateur(int $id){ $query='DELETE FROM ToDoList_Utilisateur WHERE id=:id;'; $this->con->executeQuery($query, array( - 'id' => array($id, PDO::PARAM_STRING))); + 'id' => array($id, PDO::PARAM_INT))); + } + + public getCredential(string $id){ + $query = 'SELECT motDePasse FROM ToDoList_Utilisateur WHERE id=:id'; + + if(this->con->executeQuery($query, array('id' => array($id, PDO::PARAM_INT)))){ + return (this->con->getResults[0]['motDePasse']) + } + else{ + /* pas sur de ça*/ + throw new PDOexception; + } } public function RechercheUtilisateurViaEmail(string $pseudo){ diff --git a/src/modele/metier/Liste.php b/src/modele/metier/Liste.php index e8f6101..a9a01bb 100644 --- a/src/modele/metier/Liste.php +++ b/src/modele/metier/Liste.php @@ -32,6 +32,10 @@ class Liste return $this->nom; } + public function getDescription(){ + return $this->description; + } + public function setNom($nom){ $this->nom=$nom; } diff --git a/src/modele/metier/Tache.php b/src/modele/metier/Tache.php index 8682b72..844c230 100644 --- a/src/modele/metier/Tache.php +++ b/src/modele/metier/Tache.php @@ -65,7 +65,7 @@ class Tache //idList public function getIdListe(){ - return $this->estValide; + return $this->idListe; } public function setIdListe($idListe){ diff --git a/src/modele/metier/Utilisateur.php b/src/modele/metier/Utilisateur.php index b4483f3..a526b81 100644 --- a/src/modele/metier/Utilisateur.php +++ b/src/modele/metier/Utilisateur.php @@ -7,6 +7,7 @@ class Utilisateur private $prenom; private $pseudo; private $email; + private $isAdmin; public function __construct($id, $nom, $prenom, $pseudo, $email, $motDePasse, $isAdmin){ $this->id = $id; @@ -14,6 +15,7 @@ class Utilisateur $this->prenom = $prenom; $this->pseudo = $pseudo; $this->email = $email; + $this->isAdmin = $isAdmin; } //Nom diff --git a/src/vue/Images/edit.png b/src/vue/Images/edit.png new file mode 100644 index 0000000..036ece0 Binary files /dev/null and b/src/vue/Images/edit.png differ diff --git a/src/vue/Images/trash.png b/src/vue/Images/trash.png new file mode 100644 index 0000000..8d541ad Binary files /dev/null and b/src/vue/Images/trash.png differ diff --git a/src/vue/html/PageListePublic.php b/src/vue/html/PageListePublic.php index 8bcb7e0..9de42ab 100644 --- a/src/vue/html/PageListePublic.php +++ b/src/vue/html/PageListePublic.php @@ -16,11 +16,66 @@ - '.$liste->getNom().''; - } - ?> + ?> +
+ +