namespace de fait hehe
This commit is contained in:
parent
6c21a5f1cb
commit
0638834933
23 changed files with 131 additions and 81 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "yasse/projetphp",
|
"name": "groupe3/projetphp",
|
||||||
"description": "le projet php de ces mort",
|
"description": "le projet php de ces mort",
|
||||||
"require": {
|
"require": {
|
||||||
"smarty/smarty": "^5.7",
|
"smarty/smarty": "^5.7",
|
||||||
|
|
@ -8,13 +8,15 @@
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Guill\\Guillaume\\": "src/"
|
"Controllers\\": "controllers/",
|
||||||
|
"Entities\\": "entities/",
|
||||||
|
"Models\\": "models/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "GuillaumeH-Cci",
|
"name": "Le Meilleur groupe",
|
||||||
"email": "guillaume.hess@ccicampus.fr"
|
"email": "pasdemail@meilleurgroupe.ccicampus"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Controllers;
|
||||||
|
|
||||||
require("./models/project_model.php");
|
use Models\CategoryModel;
|
||||||
require("./entities/project_entity.php");
|
use Models\UserModel;
|
||||||
require("./models/category_model.php");
|
use Models\AuthorisationModel;
|
||||||
require("./entities/category_entity.php");
|
|
||||||
require("./models/image_model.php");
|
use Entities\Category;
|
||||||
require("./entities/image_entity.php");
|
use Entities\Authorisation;
|
||||||
require("./models/user_model.php");
|
use Entities\User;
|
||||||
require("./entities/user_entity.php");
|
|
||||||
require("./models/authorisation_model.php");
|
|
||||||
require("./entities/authorisation_entity.php");
|
|
||||||
require("mother_controller.php");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le controller de la partie accessible uniquement par l'admin
|
* Le controller de la partie accessible uniquement par l'admin
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require("mother_controller.php");
|
namespace Controllers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le contrôleur des erreurs
|
* Le contrôleur des erreurs
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Controllers;
|
||||||
|
|
||||||
use Smarty\Smarty;
|
use Smarty\Smarty;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("mother_controller.php");
|
namespace Controllers;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le controller de la page d'aide utilisateur
|
* Le controller de la page d'aide utilisateur
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
require("./models/project_model.php");
|
|
||||||
require("./entities/project_entity.php");
|
namespace Controllers;
|
||||||
require("./models/category_model.php");
|
|
||||||
require("./entities/category_entity.php");
|
|
||||||
require("./models/image_model.php");
|
|
||||||
require("./entities/image_entity.php");
|
use Models\ProjectModel;
|
||||||
require("./models/user_model.php");
|
use Models\CategoryModel;
|
||||||
require("./entities/user_entity.php");
|
use Models\ImageModel;
|
||||||
require("mother_controller.php");
|
use Models\UserModel;
|
||||||
|
|
||||||
|
|
||||||
|
use Entities\Project;
|
||||||
|
use Entities\Category;
|
||||||
|
use Entities\Authorisation;
|
||||||
|
use Entities\User;
|
||||||
|
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
use PHPMailer\PHPMailer\SMTP;
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("models/user_model.php");
|
namespace Controllers;
|
||||||
require("entities/user_entity.php");
|
|
||||||
require("mother_controller.php");
|
use Models\UserModel;
|
||||||
require("./models/project_model.php");
|
use Models\ProjectModel;
|
||||||
require("./entities/project_entity.php");
|
|
||||||
|
use Entities\User;
|
||||||
|
use Entities\Project;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le controller de la page d'aide utilisateur
|
* Le controller de la page d'aide utilisateur
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("mother_entity.php");
|
namespace Entities;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet Authorisation
|
* Classe d'un objet Authorisation
|
||||||
* @author Laura
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
class Authorisation extends Entity{
|
class Authorisation extends Mother{
|
||||||
|
|
||||||
private int $_id;
|
private int $_id;
|
||||||
private string $_name = '';
|
private string $_name = '';
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("mother_entity.php");
|
namespace Entities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet Category
|
* Classe d'un objet Category
|
||||||
* @author Laura
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Category extends Entity{
|
class Category extends Mother{
|
||||||
|
|
||||||
private ?int $_id = null;
|
private ?int $_id = null;
|
||||||
protected string $_name = '';
|
protected string $_name = '';
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("mother_entity.php");
|
namespace Entities;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet Projet
|
* Classe d'un objet Projet
|
||||||
* @author Laura
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
class Image extends Entity{
|
class Image extends Mother{
|
||||||
|
|
||||||
private int $_id;
|
private int $_id;
|
||||||
private string $_name = '';
|
private string $_name = '';
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un Mere de tout objet
|
* Classe d'un Mere de tout objet
|
||||||
* @author Yass & Laura
|
* @author Yass & Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Entity{
|
class Mother{
|
||||||
|
|
||||||
protected string $_prefix = '';
|
protected string $_prefix = '';
|
||||||
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("mother_entity.php");
|
namespace Entities;
|
||||||
|
|
||||||
|
use \DateTime;
|
||||||
|
use \IntlDateFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet Projet
|
* Classe d'un objet Projet
|
||||||
* @author Yass
|
* @author Yass
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Project extends Entity{
|
class Project extends Mother{
|
||||||
|
|
||||||
private ?int $_id = null;
|
private ?int $_id = null;
|
||||||
private string $_title = "";
|
private string $_title = "";
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("mother_entity.php");
|
namespace Entities;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet User
|
* Classe d'un objet User
|
||||||
* @author Besnik & Laura
|
* @author Besnik & Laura
|
||||||
*/
|
*/
|
||||||
class User extends Entity{
|
class User extends Mother{
|
||||||
private int $_id;
|
private int $_id;
|
||||||
private string $_name = '';
|
private string $_name = '';
|
||||||
private string $_firstname = '';
|
private string $_firstname = '';
|
||||||
37
index.php
37
index.php
|
|
@ -1,36 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
require(__DIR__ . "/vendor/autoload.php");
|
require(__DIR__ . "/vendor/autoload.php");
|
||||||
|
|
||||||
//environnement
|
// Environnement
|
||||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||||
$dotenv->safeLoad();
|
$dotenv->safeLoad();
|
||||||
|
|
||||||
$strCtrl = $_GET['ctrl']??'project';
|
$strCtrl = $_GET['ctrl'] ?? 'project';
|
||||||
$strMethod = $_GET['action']??'home';
|
$strMethod = $_GET['action'] ?? 'home';
|
||||||
|
|
||||||
$boolError = false;
|
$strClassName = "Controllers\\" . ucfirst($strCtrl) . "Ctrl";
|
||||||
$strFileName = "./controllers/".$strCtrl."_controller.php";
|
|
||||||
|
|
||||||
if(file_exists($strFileName)){
|
$boolError = false;
|
||||||
require($strFileName);
|
|
||||||
$strClassName = ucfirst($strCtrl)."Ctrl";
|
if (class_exists($strClassName)) {
|
||||||
if(class_exists($strClassName)){
|
$objController = new $strClassName();
|
||||||
$objController = new $strClassName();
|
|
||||||
if(method_exists($objController,$strMethod)){
|
if (method_exists($objController, $strMethod)) {
|
||||||
$objController->$strMethod ();
|
$objController->$strMethod();
|
||||||
}else{
|
} else {
|
||||||
$boolError = true;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$boolError = true;
|
$boolError = true;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$boolError = true;
|
$boolError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($boolError){
|
if ($boolError) {
|
||||||
header("Location:index.php?ctrl=error&action=error_404");
|
header("Location: index.php?ctrl=error&action=error_404");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('mother_model.php');
|
namespace Models;
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7,7 +9,7 @@
|
||||||
* @author : Laura
|
* @author : Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AuthorisationModel extends Connect{
|
class AuthorisationModel extends MotherModel{
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('mother_model.php');
|
namespace Models;
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traitement des requêtes pour les catégories
|
* Traitement des requêtes pour les catégories
|
||||||
* @author : Laura
|
* @author : Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CategoryModel extends Connect{
|
class CategoryModel extends MotherModel{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de récupération des catégories
|
* Fonction de récupération des catégories
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('mother_model.php');
|
namespace Models;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7,7 +9,7 @@
|
||||||
* @author Laura
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ImageModel extends Connect{
|
class ImageModel extends MotherModel{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de récupération des images
|
* Fonction de récupération des images
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
class Connect {
|
namespace Models;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
class MotherModel {
|
||||||
|
|
||||||
protected $_db;
|
protected $_db;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
try{
|
try{
|
||||||
$this->_db = new PDO(
|
$this->_db = new PDO(
|
||||||
"mysql:host=boulayoune.com;dbname=projet_folliow",
|
"mysql:host=localhost;dbname=projet_folliow",
|
||||||
"projet_user",
|
"projet_user",
|
||||||
"F0lliowRules!",
|
"F0lliowRules!",
|
||||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
|
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('mother_model.php');
|
namespace Models;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7,7 +10,7 @@
|
||||||
* @author Laura & Guillaume
|
* @author Laura & Guillaume
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ProjectModel extends Connect{
|
class ProjectModel extends MotherModel{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('mother_model.php');
|
namespace Models;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7,7 +10,7 @@
|
||||||
* @author : Yasser, Guillaume & Besnik
|
* @author : Yasser, Guillaume & Besnik
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UserModel extends Connect{
|
class UserModel extends MotherModel{
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB |
4
vendor/composer/autoload_psr4.php
vendored
4
vendor/composer/autoload_psr4.php
vendored
|
|
@ -12,7 +12,9 @@ return array(
|
||||||
'Smarty\\' => array($vendorDir . '/smarty/smarty/src'),
|
'Smarty\\' => array($vendorDir . '/smarty/smarty/src'),
|
||||||
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
|
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
|
||||||
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
|
'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'),
|
'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'),
|
||||||
|
'Entities\\' => array($baseDir . '/entities'),
|
||||||
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
|
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
|
||||||
|
'Controllers\\' => array($baseDir . '/controllers'),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
25
vendor/composer/autoload_static.php
vendored
25
vendor/composer/autoload_static.php
vendored
|
|
@ -26,15 +26,26 @@ class ComposerStaticInit68f8d029d347b4c0c8cdbe33eeb96101
|
||||||
'PhpOption\\' => 10,
|
'PhpOption\\' => 10,
|
||||||
'PHPMailer\\PHPMailer\\' => 20,
|
'PHPMailer\\PHPMailer\\' => 20,
|
||||||
),
|
),
|
||||||
|
'M' =>
|
||||||
|
array (
|
||||||
|
'Models\\' => 7,
|
||||||
|
),
|
||||||
'G' =>
|
'G' =>
|
||||||
array (
|
array (
|
||||||
'Guill\\Guillaume\\' => 16,
|
|
||||||
'GrahamCampbell\\ResultType\\' => 26,
|
'GrahamCampbell\\ResultType\\' => 26,
|
||||||
),
|
),
|
||||||
|
'E' =>
|
||||||
|
array (
|
||||||
|
'Entities\\' => 9,
|
||||||
|
),
|
||||||
'D' =>
|
'D' =>
|
||||||
array (
|
array (
|
||||||
'Dotenv\\' => 7,
|
'Dotenv\\' => 7,
|
||||||
),
|
),
|
||||||
|
'C' =>
|
||||||
|
array (
|
||||||
|
'Controllers\\' => 12,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $prefixDirsPsr4 = array (
|
public static $prefixDirsPsr4 = array (
|
||||||
|
|
@ -62,18 +73,26 @@ class ComposerStaticInit68f8d029d347b4c0c8cdbe33eeb96101
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
|
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
|
||||||
),
|
),
|
||||||
'Guill\\Guillaume\\' =>
|
'Models\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/../..' . '/src',
|
0 => __DIR__ . '/../..' . '/models',
|
||||||
),
|
),
|
||||||
'GrahamCampbell\\ResultType\\' =>
|
'GrahamCampbell\\ResultType\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
|
0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
|
||||||
),
|
),
|
||||||
|
'Entities\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/entities',
|
||||||
|
),
|
||||||
'Dotenv\\' =>
|
'Dotenv\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
|
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
|
||||||
),
|
),
|
||||||
|
'Controllers\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/controllers',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue