resolution des probléme de merge

pull/22/head^2
brongniart 5 months ago
parent 6281acbf84
commit 84ded532a3

@ -12,7 +12,7 @@ $base = '';
$login = '';
$mdp = '';
$racine='';
$racine='/~kekentin/WF/WF-Website';
//Vues

@ -15,7 +15,7 @@ if(!isset($_SESSION['theme'])){
require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbwikifantasy;', 'kiem', '');
$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');

@ -5,7 +5,7 @@ use Gateway\Connection;
Class FrontControler{
private array $listAction;
private $listAction;
private Connection $co;

@ -179,8 +179,7 @@ class UserControler {
*/
public function showQuestion(int $id, int $num) : void
{
global $vues;
global $twig;
global $vues,$twig;
$q = $this->GetQuestion($id);
$question = $q[$num] ?? $q[0];
$idquestion = $question->getIdQuestion();
@ -218,6 +217,7 @@ class UserControler {
global $vues;
if ($_POST)
{
$newImage = $_POST['image'] ?? null;
$newPseudo = $_POST['pseudo'] ?? null;
$newEmail = $_POST['email'] ?? null;
$newMdpFirst = $_POST['passwdFirst'] ?? null;
@ -244,9 +244,11 @@ class UserControler {
$user = $this-> uMod->setPassWd($_SESSION['user'], $newPassWd);
}
}
else if($newImage){
$user = $this->uMod->setImage($_SESSION['user']);
}
}
header("Location: /");
header("Location: ". $racine."/profil");
}

@ -87,14 +87,14 @@ Class VisitorControler {
*/
public function login()
{
//global $vues;
//require_once $vues['login'];
global $vues;
require_once $vues['login'];
global $twig;
//global $twig;
echo $twig->render("login.html.twig");
//echo $twig->render("login.html.twig");
$this -> toLogIn();
//$this -> toLogIn();
}
/**
@ -104,14 +104,14 @@ Class VisitorControler {
*/
public function signin(): void
{
//global $vues;
//require_once $vues['signin'];
global $vues;
require_once $vues['signin'];
global $twig;
//global $twig;
echo $twig->render("login.html.twig");
//echo $twig->render("login.html.twig");
$this -> signin();
//$this -> signin();
}
@ -129,7 +129,7 @@ Class VisitorControler {
{
if (password_verify($mdp, $user->getPassword()))
{
$_SESSION['user'] = $pseudo;
$_SESSION['user'] = Verification::verifChar($pseudo);
$_SESSION['role'] = 'user';
header("Location: ". $racine);
exit();

@ -23,7 +23,7 @@ class SourceEntity
$this->id_source = $id_source;
$this->title = $title;
$this->date = $date;
$this->type = $type;
//$this->type = $type;
}
/**
@ -74,6 +74,7 @@ class SourceEntity
$this->date = $date;
}
public function getType(): TypeSourceEnum
{
return $this->type;
@ -85,4 +86,5 @@ class SourceEntity
$this->type = $type;
}
}

@ -6,7 +6,11 @@ use PDOException;
Class QuoteGateway extends Gateway{
public function searchQuote(string $quote,int $numpage,string $language):array{
$query="SELECT q.id_quote, q.content, c.id_char, c.img_char, s.title, s.date, q.likes, q.langue FROM Quote q JOIN Characters c ON c.id_char = q.character 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;";
$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();
}
@ -14,7 +18,12 @@ Class QuoteGateway extends Gateway{
public function searchSource(string $source,int $numpage,string $language):array{
//recherche par source
$query="SELECT q.id_quote, q.content, c.character, c.img_path, s.title, s.date, q.likes, q.langue FROM Quote q JOIN Characters c ON c.id_char = 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;";
$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;
@ -23,7 +32,12 @@ 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.character, c.img_path, s.title, s.date, q.likes, q.langue FROM Quote q JOIN Characters c ON c.id_char = 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;";
$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;
@ -32,7 +46,12 @@ Class QuoteGateway extends Gateway{
public function searchId(string $id):array{
//recherche par id
$query="SELECT q.id_quote, q.content, c.character, i.imgPath, s.title, s.dates, q.likes, q.langue FROM Quote q JOIN Characters c ON c.id_char = q.character 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;
@ -41,7 +60,7 @@ Class QuoteGateway extends Gateway{
public function search(?string $type,?string $search,array $filtre):array{
$query="SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dates, q.likes, q.langue
FROM Quote q
JOIN Characters c ON c.id_caracter = q.id_caracter
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 lower(";
@ -70,7 +89,7 @@ Class QuoteGateway extends Gateway{
$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 Characters c ON c.id_caracter = q.id_caracter
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
@ -91,7 +110,7 @@ Class QuoteGateway extends Gateway{
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
FROM Quote q
JOIN Characters c ON c.id_caracter = q.id_caracter
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
@ -109,7 +128,7 @@ Class QuoteGateway extends Gateway{
$query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue
FROM Favorite f
JOIN Quote q ON f.quote = q.id_quote
JOIN Characters c ON c.id_caracter = q.id_caracter
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 f.users = :userId";

@ -6,17 +6,17 @@ use PDO;
class SourceGateway extends Gateway{
public function create(string $title, string $date, TypeSourceEnum $type) : bool
public function create(sourceEntity $s) : bool
{
$query = "
INSERT INTO Source
VALUES (:title, :type, :date)
VALUES( :title, :date)
";
return $this -> co -> executeQuery($query, [
"title" => array($title, PDO::PARAM_STR),
"date" => array($date, PDO::PARAM_STR),
"type" => array($type, PDO::PARAM_STR)
"title" => array($s->getTitle(), PDO::PARAM_STR),
"date" => array($s->getDate(), PDO::PARAM_STR),
"type" => array($s->getType(), PDO::PARAM_STR)
]);
}
@ -48,10 +48,11 @@ class SourceGateway extends Gateway{
{
$query = "SELECT * FROM Source WHERE dates = :d";
$this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]);
$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";
@ -59,6 +60,7 @@ class SourceGateway extends Gateway{
$this -> co -> executeQuery($query, ["t" => array($type, PDO::PARAM_STR)]);
return $this -> co -> getResults();
}
*/
public function findAll() : array
{
@ -74,7 +76,7 @@ class SourceGateway extends Gateway{
$source["id_source"],
$source["title"],
$source["date"],
$res["source"]
TypeSourceEnum::Movie//$res["source"]
);
}
return $sources;

@ -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;

@ -38,8 +38,8 @@
return new UserEntity(
$res[0]['id_user'],
$res[0]['username'],
$res[0]['email'],
$res[0]['password'],
$res[0]['email'],
$res[0]['img'],
$res[0]['creation']
);
@ -53,9 +53,9 @@
return new UserEntity(
$res[0]['id_user'],
$res[0]['username'],
$res[0]['email'],
$res[0]['password'],
$res[0]['img'],
$res[0]['email'],
$res[0]['imgpath'],
$res[0]['creation']
);
return null;
@ -68,8 +68,8 @@
return new UserEntity(
$res[0]['id_user'],
$res[0]['username'],
$res[0]['email'],
$res[0]['password'],
$res[0]['email'],
$res[0]['img'],
$res[0]['creation']
);

@ -8,7 +8,10 @@ class SourceModel extends Model
public function createSource(string $title, string $date, TypeSourceEnum $type) : bool
{
return $this -> gateway -> create($title, $date, $type);
$q = new SourceEntity(-1,$title, $date, TypeSourceEnum::Movie/*$type*/);
return $this -> gateway -> create($q);
}
public function getSourceById(int $id_source) : ?SourceEntity
@ -20,7 +23,7 @@ class SourceModel extends Model
$res[0]["id_source"],
$res[0]["title"],
$res[0]["dates"],
TypeSourceEnum::from($res[0]["type"])
TypeSourceEnum::Movie//from($res[0]["type"])
);
return null;
}
@ -33,7 +36,7 @@ class SourceModel extends Model
$res[0]["id_source"],
$res[0]["title"],
$res[0]["dates"],
TypeSourceEnum::from($res[0]["type"])
TypeSourceEnum::Movie//from($res[0]["type"])
);
return null;
}

Loading…
Cancel
Save