merge avec php

correction_routeur
Renaud BEURET 1 year ago
commit c1b10a7b88

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/project/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/exception" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/gateways" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/mdl" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/metier" isTestSource="false" packagePrefix="model" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="ProjetPHP">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

@ -1,6 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4"> <component name="PhpProjectSharedConfiguration" php_language_level="7.4">
<option name="suggestChangeDefaultLanguageLevel" value="false" /> <option name="suggestChangeDefaultLanguageLevel" value="false" />
</component> </component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project> </project>

@ -3,13 +3,8 @@ namespace config;
$config = [ $config = [
"rep" => __DIR__.'/../', "rep" => __DIR__.'/../',
"db" => ["dsn" => 'pgsql:host=localhost;dbname=dbrebeuret', "db" => ["dsn" => 'pgsql:host=localhost;dbname=dbrebeuret',
"login" => 'rebeuret', "login" => 'rebeuret',
"mdp" => 'achanger'], "mdp" => 'achanger']
"templates" => ["index" => 'vues/index.php',
"pseudo" => 'pseudo.html',
"pendu" => "pendu.html",
"penduScore" => 'penduScore.html']
]; ];
?>

@ -13,6 +13,7 @@ class FrontController
private Connection $con; private Connection $con;
public function __construct() public function __construct()
{ {
global $twig, $router; global $twig, $router;
global $basePath; global $basePath;
@ -22,6 +23,7 @@ class FrontController
$router->map('GET|POST','/[a:action]?','UserController'); $router->map('GET|POST','/[a:action]?','UserController');
$router->map('GET|POST','/admin/[a:action]','AdminController'); $router->map('GET|POST','/admin/[a:action]','AdminController');
$router->map('GET|POST', '/validationFormulaire', 'validationFormulaire'); $router->map('GET|POST', '/validationFormulaire', 'validationFormulaire');
$router->map('GET|POST', '/logout', 'disconnect'); $router->map('GET|POST', '/logout', 'disconnect');
@ -85,7 +87,6 @@ class FrontController
exit(0); exit(0);
} }
private function callController(string $cont, array $match) { private function callController(string $cont, array $match) {
global $twig; global $twig;

@ -0,0 +1,40 @@
<?php
namespace controller;
use config\Validation;
use Exception;
use model\ValidationException;
class JouerController{
public function __construct(){
global $twig, $config;
$dVue = [];
$dVueErreur = [];
if(isset($_SESSION["configuration"]) && isset($_SESSION['role'])){
try{
$role = $_SESSION['role'];
$role = Validation::valRole($role, $dVueErreur);
$configurationJeu = $_SESSION['configuration'];
$configurationJeu = Validation::valConfigurationJeu($configurationJeu, $dVueErreur);
}catch(ValidationException $e){
header('Location: .');
}
if(count($dVueErreur) == 0){
$idJeu = $configurationJeu->getJeu()->getId();
switch($idJeu){
case 3:
new PenduController($role, $configurationJeu);
break;
default:
throw new Exception("Jeu non défini !");
break;
}
}
}else{
header("Location: .");
}
}
}

@ -27,6 +27,7 @@ class PseudoController{
}catch(IdSessionDoubleException $e){ }catch(IdSessionDoubleException $e){
try{ try{
$role = $mdlInvite->setPseudo($e->getIdJoueur(), $pseudo); $role = $mdlInvite->setPseudo($e->getIdJoueur(), $pseudo);
}catch(PseudoDejaPrisException $e){ }catch(PseudoDejaPrisException $e){
$dVueErreur[] = "Pseudo déjà pris"; $dVueErreur[] = "Pseudo déjà pris";
} }

@ -1,3 +1,4 @@
-- Testé sous pgsql 15 -- Testé sous pgsql 15
DROP TABLE IF EXISTS Reponse; DROP TABLE IF EXISTS Reponse;
@ -77,7 +78,6 @@ CREATE TABLE Indice(
idScientifique integer REFERENCES Scientifique(id) idScientifique integer REFERENCES Scientifique(id)
); );
-- QUESTION -- QUESTION
CREATE TABLE Question( CREATE TABLE Question(

@ -25,7 +25,7 @@
}, },
"time": "2020-03-09T08:34:59+00:00", "time": "2020-03-09T08:34:59+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"classmap": [ "classmap": [
"AltoRouter.php" "AltoRouter.php"
@ -98,7 +98,7 @@
"url": "https://github.com/symfony/polyfill" "url": "https://github.com/symfony/polyfill"
} }
}, },
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
@ -183,7 +183,7 @@
"url": "https://github.com/symfony/polyfill" "url": "https://github.com/symfony/polyfill"
} }
}, },
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
@ -254,7 +254,7 @@
}, },
"time": "2023-09-14T14:19:27+00:00", "time": "2023-09-14T14:19:27+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "source",
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
@ -313,7 +313,7 @@
}, },
"time": "2023-08-28T11:09:02+00:00", "time": "2023-08-28T11:09:02+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Twig\\": "src/" "Twig\\": "src/"

@ -3,7 +3,7 @@
'name' => '__root__', 'name' => '__root__',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '4faf5aeca4c05c9018b964ff1861f0cf14a736b4', 'reference' => '00bb454e9942b812011d11c9ae30149a30c65d99',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -13,7 +13,7 @@
'__root__' => array( '__root__' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '4faf5aeca4c05c9018b964ff1861f0cf14a736b4', 'reference' => '00bb454e9942b812011d11c9ae30149a30c65d99',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

Loading…
Cancel
Save