diff --git a/config/config.php b/config/config.php index 1a2bbb9..13c4fe2 100644 --- a/config/config.php +++ b/config/config.php @@ -12,8 +12,8 @@ $base = ''; $login = ''; $mdp = ''; -//$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website -$racine='/WF-Website'; +$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website +//$racine='/WF-Website'; //Vues diff --git a/index.php b/index.php index 7eae2ac..33bc65b 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,8 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute');// ('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd') +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/public/styles/style.css b/public/styles/style.css index dc57f62..c265563 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -7,9 +7,14 @@ --main-dark-other-color : #000000; --main-light-background-color: #ffffff; + /*--main-light-background-color: #ffffff;*/ --main-light-text-color : #000000; - --main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA); - --main-light-other-color : #d2d2d8; + --main-light-gradient : linear-gradient(90deg, #78b3eb, #64c1ff); + /*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/ + /*--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);*/ + --main-light-other-color : #f8eaff; + /*--main-light-other-color : #f8eaff;*/ + /*--main-light-other-color : #d2d2d8;*/ } /* Général */ diff --git a/public/styles/styleProfil.css b/public/styles/styleProfil.css index 8e9c64f..abca93f 100644 --- a/public/styles/styleProfil.css +++ b/public/styles/styleProfil.css @@ -34,6 +34,11 @@ body.light-mode .inputPasswd{ color: black; } +body.dark-mode .saveButtonPasswd { + background: var(--main-dark-gradient); + color: var(--main-dark-text-color); +} + /* ====== LIGHT MODE ====== */ body.light-mode h1{ color : var(--main-light-text-color); @@ -66,6 +71,11 @@ body.light-mode .inputPasswd{ color: black; } +body.light-mode .saveButtonPasswd { + background: var(--main-light-gradient); + color: var(--main-light-text-color); +} + /* ====== ECRAN DEFAUT ====== */ h1{ @@ -102,12 +112,12 @@ p{ .login{ width: 30vw; - height: 78vh; + /*height: 78vh;*/ margin: auto; margin-top: 17vh; border-radius: 25px; padding-top: 1px; - padding-bottom: 1%; + padding-bottom: 2%; } .imgModify{ @@ -128,6 +138,15 @@ p{ } .saveButtonPasswd { + display: block; + margin: auto; + padding: 1vh;; + margin-top: 1vh; + border-radius: 25px; + border: none; +} + +.ChangeImg{ display: block; margin: auto; background: transparent; diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index ab3cb62..e38d0c8 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -16,7 +16,7 @@ Class FrontControler{ global $twig,$racine; $this->listAction = ['visitor' => array('accueil','search','quote','login','signin','validlogin','validsignin'), - 'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit'), + 'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit', 'add'), 'admin' => array('null')]; $dVueEreur = []; @@ -53,6 +53,7 @@ Class FrontControler{ $router->map('GET|POST', '/changedata', 'UserControler','changedata'); $router->map('GET|POST', '/submit', 'UserControler', 'submit'); $router->map('GET|POST', '/validsubmit', 'UserControler', 'validsubmit'); + $router->map('GET|POST', '/add', 'UserControler', 'add'); $match = $router->match(); diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index fc30281..63ae00d 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -29,6 +29,7 @@ class UserControler { private QuoteModel $qMod; private QuestionModel $mdl; private CharacterModel $caMod; + private SourceModel $srcMod; public function __construct() { global $co; @@ -376,4 +377,70 @@ class UserControler { } return null; } + + public function add(){ + global $vues; + var_dump($_POST); + $error = []; + if($_POST['req'] == "both"){ + $src = true; + $char = true; + } + elseif($_POST['req'] == "src"){ + $src = true; + $char = false; + $type = array("Movie","Serie","VideoGame","Anime"); + if(Verification::verifNotNull($_POST["titre"])){ + $_POST["titre"] = Verification::verifChar($_POST["titre"]); + if($this->srcMod->existSource($_POST["titre"],$_POST["type"])){ + $error[] = "La source existe déja"; + } + } + else{ + $error[] = "Le titre doit être définit"; + } + if(Verification::verifNotNull($_POST["date"])){ + $src = true; + $char = false; + $_POST["date"] = Verification::verifChar($_POST["date"]); + if(intval($_POST["date"],10) < 1850 or intval($_POST["date"],10) > date( "Y", time() )){ + $error[] = "La date est invalide"; + } + } + else{ + $error[] = "La date doit être définit"; + } + if(Verification::verifNotNull($_POST["type"])){ + $_POST["type"] = Verification::verifChar($_POST["type"]); + if(!in_array($_POST["type"],$type)){ + $error[] = "Le type indiquer est inexistant"; + } + } + else{ + $error[] = "Le type doit être définit"; + } + } + elseif($_POST['req'] == "char"){ + $src = false; + $char = true; + if(Verification::verifNotNull($_POST[""])){ + + } + } + if($error == []){ + if($_POST['req'] == "both"){ + + } + elseif($_POST['req'] == "src"){ + $this->srcMod->createSource($_POST["titre"], $_POST["date"], $_POST["type"]); + } + elseif($_POST['req'] == "char"){ + + } + } + else{ + require_once($vues["create"]); + var_dump($error); + } + } } diff --git a/src/Enum/TypeSourceEnum.php b/src/Enum/TypeSourceEnum.php index dbc5bfa..4a20ac1 100644 --- a/src/Enum/TypeSourceEnum.php +++ b/src/Enum/TypeSourceEnum.php @@ -5,5 +5,5 @@ enum TypeSourceEnum : string { case Movie = 'movie'; case VideoGame = 'video-game'; case Anime = 'anime'; - case TV = 'tv'; + case Serie = 'serie'; } \ No newline at end of file diff --git a/src/Gateway/SourceGateway.php b/src/Gateway/SourceGateway.php index 15bff2b..402d30b 100644 --- a/src/Gateway/SourceGateway.php +++ b/src/Gateway/SourceGateway.php @@ -16,7 +16,7 @@ class SourceGateway extends Gateway{ return $this -> co -> executeQuery($query, [ "title" => array($s->getTitle(), PDO::PARAM_STR), "date" => array($s->getDate(), PDO::PARAM_STR), - "type" => array($s->getType(), PDO::PARAM_STR) + #"type" => array($s->getType(), PDO::PARAM_STR) ]); } diff --git a/src/Model/SourceModel.php b/src/Model/SourceModel.php index 2a7b6e4..d43579b 100644 --- a/src/Model/SourceModel.php +++ b/src/Model/SourceModel.php @@ -104,5 +104,9 @@ class SourceModel extends Model return false; } + public function existSource(string $name, string $type) : bool{ + $q = $this -> getSourceByTitle($name); + return isset($q[0]); + } } diff --git a/src/Verification/Verification.php b/src/Verification/Verification.php index a3ac123..eef98ab 100644 --- a/src/Verification/Verification.php +++ b/src/Verification/Verification.php @@ -39,8 +39,8 @@ namespace Verification; return $tabText; } - public static function verifNotNull($val){ - + public static function verifNotNull($val) :bool{ + return empty($var); } } diff --git a/vue/templates/create.html.twig b/vue/templates/create.html.twig index 1661284..4eae2d1 100644 --- a/vue/templates/create.html.twig +++ b/vue/templates/create.html.twig @@ -1,16 +1,43 @@
+ {% if src == true and char == true %} + + {% elseif src == true %} + + {% elseif char == true %} + + {% endif %} {% if src == true %}

Source

- - - + + + + + + +
+ + + + + +
+ + + + {% endif %} {% if char == true %} - +

Personnage

+ + + + + + {% endif %} - +
\ No newline at end of file diff --git a/vue/templates/profil.html.twig b/vue/templates/profil.html.twig index 599ff40..9f708fa 100644 --- a/vue/templates/profil.html.twig +++ b/vue/templates/profil.html.twig @@ -3,8 +3,7 @@

▶ Profil ◀

- {# #} - +

{{ srcUsername }}

@@ -14,7 +13,7 @@

Votre mot de passe

- +

Language :

@@ -23,7 +22,7 @@
- Ajouter une citation + Ajouter une citation