pull/30/head
brongniart 3 months ago
commit 63ab93f3ca

@ -12,6 +12,7 @@ $base = '';
$login = '';
$mdp = '';
//$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website /~lebeaulato/WF-Website /~kemondejar/WF-Website
$racine='/~kekentin/WF/WF-Website';
//$repImg='/home/UCA/kemondejar/public_html/WF-Website/public/images/';

@ -13,6 +13,8 @@
/*--main-light-gradient : linear-gradient(90deg, #AAB9CF, #BDD4E7);*/
--main-light-gradient : #84e4a9;
--main-light-other-color : #46BE73;
/* --main-light-gradient : #94d3ac;
--main-light-other-color : #75b48d; */
}
@ -23,7 +25,7 @@
/* Général */
body{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
margin : 0%;
}

@ -27,7 +27,7 @@ body.light-mode .resultat {
/* ====== ECRAN DEFAUT ====== */
h1 {
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
}

@ -61,7 +61,7 @@ body.light-mode a{
}
h1{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
font-size: 32px;
margin-top: 10%;
@ -71,7 +71,7 @@ p{
margin-top: 6%;
margin-bottom: 2%;
font-size: 20px;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
.login{
@ -88,11 +88,11 @@ p{
font-size: 1em;
text-align: center;
padding-top: 1%;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
.buttonSudmite{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
border: none;
padding: 2%;
border-radius: 25px;

@ -10,8 +10,9 @@ body.dark-mode p{
}
body.dark-mode :popover-open {
background: var(--main-dark-gradient);
background: black;
color: var(--main-dark-text-color);
border-color: black;
}
body.dark-mode .buttonSudmite{
@ -33,7 +34,7 @@ body.dark-mode .imgModify{
body.light-mode .inputPasswd{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
margin-top: 2%;
color: black;
}
@ -54,8 +55,9 @@ body.light-mode p{
body.light-mode :popover-open {
background: var(--main-light-gradient);
background: white;
color: var(--main-light-text-color);
border-color: white;
}
body.light-mode .buttonSubmit{
@ -75,7 +77,7 @@ body.light-mode .login{
body.light-mode .inputPasswd{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
margin-top: 2%;
color: black;
}
@ -88,7 +90,7 @@ body.light-mode .saveButtonPasswd {
/* ====== ECRAN DEFAUT ====== */
h1{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
font-size: 35px;
}
@ -97,7 +99,7 @@ p{
margin-top: 4%;
margin-bottom: 2%;
font-size: 20px;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
::backdrop {
@ -108,12 +110,28 @@ p{
height: 60%;
font-size: 15px;
text-align: center;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
display: flex;
flex-wrap: wrap;
border: 15px solid;
border-radius: 20px;
}
:popover-open >* {
flex: 1 1 20%;
}
.ChangeImg{
display:block;
margin: auto;
}
.imageProfil{
margin-bottom: 20vh;
}
.buttonSudmite{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
border: none;
padding: 2%;
border-radius: 25px;
@ -127,7 +145,7 @@ p{
font-size: 15px;
text-align: center;
padding-top: 1%;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
.login{
@ -153,7 +171,7 @@ p{
border-radius: 25px;
border: none;
font-size: 15px;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}

@ -22,7 +22,7 @@ body.dark-mode .submit-button {
body.dark-mode .buttonSudmite {
background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%);
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
border: none;
color: white;
padding: 10px 20px;
@ -50,7 +50,7 @@ body.light-mode .answer {
/* ====== ECRAN DEFAUT ====== */
h1, h2, p {
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
}

@ -160,7 +160,7 @@ body.light-mode .like-icon-none img {
background-color: #fff;
color: black;
display: flex;
font-family: "Lemon", sans-serif;
font-family: "roboto condensed", sans-serif;
flex-direction: column;
margin-bottom: 1vh;
border-radius: 20px;

@ -50,7 +50,7 @@ body.light-mode a{
/* ====== ECRAN DEFAULT ====== */
h1{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
font-size: 32px;
margin-top: 10%;
@ -68,7 +68,7 @@ p{
margin-top: 4%;
margin-bottom: 2%;
font-size: 20px;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
.confirmer{
@ -87,7 +87,7 @@ p{
}
.btn{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
border: none;
padding: 2%;
border-radius: 25px;
@ -101,7 +101,7 @@ p{
font-size: 1em;
text-align: center;
padding-top: 1%;
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
}
.createAccount{

@ -25,7 +25,7 @@ body.light-mode #box{
/* ====== ECRAN DEFAULT ====== */
h1, h2{
font-family: "Lemon", serif;
font-family: "roboto condensed", sans-serif;
text-align: center;
}

@ -16,7 +16,7 @@ Class FrontControler{
global $twig,$racine;
$this->listAction = ['visitor' => array('accueil','search','quote','login','signin','validlogin','validsignin'),
'user' => array('quiz','randomQuiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit', 'add', 'accueilQuiz'),
'user' => array('quiz','randomQuiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit', 'add', 'accueilQuiz', 'deleteAccount'),
'admin' => array('null')];
$dVueEreur = [];
@ -57,6 +57,8 @@ Class FrontControler{
$router->map('GET|POST', '/accueilQuiz', 'UserControler', 'accueilQuiz');
$router->map('GET|POST', '/error', 'VisitorControler','error');
$router->map('GET|POST', '/randomQuiz', 'UserControler','randomQuiz');
$router->map('GET|POST', '/deleteAccount', 'UserControler', 'deleteAccount');
$match = $router->match();

@ -516,6 +516,7 @@ class UserControler {
return null;
}
public function add(){
global $vues, $repImg;
$error = [];
@ -618,20 +619,67 @@ class UserControler {
}
public function sendEmailChangeLogin(string $email) : void{
$to = $email; // Adresse email de destination
$subject = "What The Fantasy - Changement d'Email"; // Sujet de l'email
$message = "
Bonjour,
// ===================== DELETE ACCOUNT FUNCTION =====================
public function deleteAccount(){
$this->uMod->deleteAllCommentary($_SESSION["user"]); // Delete all commentary
$this->uMod->deleteAllFavorite($_SESSION["user"]); // Delete all favorite
$this->uMod->deleteAccount($_SESSION["user"]);
$this->unlog();
}
// ===================== EMAIL FUNCTION =====================
public function sendEmailChangeLogin(string $email) {
// Génère les données du message
$sujet = "What The Fantasy - Changement d'Email";
$urlImage = "public/images/Baneer.png";
// Génère une frontière unique pour l'email
$boundary = "-----=" . md5(uniqid(mt_rand()));
//Instancie les headers
$headers = "From: noreply@whatTheFantasy.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/related; boundary=\"$boundary\"\r\n";
L'adresse mail $email est désormais votre nouvelle adresse.
// Corps de l'email HTML avec l'image intégrée
$corpsMessage = "--$boundary\r\n";
$corpsMessage .= "Content-Type: text/html; charset=UTF-8\r\n";
$corpsMessage .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
L'équipe du site
"; // Contenu de l'email
$headers = "From: noreply@whatTheFantasy.com"; // Adresse email de l'expéditeur
// Ajoute le message HTML
$corpsMessage .= "<html>
<body>
<img src=\"cid:image1\" alt=\"Image\" style=\"width: 1200px; height: auto;\" />
<p>Bonjour,</p>
<p>Vous venez de changer votre adresse mail. Dorénavant, votre email sera $email.</p>
<p>L'équipe du site</p>
</body>
</html>\r\n";
// Ajoute l'image en pièce jointe
$corpsMessage .= "--$boundary\r\n";
$corpsMessage .= "Content-Type: image/jpeg; name=\"image.jpg\"\r\n";
$corpsMessage .= "Content-Transfer-Encoding: base64\r\n";
$corpsMessage .= "Content-ID: <image1>\r\n\r\n";
$imageContent = file_get_contents($urlImage);// Lecture et encodage de l'image en base64
if ($imageContent === false) {
return "Impossible de charger l'image spécifiée.";
}
$corpsMessage .= chunk_split(base64_encode($imageContent)) . "\r\n";
// Envoyer l'email
mail($to, $subject, $message, $headers);
$corpsMessage .= "--$boundary--";// Fin du corps de l'email
mail($email, $sujet, $corpsMessage, $headers);// Envoi de l'email
}
}

@ -243,7 +243,7 @@ Class VisitorControler {
// Ajoute le message HTML
$corpsMessage .= "<html>
<body>
<img src=\"cid:image1\" alt=\"Image\" style=\"width: 400px; height: auto;\" />
<img src=\"cid:image1\" alt=\"Image\" style=\"width: 1200px; height: auto;\" />
<p>Bonjour $pseudo,</p>
<p>Merci de vous être inscrit sur notre site What The Fantasy. Cest avec grande joie que nous vous accueillons au sein de notre confrérie, pour découvrir ensemble...
@ -253,7 +253,7 @@ Class VisitorControler {
</body>
</html>\r\n";
// Ajoute l'image en pièce jointe avec un CID
// Ajoute l'image en pièce jointe
$corpsMessage .= "--$boundary\r\n";
$corpsMessage .= "Content-Type: image/jpeg; name=\"image.jpg\"\r\n";
$corpsMessage .= "Content-Transfer-Encoding: base64\r\n";

@ -1,6 +1,8 @@
<?php
namespace Entity;
use Enum\TypeSourceEnum;
class Quote{
private int $id;
@ -11,6 +13,7 @@
private string $dateSrc;
private int $like;
private string $langue;
private TypeSourceEnum $type;
/**
* @param int $id
@ -22,7 +25,7 @@
* @param int $like
* @param string $langue
*/
public function __construct(int $id, string $content, string $carac, string $imgPath, string $titleSrc, string $dateSrc, int $like, string $langue)
public function __construct(int $id, string $content, string $carac, string $imgPath, string $titleSrc, string $dateSrc, int $like, string $langue, TypeSourceEnum $type)
{
$this->id = $id;
$this->content = $content;
@ -32,6 +35,7 @@
$this->dateSrc = $dateSrc;
$this->like = $like;
$this->langue = $langue;
$this->type = $type;
}
/**
@ -162,7 +166,13 @@
$this->langue = $langue;
}
public function getType(): TypeSourceEnum{
return $this->type;
}
public function setType(TypeSourceEnum $type){
$this->type = $type;
}
}
?>

@ -25,7 +25,7 @@ class QuizGateway extends Gateway
public function findQuizById(int $id) : array
{
$query = "SELECT * FROM Quiz WHERE id_quiz = :id_q";
$query = "SELECT id_quiz, title, imgPath, nb_quest FROM Quiz q JOIN Image i on q.img = i.id_img WHERE id_quiz = :id_q";
$this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]);
return $this -> co -> getResults();
}
@ -43,4 +43,10 @@ class QuizGateway extends Gateway
return $this -> co -> getResults();
}
public function getNumberOfQuestion(int $id) : intdiv{
$query = "SELECT nb_quest FROM quiz WHERE id_quiz = :id_q";
$this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]);
return $this -> co -> getResults();
}
}

@ -75,14 +75,30 @@ Class UserGateway extends Gateway{
$query = 'SELECT id_user FROM Users WHERE username = :username';
$this->co->executeQuery($query, array(':username' => array($username,PDO::PARAM_STR)));
$result = $this->co->getResults()[0]['id_user'];
var_dump($result);
var_dump($id);
$query = 'DELETE FROM Favorite WHERE users = :user AND quote = :id;';
$this->co->executeQuery($query, array(':user' => array($result,PDO::PARAM_INT), ':id' => array($id,PDO::PARAM_INT)));
$query = 'UPDATE Quote SET likes = (likes - 1) WHERE id_quote = :id';
$this->co->executeQuery($query, array(':id' => array($id,PDO::PARAM_INT)));
}
public function deleteAllCommentaryUser(string $user){
$query = 'DELETE FROM Commentary WHERE users IN ( SELECT id_user FROM Users WHERE username = :user);';
$this->co->executeQuery($query, array(':user'=>array($user, PDO::PARAM_STR)));
}
public function deleteAllFavoriteUser(string $user){
$query = 'DELETE FROM Favorite WHERE users IN ( SELECT id_user FROM Users WHERE username = :user);';
$this->co->executeQuery($query, array(':user'=>array($user, PDO::PARAM_STR)));
}
public function deleteUser(string $user){
$query = 'DELETE FROM Users WHERE username=:user;';
$this->co->executeQuery($query, array(':user'=>array($user, PDO::PARAM_STR)));
}
// ===================== GET FUNCTION =====================
public function getFavorite(string $id):array{

@ -20,7 +20,7 @@ class QuizModel extends Model{
return new QuizEntity(
$q[0]['id_quiz'],
$q[0]['nb_quest'],
$q[0]['img'],
$q[0]['imgpath'],
$q[0]['title']
);
}

@ -3,6 +3,7 @@
use Entity\Quote;
use Gateway\QuoteGateway;
use Gateway\Gateway;
use Enum\TypeSourceEnum;
class QuoteModel extends Model
{
@ -12,7 +13,7 @@
if( count($res) == 0)
return new Quote(-1,"NULL","NULL","NULL","NULL","NULL",0,"Default");
else
return new Quote($res[0]["id_quote"],$res[0]["content"],$res[0]["caracter"],$res[0]["imgpath"],$res[0]["title"],$res[0]["dates"],$res[0]["likes"],$res[0]["langue"]);
return new Quote($res[0]["id_quote"],$res[0]["content"],$res[0]["caracter"],$res[0]["imgpath"],$res[0]["title"],$res[0]["dates"],$res[0]["likes"],$res[0]["langue"],TypeSourceEnum::Movie);
}
public function getSuggest(int $numpage, string $language):array{
@ -21,7 +22,7 @@
foreach($res as $q ){
$q["content"] = (strlen($q["content"]) > 153) ? substr($q["content"],0,150).'...' : $q["content"];
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"]) ;
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"],TypeSourceEnum::Movie) ;
}
return $tabQ;
}
@ -29,10 +30,10 @@
public function getQuoteOfTheDay(string $language):Quote{
$res = $this->gateway->getQuoteOfTheDay($language);
if( count($res) == 0)
return new Quote(-1,"NULL","NULL","NULL","NULL","NULL",0,"Default");
return new Quote(-1,"NULL","NULL","NULL","NULL","NULL",0,"Default",TypeSourceEnum::Movie);
else
$res["content"] = (strlen($res["content"]) > 153) ? substr($res["content"],0,150).'...' : $res["content"];
return new Quote($res["id_quote"],$res["content"],$res["caracter"],$res["imgpath"],$res["title"],$res["dates"],$res["likes"],$res["langue"]) ;
return new Quote($res["id_quote"],$res["content"],$res["caracter"],$res["imgpath"],$res["title"],$res["dates"],$res["likes"],$res["langue"],TypeSourceEnum::Movie) ;
}
public function getFavorites(string $userId): array {
@ -41,7 +42,7 @@
foreach($res as $q ){
$q["content"] = (strlen($q["content"]) > 153) ? substr($q["content"],0,150).'...' : $q["content"];
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"]) ;
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"],TypeSourceEnum::Movie) ;
}
return $tabQ;
}

@ -3,6 +3,7 @@
use Entity\Quote;
use Gateway\QuoteGateway;
use Gateway\Gateway;
use Enum\TypeSourceEnum;
class SearchModel extends Model
{
@ -14,7 +15,7 @@
foreach($res as $q ){
$q["content"] = (strlen($q["content"]) > 153) ? substr($q["content"],0,150).'...' : $q["content"];
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"]) ;
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"],TypeSourceEnum::Movie) ;
}
return $tabQ;
}

@ -170,6 +170,22 @@
public function supFavorite(string $username, int $id){
$this->gateway->supFavorite($username,$id);
}
// ===================== DELETE FUNCTION =====================
public function deleteAllCommentary(string $username){
$this->gateway->deleteAllCommentaryUser($username);
}
public function deleteAllFavorite(string $username){
$this->gateway->deleteAllFavoriteUser($username);
}
public function deleteAccount(string $username){
$this->gateway->deleteUser($username);
}
}
?>

@ -1,4 +1,5 @@
<?php
use Enum\TypeSourceEnum;
global $twig;
@ -17,5 +18,6 @@
'nbLike' => $q->getLike(),
'idQuote' => $q->getId(),
'com' => $c,
'type' => $q->getType()->name,
'fav' => $f));
?>

@ -6,7 +6,7 @@
<input type="text" class="connexion" name="pseudo" id="pseudo" placeholder="Entrez votre pseudo" required />
<p> <strong> Mot de passe *</strong></p>
<input type="password" class="connexion" name="mdp" id="mdp" placeholder="Entrez votre mdp" required />
<input type="password" class="connexion" name="mdp" id="mdp" placeholder="Entrez votre mot de passe" required />
{% if error is defined and error is not empty %}
<p style="color: red">{{ error }}</p>

@ -55,6 +55,12 @@
<button class="buttonSudmite">Se déconnecter</button>
</a>
</div>
<div class="buttonSudmiteDiv">
<a href="{{ racine }}/deleteAccount" class="createQuote">
<button class="buttonSudmite">Supprimer son compte</button>
</a>
</div>
</div>
</body>

@ -19,7 +19,7 @@
<div class="part2">
<div class="info">
<ul class="infoQuote">
<li>- {{sourceName}}</li>
<li>- {{sourceName}} ({{type}})</li>
<li>- {{nameCarac}}</li>
<li>- {{dateSortie}}</li>
</ul>

@ -1,4 +1,4 @@
<h1>▶ Your quote has been submitted successfully ◀</h1>
<h1>Votre citation a corectement été envoyé</h1>
<div>

Loading…
Cancel
Save