diff --git a/application/class/Application.php b/application/class/Application.php index f532094..f819afc 100644 --- a/application/class/Application.php +++ b/application/class/Application.php @@ -2,10 +2,6 @@ namespace MVC\Classe; -define( "CONTROLLERS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs"); -define("CONFIG_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "config"); -define("LOG_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "logs"); - require APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php"; class Application diff --git a/application/class/Controlleur.php b/application/class/Controlleur.php index 2c98b3a..9f0ba66 100644 --- a/application/class/Controlleur.php +++ b/application/class/Controlleur.php @@ -2,11 +2,6 @@ namespace MVC\Classe; -define( "MODELS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "modeles"); -define( "VIEW_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "vues"); -define( "CONTROLLER_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs"); -define( "TRAITEMENT_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements"); - class Controlleur{ public $modele; diff --git a/application/class/Session.php b/application/class/Session.php index 817bc31..938e459 100644 --- a/application/class/Session.php +++ b/application/class/Session.php @@ -7,6 +7,24 @@ namespace MVC\Classe; class Session { + static public function start() + { + session_start(); + return; + } + + static public function setUserProfile($userProfile) + { + $_SESSION['userProfile'] = $userProfile; + return; + } + + static public function setToken($token) + { + $_SESSION['userToken'] = $token; + return; + } + static public function isRegistered() { if (isset($_SESSION['userProfile'])) { diff --git a/application/class/Url.php b/application/class/Url.php index 969cc87..b250d4e 100644 --- a/application/class/Url.php +++ b/application/class/Url.php @@ -2,18 +2,20 @@ namespace MVC\Classe; +//require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."config".DIRECTORY_SEPARATOR."define-constantes.php"; + class Url { - public $page; - public $registre; - - - public function __construct(){ + public $page; + public $registre; - //on créé le registre des modules symfony - $this->registre = new \MVC\Classe\ModularRegister(); - //définition des parametres de base + public function __construct(){ + + //on créé le registre des modules symfony + $this->registre = new \MVC\Classe\ModularRegister(); + + //définition des parametres de base $page = array(); $page['name'] = 'accueil'; $page['description'] = ""; @@ -21,7 +23,6 @@ class Url $page['control'] = false; - $url = parse_url($_SERVER['REQUEST_URI']); $urlTrim = trim( $url['path'] , '/' ); $urlParts = explode('/' , $urlTrim ); @@ -55,11 +56,11 @@ class Url $this->page = $page; return; } - //cas d'utilisation normal : il existe autant de clé que de valeurs + //cas d'utilisation normal : il existe autant de clé que de valeurs } else if ( $numParts != 0 ) { $values = array(); $keys = array(); - foreach( $urlParts as $key => $value ){ + foreach($urlParts as $key => $value ){ if($key%2 == 0) { $values[] = $value; } else { diff --git a/application/config/authentification-config-example.php b/application/config/authentification-config-example.php index 7bbfd07..b29bc7b 100644 --- a/application/config/authentification-config-example.php +++ b/application/config/authentification-config-example.php @@ -5,28 +5,28 @@ */ $config = [ //Location where to redirect users once they authenticate with a provider - 'callback' => \MVC\Url::link_rewrite(false, 'accueil', []), + 'callback' => 'http://localhost:8080/' . \MVC\Classe\Url::link_rewrite(false, 'compte', []), //Providers specifics 'providers' => [ 'GitHub' => [ 'enabled' => true, - 'keys' => ['id' => '', 'secret' => ''], + 'keys' => ['id' => '4cc55bcafbf8ea77ae14', 'secret' => 'e0b7c5091d7af4f4e5ced843f2e8ce1f38f02578'], ], 'Google' => [ 'enabled' => true, - 'keys' => ['id' => '', 'secret' => ''], + 'keys' => ['id' => '686670374445-mhktaj9gp08p6oiu8e1aue3ckua6e3s3.apps.googleusercontent.com', 'secret' => '4yOeNxYuYE4H8DFhVzQlOb_U'], ], 'Facebook' => [ 'enabled' => true, - 'keys' => ['id' => '', 'secret' => ''], + 'keys' => ['id' => '432266300978748', 'secret' => '43815184db62771fce19b64cdd80110a'], ], 'Twitter' => [ 'enabled' => true, - 'keys' => ['key' => '', 'secret' => ''], + 'keys' => ['key' => '155718820-WdUWfYpQA4AIa57Cayt3sIXiR90mre31h5S9gUvj', 'secret' => 'nc1w9VLRmnXVl4GkqC8vvUFORzPIdWBz2PE9B5eAF8Idv'], ] ], //optional : set debug mode diff --git a/application/config/define-constantes.php b/application/config/define-constantes.php new file mode 100644 index 0000000..49c1c75 --- /dev/null +++ b/application/config/define-constantes.php @@ -0,0 +1,10 @@ +getConnectedAdapters(); $templateData['adapters'] = $adapters; -$templateData['extractedData'] = [ +/*$templateData['extractedData'] = [ 'token' => $_SESSION['userToken'], 'identifier' => $_SESSION['userProfile']->identifier, 'email' => $_SESSION['userProfile']->email, 'first_name' => $_SESSION['userProfile']->firstName, 'last_name' => $_SESSION['userProfile']->lastName, 'photoURL' => strtok($_SESSION['userProfile']->photoURL, '?'), -]; +];*/ +$templateData['extractedData'] = []; diff --git a/application/include/vues/system/system.blade.php b/application/include/vues/system/system.blade.php index 6d09006..f23ccdd 100644 --- a/application/include/vues/system/system.blade.php +++ b/application/include/vues/system/system.blade.php @@ -7,17 +7,17 @@ @section('top-css') @endsection - @section('top-javascript') - @endsection -
+@section('top-javascript') +@show + @yield('body') @section('bottom-javascript') -@endsection +@show diff --git a/application/include/vues/view/accueil.blade.php b/application/include/vues/view/accueil.blade.php index 6620966..05e3b37 100644 --- a/application/include/vues/view/accueil.blade.php +++ b/application/include/vues/view/accueil.blade.php @@ -9,6 +9,8 @@ @section('content')