Ajout d'un modele pour Utilisateur, j ai commencer à pouvoir inscrire une personne et que le formulaire d'inscription est bien vérifier, j ai changer les vues (design, nom, css...), J ai changer presque tout les classes de façon plus optimiser, j ai ajouter le FrontControleur.php!
parent
7d758156fd
commit
27f0e15458
@ -1,145 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Controller;
|
|
||||||
|
|
||||||
class Controleur {
|
|
||||||
|
|
||||||
function __construct() {
|
|
||||||
global $rep,$vues; // nécessaire pour utiliser variables globales
|
|
||||||
// on démarre ou reprend la session
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
|
|
||||||
//debut
|
|
||||||
|
|
||||||
//on initialise un tableau d'erreur
|
|
||||||
$dVueEreur = array ();
|
|
||||||
|
|
||||||
try{
|
|
||||||
$action=NULL;
|
|
||||||
if(isset($_REQUEST['action'])){
|
|
||||||
$action = $_REQUEST["action"];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch($action) {
|
|
||||||
|
|
||||||
//pas d'action, on réinitialise 1er appel
|
|
||||||
case NULL:
|
|
||||||
$this->Reinit();
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case "validationFormulaire":
|
|
||||||
$this->ValidationFormulaire($dVueEreur);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "redirectionLogin":
|
|
||||||
$this->redirectionLogin($dVueEreur);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "redirectionInscription":
|
|
||||||
$this->redirectionInscription($dVueEreur);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "seConnecter":
|
|
||||||
$this->seConnecter($dVueEreur);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "ConsulterListe":
|
|
||||||
$this->ConsulterListe();
|
|
||||||
break;
|
|
||||||
|
|
||||||
//mauvaise action
|
|
||||||
default:
|
|
||||||
$dVueEreur[] = "Erreur d'appel php";
|
|
||||||
require ($rep.$vues['home']);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (PDOException $e)
|
|
||||||
{
|
|
||||||
//si erreur BD, pas le cas ici
|
|
||||||
$dVueEreur[] = "Erreur inattendue!!! ";
|
|
||||||
require ($rep.$vues['erreur']);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception $e2)
|
|
||||||
{
|
|
||||||
$dVueEreur[] = "Erreur inattendue!!! ";
|
|
||||||
require ($rep.$vues['erreur']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//fin
|
|
||||||
exit(0);
|
|
||||||
}//fin constructeur
|
|
||||||
|
|
||||||
|
|
||||||
function Reinit() {
|
|
||||||
global $rep,$vues;
|
|
||||||
|
|
||||||
$dVue = array (
|
|
||||||
'nom' => "",
|
|
||||||
'age' => 0,
|
|
||||||
);
|
|
||||||
require ($rep.$vues['Home']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ValidationFormulaire(array $dVueEreur) {
|
|
||||||
global $rep,$vues;
|
|
||||||
|
|
||||||
|
|
||||||
//si exception, ca remonte !!!
|
|
||||||
$nom=$_POST['txtNom']; // txtNom = nom du champ texte dans le formulaire
|
|
||||||
$age=$_POST['txtAge'];
|
|
||||||
\config\Validation::val_form($nom,$age,$dVueEreur);
|
|
||||||
|
|
||||||
$model = new \Modele\Simplemodel();
|
|
||||||
$data=$model->get_data();
|
|
||||||
|
|
||||||
$dVue = array (
|
|
||||||
'nom' => $nom,
|
|
||||||
'age' => $age,
|
|
||||||
'data' => $data,
|
|
||||||
);
|
|
||||||
require ($rep.$vues['inscription']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function redirectionLogin(array $dVueEreur) {
|
|
||||||
global $rep,$vues;
|
|
||||||
require ($rep.$vues['login']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function redirectionInscription(array $dVueEreur) {
|
|
||||||
global $rep,$vues;
|
|
||||||
require ($rep.$vues['inscription']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function seConnecter(array $dVueEreur) {
|
|
||||||
global $rep,$vues;
|
|
||||||
|
|
||||||
|
|
||||||
//si exception, ca remonte !!!
|
|
||||||
$mail=$_POST['mail']; // txtNom = nom du champ texte dans le formulaire
|
|
||||||
$password=$_POST['password'];
|
|
||||||
\config\Validation::val_connection($nom,$age,$dVueEreur);
|
|
||||||
require ($rep.$vues['login']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsulterListe(){
|
|
||||||
global $rep,$vues;
|
|
||||||
$con=new Connection("mysql:host=localhost;dbname=dbrahassou","rahassou","achanger");
|
|
||||||
$model = new ListeGateway($con);
|
|
||||||
$results=array();
|
|
||||||
$results=$model->getListePublic(0,10);
|
|
||||||
$dVue = array (
|
|
||||||
'results' => $results
|
|
||||||
);
|
|
||||||
require ($rep.$vues['listeVue']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}//fin class
|
|
||||||
|
|
||||||
?>
|
|
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Controller;
|
||||||
|
|
||||||
|
class Controleur {
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
global $rep,$vues;
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
$dVueEreur = array ();
|
||||||
|
|
||||||
|
try{
|
||||||
|
$action=NULL;
|
||||||
|
if(isset($_REQUEST['action'])){
|
||||||
|
$action = $_REQUEST["action"];
|
||||||
|
}
|
||||||
|
|
||||||
|
switch($action) {
|
||||||
|
|
||||||
|
//pas d'action, on réinitialise 1er appel
|
||||||
|
case NULL:
|
||||||
|
$this->Reinit();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "validationFormulaire":
|
||||||
|
$this->ValidationFormulaire($dVueEreur);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "redirectionLogin":
|
||||||
|
$this->redirectionLogin($dVueEreur);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "redirectionInscription":
|
||||||
|
$this->redirectionInscription($dVueEreur);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "seConnecter":
|
||||||
|
$this->seConnecter($dVueEreur);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ConsulterListe":
|
||||||
|
$this->ConsulterListe();
|
||||||
|
break;
|
||||||
|
|
||||||
|
//mauvaise action
|
||||||
|
default:
|
||||||
|
$dVueEreur[] = "Erreur d'appel php";
|
||||||
|
require ($rep.$vues['home']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (PDOException $e)
|
||||||
|
{
|
||||||
|
//si erreur BD, pas le cas ici
|
||||||
|
$dVueEreur[] = "Erreur inattendue!!! ";
|
||||||
|
require ($rep.$vues['erreur']);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception $e2)
|
||||||
|
{
|
||||||
|
$dVueEreur[] = "Erreur inattendue!!! ";
|
||||||
|
require ($rep.$vues['erreur']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//fin
|
||||||
|
exit(0);
|
||||||
|
}//fin constructeur
|
||||||
|
|
||||||
|
|
||||||
|
function Reinit() {
|
||||||
|
require ($rep.$vues['Home']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ValidationFormulaire(array $dVueEreur) {
|
||||||
|
require ($rep.$vues['inscription']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function redirectionLogin(array $dVueEreur) {
|
||||||
|
require ($rep.$vues['login']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function redirectionInscription(array $dVueEreur) {
|
||||||
|
require ($rep.$vues['inscription']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function seConnecter(array $dVueEreur) {
|
||||||
|
require ($rep.$vues['login']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ConsulterListe(){
|
||||||
|
require ($rep.$vues['listeVue']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}//fin class
|
||||||
|
|
||||||
|
?>
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
class FrontController {
|
||||||
|
global $rep,$vues;
|
||||||
|
|
||||||
|
function __construct(){
|
||||||
|
session_start();
|
||||||
|
try {
|
||||||
|
$actionUser = array();
|
||||||
|
if(isset($_GET["action"]) and in_array($_GET["action"],$actionUser))
|
||||||
|
if(!isset($_SESSION["IdUserCourant"])){
|
||||||
|
require("views/login.php");
|
||||||
|
} else $controlleur = new CtrlUtilisateur();
|
||||||
|
else $controlleur = new CtrlVisiteur();
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$dVueEreur[] = "Erreur inattendue!!! ";
|
||||||
|
require ($rep.$vues['erreur']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace modeles;
|
||||||
|
|
||||||
|
class Liste
|
||||||
|
{
|
||||||
|
private $id;
|
||||||
|
private $nom;
|
||||||
|
private $dateCreation;
|
||||||
|
private $estPublic;
|
||||||
|
private $idUser;
|
||||||
|
|
||||||
|
public function __construct($id, $nom, $dateCreation, $estPublic, $idUser){
|
||||||
|
$this->id = $id;
|
||||||
|
$this->nom = $nom;
|
||||||
|
$this->description = $description;
|
||||||
|
$this->dateCreation = $dateCreation;
|
||||||
|
$this->estPublic = $estPublic;
|
||||||
|
$this->idUser = $idUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Id
|
||||||
|
public function getId(){
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId($id){
|
||||||
|
$this->id=$id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Nom
|
||||||
|
public function getNom(){
|
||||||
|
return $this->nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNom($nom){
|
||||||
|
$this->nom=$nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DateCreation
|
||||||
|
public function getDateCreation(){
|
||||||
|
return $this->dateCreation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateCreation($dateCreation){
|
||||||
|
$this->dateCreation = $dateCreation;
|
||||||
|
}
|
||||||
|
|
||||||
|
//EstPublic
|
||||||
|
public function getEstPublic(){
|
||||||
|
return $this->estPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEstPublic($estPublic){
|
||||||
|
$this->estPublic = $estPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
//IdUser
|
||||||
|
public function getIdUser(){
|
||||||
|
return $this->idUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdUser($idUser){
|
||||||
|
$this->idUser = $idUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace modeles;
|
||||||
|
|
||||||
|
class Modele
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllListePublic(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace modeles;
|
||||||
|
|
||||||
|
class Tache
|
||||||
|
{
|
||||||
|
private $id;
|
||||||
|
private $nom;
|
||||||
|
private $description;
|
||||||
|
private $dateCreation;
|
||||||
|
private $estValide;
|
||||||
|
private $idListe;
|
||||||
|
|
||||||
|
public function __construct($id, $nom, $description,$dateCreation, $estValide,$idListe){
|
||||||
|
$this->id = $id;
|
||||||
|
$this->nom = $nom;
|
||||||
|
$this->description = $description;
|
||||||
|
$this->dateCreation = $dateCreation;
|
||||||
|
$this->estValide = $estValide;
|
||||||
|
$this->idListe = $idListe;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Id
|
||||||
|
public function getid(){
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId($id){
|
||||||
|
$this->id=$id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Nom
|
||||||
|
public function getNom(){
|
||||||
|
return $this->nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNom($nom){
|
||||||
|
$this->nom=$nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Description
|
||||||
|
public function getDescription(){
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription($description){
|
||||||
|
$this->description=$description;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DateCreation
|
||||||
|
public function getDateCreation(){
|
||||||
|
return $this->dateCreation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateCreation($dateCreation){
|
||||||
|
$this->dateCreation = $dateCreation;
|
||||||
|
}
|
||||||
|
|
||||||
|
//EstValide
|
||||||
|
public function getEstValide(){
|
||||||
|
return $this->estValide;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEstValide($estValide){
|
||||||
|
$this->estValide = $estValide;
|
||||||
|
}
|
||||||
|
|
||||||
|
//idList
|
||||||
|
public function getIdListe(){
|
||||||
|
return $this->estValide;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdListe($idListe){
|
||||||
|
$this->idListe = $idListe;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace modeles;
|
|
||||||
|
|
||||||
class Liste
|
|
||||||
{
|
|
||||||
private string $id;
|
|
||||||
private string $nom;
|
|
||||||
private Date $dateCreation;
|
|
||||||
private bool $estValide;
|
|
||||||
private array $liste;
|
|
||||||
|
|
||||||
public function __construct(string $id, string $nom, Date $dateCreation, array $liste){
|
|
||||||
$this->id = $id;
|
|
||||||
$this->nom = $nom;
|
|
||||||
$this->description = $description;
|
|
||||||
$this->dateCreation = $dateCreation;
|
|
||||||
$this->estValide = false;
|
|
||||||
$this->liste = $liste;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Nom
|
|
||||||
public function getNom(){
|
|
||||||
return $this->nom;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Id
|
|
||||||
public function getid(){
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//DateCreation
|
|
||||||
public function getDateCreation(){
|
|
||||||
return $this->dateCreation;
|
|
||||||
}
|
|
||||||
|
|
||||||
//EstValide
|
|
||||||
public function getEstValide(){
|
|
||||||
return $this->estValide;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getListe(){
|
|
||||||
return $this->liste;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace modeles;
|
||||||
|
|
||||||
|
class Modele
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function CreerUtilisateur(){
|
||||||
|
$userGtw = new UtilisateurGateway();
|
||||||
|
$verif = Validation::val_form_user();
|
||||||
|
if($verif == false){
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
$userGtw->AjouterUtilisateur();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace modeles;
|
|
||||||
|
|
||||||
class Tache
|
|
||||||
{
|
|
||||||
private string $id;
|
|
||||||
private string $nom;
|
|
||||||
private string $description;
|
|
||||||
private Date $dateCreation;
|
|
||||||
private bool $estValide;
|
|
||||||
|
|
||||||
public function __construct(string $id, string $nom, string $description, Date $dateCreation){
|
|
||||||
$this->id = $id;
|
|
||||||
$this->nom = $nom;
|
|
||||||
$this->description = $description;
|
|
||||||
$this->dateCreation = $dateCreation;
|
|
||||||
$this->estValide = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Nom
|
|
||||||
public function getNom(){
|
|
||||||
return $this->nom;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Id
|
|
||||||
public function getid(){
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Description
|
|
||||||
public function getDescription(){
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
//DateCreation
|
|
||||||
public function getDateCreation(){
|
|
||||||
return $this->dateCreation;
|
|
||||||
}
|
|
||||||
|
|
||||||
//EstValide
|
|
||||||
public function getEstValide(){
|
|
||||||
return $this->estValide;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
.button-home{
|
|
||||||
color: white;
|
|
||||||
background-color: transparent;
|
|
||||||
font-family: JetBrains Mono,Menlo,Droid Sans Mono,monospace;
|
|
||||||
border-color: transparent;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-home:hover{
|
|
||||||
color: #6a52fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-home{
|
|
||||||
margin-left: 10%;
|
|
||||||
}
|
|
@ -1,233 +0,0 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
body {
|
|
||||||
font: 18px "Nunito", sans-serif;
|
|
||||||
color: black;
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 2rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: -1;
|
|
||||||
pointer-events: none;
|
|
||||||
background: url("../Images/Back(2).jpg") no-repeat center;
|
|
||||||
background-size: cover;
|
|
||||||
animation: backgroundZoomAnimate 20s forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes backgroundZoomAnimate {
|
|
||||||
from {
|
|
||||||
transform: scale(1);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: scale(1.3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.profil-card {
|
|
||||||
box-shadow: 0 18px 200px -60px black;
|
|
||||||
border-radius: 50px;
|
|
||||||
width: 650px;
|
|
||||||
position: relative;
|
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
border: 2px solid #ffffff40;
|
|
||||||
padding: 3rem 5rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 40px;
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.profil-card__img img {
|
|
||||||
margin: auto;
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
border-radius: 50%;
|
|
||||||
object-fit: cover;
|
|
||||||
display: block;
|
|
||||||
box-shadow: 0 10px 60px -10px rgba(13,28,39,.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.profil-card__desc {
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 25px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.localisation {
|
|
||||||
display: flex;
|
|
||||||
align-items:center;
|
|
||||||
gap:10px;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profil-card__desc h1 {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profil-card__desc h1 + div {
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 50px;
|
|
||||||
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
gap: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info > div {
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: bold;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info > div > *:first-child {
|
|
||||||
font-weight: bold;
|
|
||||||
letter-spacing: 3px;
|
|
||||||
font-size: 2rem;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info > div > *:last-child {
|
|
||||||
font-size: 16px;
|
|
||||||
opacity: .7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.social {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.social a {
|
|
||||||
display: inline-block;
|
|
||||||
width: 55px;
|
|
||||||
height: 55px;
|
|
||||||
margin: 15px;
|
|
||||||
border-radius: 40%;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: white;
|
|
||||||
position: relative;
|
|
||||||
flex-shrink: 0;
|
|
||||||
transition: all .2s;
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
margin: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
|
||||||
.social a:hover {
|
|
||||||
transform: scale(1.2) translateY(-5px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.social a.facebook {
|
|
||||||
padding-top: 15px;
|
|
||||||
padding-left: 15px;
|
|
||||||
background: linear-gradient(45deg, #3b5998,#0078d7);
|
|
||||||
box-shadow: 0 4px 30px rgba(45, 98, 169, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.social a.twitter {
|
|
||||||
padding-top: 15px;
|
|
||||||
padding-left: 15px;
|
|
||||||
background: linear-gradient(45deg, #1da1f2,#0e71c8);
|
|
||||||
box-shadow: 0 4px 30px rgba(19, 127, 212, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.social a.instagram {
|
|
||||||
padding-top: 15px;
|
|
||||||
padding-left: 15px;
|
|
||||||
background: linear-gradient(45deg, #405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d);
|
|
||||||
box-shadow: 0 4px 30px rgba(120, 64, 190, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
.social a.gitlab {
|
|
||||||
padding-top: 15px;
|
|
||||||
padding-left: 15px;
|
|
||||||
background: linear-gradient(45deg, #FF9467,#DB4100);
|
|
||||||
box-shadow: 0 4px 30px rgba(255,148,103, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 2rem;
|
|
||||||
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions > button {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 22px;
|
|
||||||
padding: 15px 0;
|
|
||||||
min-width: 250px;
|
|
||||||
border-radius: 50px;
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all .2s;
|
|
||||||
|
|
||||||
@media screen and (max-width: 760px) {
|
|
||||||
min-width: 170px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
min-width: inherit;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 350%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 576px) {
|
|
||||||
.actions > button:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.bleu{
|
|
||||||
background: linear-gradient(45deg, #1da1f2,#0e71c8);
|
|
||||||
box-shadow: 0 4px 30px rgba(19, 127, 212, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bleu:hover {
|
|
||||||
box-shadow: 0 7px 30px rgba(19, 127, 212, 0.75);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.orange {
|
|
||||||
background: linear-gradient(45deg, #d5135a,#f05924);
|
|
||||||
box-shadow: 0 4px 30px rgba(223, 45, 70, 0.35);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.orange:hover {
|
|
||||||
box-shadow: 0 7px 30px rgba(223,45,70,0.75);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
Foreach($results as $row)
|
|
||||||
{
|
|
||||||
print $row->getNom();
|
|
||||||
echo ("<br>");
|
|
||||||
print $row->getDateCreation();
|
|
||||||
echo ("<br>");
|
|
||||||
}
|
|
||||||
?>
|
|
@ -0,0 +1,21 @@
|
|||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg bg-info">
|
||||||
|
<img src="./Vue/Images/LogoForHome.png" width="200">
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse navbar-home" id="navbarNavAltMarkup">
|
||||||
|
<div class="navbar-nav">
|
||||||
|
|
||||||
|
<a class="nav-item nav-link" href="#">Features</a>
|
||||||
|
<a class="nav-item nav-link" href="#">Pricing</a>
|
||||||
|
<a class="nav-item nav-link disabled" href="#">Disabled</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
<html>
|
||||||
|
<head><title>Erreur</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>ERREUR !!!!!</h1>
|
||||||
|
<?php
|
||||||
|
if (isset($dVueEreur)) {
|
||||||
|
foreach ($dVueEreur as $value){
|
||||||
|
echo $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body> </html>
|
@ -1,54 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Page d'inscription</title>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="./Vue/css/inscription.css">
|
|
||||||
<script type="text/javascript" src="./Vue/javaScript/inscription.js" defer></script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="main-logo">
|
|
||||||
<form method="post" class="form-redirection">
|
|
||||||
<Button type="submit">Revenir</Button>
|
|
||||||
<input type="hidden" name="action" value="redirectionLogin">
|
|
||||||
</form>
|
|
||||||
<img src="./Vue/Images/Logo.png" alt="logo">
|
|
||||||
<h1>Inscription</h1>
|
|
||||||
</div>
|
|
||||||
<form>
|
|
||||||
<ul class="items"></ul>
|
|
||||||
|
|
||||||
<fieldset class="username enable">
|
|
||||||
<div class="icon left"><i class="user"></i></div>
|
|
||||||
<input type="text" name="usernameForm" placeholder="Username"/>
|
|
||||||
<div class="icon right button"><i class="arrow"></i></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="email">
|
|
||||||
<div class="icon left"><i class="letter"></i></div>
|
|
||||||
<input type="mail" name="mailForm" placeholder="Email"/>
|
|
||||||
<div class="icon right button"><i class="arrow"></i></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="password">
|
|
||||||
<div class="icon left"><i class="lock"></i></div>
|
|
||||||
<input type="password" name="passwordForm" placeholder="Password"/>
|
|
||||||
<div class="icon right button"><i class="arrow"></i></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="thanks">
|
|
||||||
<div class="icon left"><i class="heart"></i></div>
|
|
||||||
<p>Merci pour votre inscription</p>
|
|
||||||
<div class="icon right"><i class="heart"></i></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -0,0 +1,59 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Page d'inscription</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!-- CSS only -->
|
||||||
|
<link rel="stylesheet" href="./Vue/css/inscription.css">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||||
|
<!-- JavaScript Bundle with Popper -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main-logo">
|
||||||
|
<img src="./Vue/Images/Logo.png" alt="logo">
|
||||||
|
<h1>Inscription</h1>
|
||||||
|
</div>
|
||||||
|
<form>
|
||||||
|
<!-- 2 column grid layout with text inputs for the first and last names -->
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-outline">
|
||||||
|
<input type="text" id="form3Example1" class="form-control" />
|
||||||
|
<label class="form-label" for="form3Example1">First name</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-outline">
|
||||||
|
<input type="text" id="form3Example2" class="form-control" />
|
||||||
|
<label class="form-label" for="form3Example2">Last name</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Email input -->
|
||||||
|
<div class="form-outline mb-4">
|
||||||
|
<input type="email" id="form3Example3" class="form-control" />
|
||||||
|
<label class="form-label" for="form3Example3">Email address</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Password input -->
|
||||||
|
<div class="form-outline mb-4">
|
||||||
|
<input type="password" id="form3Example4" class="form-control" />
|
||||||
|
<label class="form-label" for="form3Example4">Password</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Submit button -->
|
||||||
|
<button type="submit" class="btn btn-primary btn-block mb-4">Sign up</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Page Profil</title>
|
|
||||||
<link rel="stylesheet" href="../css/profil.css">
|
|
||||||
<link rel="stylesheet" href="../css/reset.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="profil-card">
|
|
||||||
<figure class="profil-card__img">
|
|
||||||
<img src="../Images/avatar.jpeg" alt="Image Profil">
|
|
||||||
</figure>
|
|
||||||
|
|
||||||
<div class="profil-card__desc">
|
|
||||||
<h1>Ritchie Golozer</h1>
|
|
||||||
<div>front-end Developer</div>
|
|
||||||
<div style="localisation">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-map-pin" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<circle cx="12" cy="11" r="3"></circle>
|
|
||||||
<path d="M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"></path>
|
|
||||||
</svg>
|
|
||||||
<span>Clermont-Ferrand</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="social">
|
|
||||||
<a href="#" class="facebook">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-facebook" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M7 10v4h3v7h4v-7h3l1 -4h-4v-2a1 1 0 0 1 1 -1h3v-4h-3a5 5 0 0 0 -5 5v2h-3"></path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="twitter">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M22 4.01c-1 .49 -1.98 .689 -3 .99c-1.121 -1.265 -2.783 -1.335 -4.38 -.737s-2.643 2.06 -2.62 3.737v1c-3.245 .083 -6.135 -1.395 -8 -4c0 0 -4.182 7.433 4 11c-1.872 1.247 -3.739 2.088 -6 2c3.308 1.803 6.913 2.423 10.034 1.517c3.58 -1.04 6.522 -3.723 7.651 -7.742a13.84 13.84 0 0 0 .497 -3.753c-.002 -.249 1.51 -2.772 1.818 -4.013z"></path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="instagram">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-instagram" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<rect x="4" y="4" width="16" height="16" rx="4"></rect>
|
|
||||||
<circle cx="12" cy="12" r="3"></circle>
|
|
||||||
<line x1="16.5" y1="7.5" x2="16.5" y2="7.501"></line>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="gitlab">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-gitlab" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M21 14l-9 7l-9 -7l3 -11l3 7h6l3 -7z"></path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="info">
|
|
||||||
<div>
|
|
||||||
<div>850</div>
|
|
||||||
<div>Followers</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div>50</div>
|
|
||||||
<div>References</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div>105</div>
|
|
||||||
<div>Works</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<button class="orange">Se déconnecter</button>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<button class="orange">Supprimer le compte</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,53 +0,0 @@
|
|||||||
|
|
||||||
function init() {
|
|
||||||
// Generate li foreach fieldset
|
|
||||||
for (var i = 0; i < count; i++) {
|
|
||||||
var ul = document.querySelector("ul.items"),
|
|
||||||
li = document.createElement("li");
|
|
||||||
|
|
||||||
ul.appendChild(li);
|
|
||||||
}
|
|
||||||
// Add class active on first li
|
|
||||||
ul.firstChild.classList.add("active");
|
|
||||||
}
|
|
||||||
|
|
||||||
function next(target) {
|
|
||||||
var input = target.previousElementSibling;
|
|
||||||
|
|
||||||
// Check if input is empty
|
|
||||||
if (input.value === "") {
|
|
||||||
body.classList.add("error");
|
|
||||||
} else {
|
|
||||||
body.classList.remove("error");
|
|
||||||
|
|
||||||
var enable = document.querySelector("form fieldset.enable"),
|
|
||||||
nextEnable = enable.nextElementSibling;
|
|
||||||
enable.classList.remove("enable");
|
|
||||||
enable.classList.add("disable");
|
|
||||||
nextEnable.classList.add("enable");
|
|
||||||
|
|
||||||
// Switch active class on left list
|
|
||||||
var active = document.querySelector("ul.items li.active"),
|
|
||||||
nextActive = active.nextElementSibling;
|
|
||||||
active.classList.remove("active");
|
|
||||||
nextActive.classList.add("active");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function keyDown(event) {
|
|
||||||
var key = event.keyCode,
|
|
||||||
target = document.querySelector("fieldset.enable .button");
|
|
||||||
if (key == 13 || key == 9) next(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
var body = document.querySelector("body"),
|
|
||||||
form = document.querySelector("form"),
|
|
||||||
count = form.querySelectorAll("fieldset").length;
|
|
||||||
|
|
||||||
window.onload = init;
|
|
||||||
document.body.onmouseup = function (event) {
|
|
||||||
var target = event.target || event.toElement;
|
|
||||||
if (target.classList.contains("button")) next(target);
|
|
||||||
};
|
|
||||||
document.addEventListener("keydown", keyDown, false);
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
class Connection extends PDO {
|
||||||
|
|
||||||
|
private $stmt;
|
||||||
|
|
||||||
|
public function __construct(string $dsn, string $username, string $password) {
|
||||||
|
|
||||||
|
parent::__construct($dsn,$username,$password);
|
||||||
|
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** * @param string $query
|
||||||
|
* @param array $parameters *
|
||||||
|
* @return bool Returns `true` on success, `false` otherwise
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function executeQuery(string $query, array $parameters = []) : bool{
|
||||||
|
$this->stmt = parent::prepare($query);
|
||||||
|
foreach ($parameters as $name => $value) {
|
||||||
|
$this->stmt->bindValue($name, $value[0], $value[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResults() : array {
|
||||||
|
return $this->stmt->fetchall();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,155 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SplClassLoader implementation that implements the technical interoperability
|
|
||||||
* standards for PHP 5.3 namespaces and class names.
|
|
||||||
*
|
|
||||||
* http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1
|
|
||||||
*
|
|
||||||
* // Example which loads classes for the Doctrine Common package in the
|
|
||||||
* // Doctrine\Common namespace.
|
|
||||||
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
|
|
||||||
* $classLoader->register();
|
|
||||||
*
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
||||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
|
||||||
* @author Roman S. Borschel <roman@code-factory.org>
|
|
||||||
* @author Matthew Weier O'Phinney <matthew@zend.com>
|
|
||||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
|
||||||
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
|
|
||||||
*/
|
|
||||||
class SplClassLoader
|
|
||||||
{
|
|
||||||
private $_fileExtension = '.php';
|
|
||||||
private $_namespace;
|
|
||||||
private $_includePath;
|
|
||||||
private $_namespaceSeparator = '\\';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new <tt>SplClassLoader</tt> that loads classes of the
|
|
||||||
* specified namespace.
|
|
||||||
*
|
|
||||||
* @param string $ns The namespace to use.
|
|
||||||
*/
|
|
||||||
public function __construct(string $ns = null, string $includePath = null)
|
|
||||||
{
|
|
||||||
$this->_namespace = $ns;
|
|
||||||
$this->_includePath = $includePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the namespace separator used by classes in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @param string $sep The separator to use.
|
|
||||||
*/
|
|
||||||
public function setNamespaceSeparator(string $sep)
|
|
||||||
{
|
|
||||||
$this->_namespaceSeparator = $sep;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the namespace seperator used by classes in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getNamespaceSeparator()
|
|
||||||
{
|
|
||||||
return $this->_namespaceSeparator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the base include path for all class files in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @param string $includePath
|
|
||||||
*/
|
|
||||||
public function setIncludePath(string $includePath)
|
|
||||||
{
|
|
||||||
$this->_includePath = $includePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the base include path for all class files in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @return string $includePath
|
|
||||||
*/
|
|
||||||
public function getIncludePath()
|
|
||||||
{
|
|
||||||
return $this->_includePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the file extension of class files in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @param string $fileExtension
|
|
||||||
*/
|
|
||||||
public function setFileExtension($fileExtension)
|
|
||||||
{
|
|
||||||
$this->_fileExtension = $fileExtension;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the file extension of class files in the namespace of this class loader.
|
|
||||||
*
|
|
||||||
* @return string $fileExtension
|
|
||||||
*/
|
|
||||||
public function getFileExtension()
|
|
||||||
{
|
|
||||||
return $this->_fileExtension;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs this class loader on the SPL autoload stack.
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
spl_autoload_register(array($this, 'loadClass'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uninstalls this class loader from the SPL autoloader stack.
|
|
||||||
*/
|
|
||||||
public function unregister()
|
|
||||||
{
|
|
||||||
spl_autoload_unregister(array($this, 'loadClass'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the given class or interface.
|
|
||||||
*
|
|
||||||
* @param string $className The name of the class to load.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function loadClass(string $className)
|
|
||||||
{
|
|
||||||
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
|
|
||||||
$fileName = '';
|
|
||||||
$namespace = '';
|
|
||||||
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
|
|
||||||
$namespace = substr($className, 0, $lastNsPos);
|
|
||||||
$className = substr($className, $lastNsPos + 1);
|
|
||||||
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
|
||||||
}
|
|
||||||
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
|
|
||||||
|
|
||||||
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue