|
|
@ -22,16 +22,16 @@ class UtilisateurGateway
|
|
|
|
public function insert(Utilisateur $utilisateur) : void{
|
|
|
|
public function insert(Utilisateur $utilisateur) : void{
|
|
|
|
$query = "INSERT INTO Utilisateur VALUE (:email,:pseudo,:mdp,:estAdmin)";
|
|
|
|
$query = "INSERT INTO Utilisateur VALUE (:email,:pseudo,:mdp,:estAdmin)";
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
':email' => array($utilisateur->getEmail(),SQLITE3_TEXT),
|
|
|
|
':email' => array($utilisateur->getEmail(),PDO::PARAM_STR),
|
|
|
|
':pseudo' => array($utilisateur->getPseudo(),SQLITE3_TEXT),
|
|
|
|
':pseudo' => array($utilisateur->getPseudo(),PDO::PARAM_STR),
|
|
|
|
':mdp' => array($utilisateur->getMdp(),SQLITE3_TEXT),
|
|
|
|
':mdp' => array($utilisateur->getMdp(),PDO::PARAM_STR),
|
|
|
|
':estAdmin' => array($utilisateur->getEstAdmin(),SQLITE3_INTEGER)));
|
|
|
|
':estAdmin' => array($utilisateur->getEstAdmin(),PDO::PARAM_BOOL)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function delete(string $email) : void{
|
|
|
|
public function delete(string $email) : void{
|
|
|
|
$query = "DELETE FROM utilisateur WHERE email=:email";
|
|
|
|
$query = "DELETE FROM utilisateur WHERE email=:email";
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
':email' => array($email ,SQLITE3_TEXT)
|
|
|
|
':email' => array($email ,PDO::PARAM_STR)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ class UtilisateurGateway
|
|
|
|
global $error;
|
|
|
|
global $error;
|
|
|
|
$query = "SELECT * FROM Utilisateur WHERE email=:email";
|
|
|
|
$query = "SELECT * FROM Utilisateur WHERE email=:email";
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
':email' => array($email,SQLITE3_TEXT)
|
|
|
|
':email' => array($email,PDO::PARAM_STR)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
foreach ($results as $row) {
|
|
|
|
foreach ($results as $row) {
|
|
|
@ -51,14 +51,14 @@ class UtilisateurGateway
|
|
|
|
if ($results == null){
|
|
|
|
if ($results == null){
|
|
|
|
return new Utilisateur("null", "null", "null", false);
|
|
|
|
return new Utilisateur("null", "null", "null", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new Utilisateur($email, $pseudo, $mdp, $estAdmin,false);
|
|
|
|
return new Utilisateur($email, $pseudo, $mdp, $estAdmin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getMdpByEmail(string $email) : string{
|
|
|
|
public function getMdpByEmail(string $email) : string{
|
|
|
|
global $error;
|
|
|
|
global $error;
|
|
|
|
$query = "SELECT mdp FROM Utilisateur WHERE email=:email";
|
|
|
|
$query = "SELECT mdp FROM Utilisateur WHERE email=:email";
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
':email' => array($email,SQLITE3_TEXT)
|
|
|
|
':email' => array($email,PDO::PARAM_STR)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
foreach ($results as $row) {
|
|
|
|
foreach ($results as $row) {
|
|
|
@ -72,10 +72,9 @@ class UtilisateurGateway
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getEstAdminByEmail(string $email) : bool{
|
|
|
|
public function getEstAdminByEmail(string $email) : bool{
|
|
|
|
global $error;
|
|
|
|
|
|
|
|
$query = "SELECT estAdmin FROM Utilisateur WHERE email=:email";
|
|
|
|
$query = "SELECT estAdmin FROM Utilisateur WHERE email=:email";
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
':email' => array($email,SQLITE3_TEXT)
|
|
|
|
':email' => array($email,PDO::PARAM_STR)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
foreach ($results as $row) {
|
|
|
|
foreach ($results as $row) {
|
|
|
|