diff --git a/composer.json b/composer.json index c44dd27..a478818 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "yasse/projetphp", + "name": "groupe3/projetphp", "description": "le projet php de ces mort", "require": { "smarty/smarty": "^5.7", @@ -8,13 +8,15 @@ }, "autoload": { "psr-4": { - "Guill\\Guillaume\\": "src/" + "Controllers\\": "controllers/", + "Entities\\": "entities/", + "Models\\": "models/" } }, "authors": [ { - "name": "GuillaumeH-Cci", - "email": "guillaume.hess@ccicampus.fr" + "name": "Le Meilleur groupe", + "email": "pasdemail@meilleurgroupe.ccicampus" } ] } diff --git a/controllers/admin_controller.php b/controllers/AdminCtrl.php similarity index 88% rename from controllers/admin_controller.php rename to controllers/AdminCtrl.php index 3b1c579..b88ebae 100644 --- a/controllers/admin_controller.php +++ b/controllers/AdminCtrl.php @@ -1,16 +1,13 @@ safeLoad(); - $strCtrl = $_GET['ctrl']??'project'; - $strMethod = $_GET['action']??'home'; + $strCtrl = $_GET['ctrl'] ?? 'project'; + $strMethod = $_GET['action'] ?? 'home'; - $boolError = false; - $strFileName = "./controllers/".$strCtrl."_controller.php"; + $strClassName = "Controllers\\" . ucfirst($strCtrl) . "Ctrl"; - if(file_exists($strFileName)){ - require($strFileName); - $strClassName = ucfirst($strCtrl)."Ctrl"; - if(class_exists($strClassName)){ - $objController = new $strClassName(); - if(method_exists($objController,$strMethod)){ - $objController->$strMethod (); - }else{ - $boolError = true; - } - }else{ + $boolError = false; + + if (class_exists($strClassName)) { + $objController = new $strClassName(); + + if (method_exists($objController, $strMethod)) { + $objController->$strMethod(); + } else { $boolError = true; } - }else{ + } else { $boolError = true; } - if($boolError){ - header("Location:index.php?ctrl=error&action=error_404"); - } - + if ($boolError) { + header("Location: index.php?ctrl=error&action=error_404"); + exit; + } \ No newline at end of file diff --git a/models/authorisation_model.php b/models/AuthorisationModel.php similarity index 85% rename from models/authorisation_model.php rename to models/AuthorisationModel.php index 010660b..f98030b 100644 --- a/models/authorisation_model.php +++ b/models/AuthorisationModel.php @@ -1,5 +1,7 @@ _db = new PDO( - "mysql:host=boulayoune.com;dbname=projet_folliow", + "mysql:host=localhost;dbname=projet_folliow", "projet_user", "F0lliowRules!", array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) diff --git a/models/project_model.php b/models/ProjectModel.php similarity index 99% rename from models/project_model.php rename to models/ProjectModel.php index b12bf79..a248884 100644 --- a/models/project_model.php +++ b/models/ProjectModel.php @@ -1,5 +1,8 @@ array($vendorDir . '/smarty/smarty/src'), 'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), - 'Guill\\Guillaume\\' => array($baseDir . '/src'), + 'Models\\' => array($baseDir . '/models'), 'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'), + 'Entities\\' => array($baseDir . '/entities'), 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), + 'Controllers\\' => array($baseDir . '/controllers'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a7c1951..64f2380 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -26,15 +26,26 @@ class ComposerStaticInit68f8d029d347b4c0c8cdbe33eeb96101 'PhpOption\\' => 10, 'PHPMailer\\PHPMailer\\' => 20, ), + 'M' => + array ( + 'Models\\' => 7, + ), 'G' => array ( - 'Guill\\Guillaume\\' => 16, 'GrahamCampbell\\ResultType\\' => 26, ), + 'E' => + array ( + 'Entities\\' => 9, + ), 'D' => array ( 'Dotenv\\' => 7, ), + 'C' => + array ( + 'Controllers\\' => 12, + ), ); public static $prefixDirsPsr4 = array ( @@ -62,18 +73,26 @@ class ComposerStaticInit68f8d029d347b4c0c8cdbe33eeb96101 array ( 0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src', ), - 'Guill\\Guillaume\\' => + 'Models\\' => array ( - 0 => __DIR__ . '/../..' . '/src', + 0 => __DIR__ . '/../..' . '/models', ), 'GrahamCampbell\\ResultType\\' => array ( 0 => __DIR__ . '/..' . '/graham-campbell/result-type/src', ), + 'Entities\\' => + array ( + 0 => __DIR__ . '/../..' . '/entities', + ), 'Dotenv\\' => array ( 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', ), + 'Controllers\\' => + array ( + 0 => __DIR__ . '/../..' . '/controllers', + ), ); public static $classMap = array (