diff --git a/application/class/Application.php b/application/class/Application.php index d758a9b..f532094 100644 --- a/application/class/Application.php +++ b/application/class/Application.php @@ -3,6 +3,8 @@ 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"; diff --git a/application/class/Session.php b/application/class/Session.php new file mode 100644 index 0000000..817bc31 --- /dev/null +++ b/application/class/Session.php @@ -0,0 +1,20 @@ +page = $page; } + + static public function link_rewrite($isControlPatern, $page, $params = array()) + { + if ($isControlPatern) { + return self::controlLink_rewrite($page, $params); + } else { + return self::link_rewrite_slashParam($page, $params); + } + } + + static private function link_rewrite_slashParam($page, $params = array()) + { + $stringParams = ''; + foreach ($params as $key => $values) { + $stringParams .= "/" . $key . "/" . $values; + } + return '/' . $page . $stringParams; + + } + + static private function controlLink_rewrite($page, $params = array()) + { + $stringParams = ''; + foreach ($params as $key => $values) { + $stringParams .= "/" . $key . "/" . $values; + } + return '/' . 'control' . '/' . $page . $stringParams; + } + } diff --git a/application/config/authentification-config-example.php b/application/config/authentification-config-example.php new file mode 100644 index 0000000..7bbfd07 --- /dev/null +++ b/application/config/authentification-config-example.php @@ -0,0 +1,50 @@ + \MVC\Url::link_rewrite(false, 'accueil', []), + +//Providers specifics + 'providers' => [ + 'GitHub' => [ + 'enabled' => true, + 'keys' => ['id' => '', 'secret' => ''], + ], + + 'Google' => [ + 'enabled' => true, + 'keys' => ['id' => '', 'secret' => ''], + ], + + 'Facebook' => [ + 'enabled' => true, + 'keys' => ['id' => '', 'secret' => ''], + ], + + 'Twitter' => [ + 'enabled' => true, + 'keys' => ['key' => '', 'secret' => ''], + ] + ], + //optional : set debug mode + 'debug_mode' => true, + // Path to file writeable by the web server. Required if 'debug_mode' is not false + 'debug_file' => LOG_PATH . DIRECTORY_SEPARATOR . 'hybridauth.log', + + /* optional : customize Curl settings + // for more information on curl, refer to: http://www.php.net/manual/fr/function.curl-setopt.php + 'curl_options' => [ + // setting custom certificates + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => '/path/to/your/certificate.crt', + + // set a valid proxy ip address + CURLOPT_PROXY => '*.*.*.*:*', + + // set a custom user agent + CURLOPT_USERAGENT => '' + ] */ +]; diff --git a/application/include/controlleurs/authentification.php b/application/include/controlleurs/authentification.php new file mode 100644 index 0000000..c6431e4 --- /dev/null +++ b/application/include/controlleurs/authentification.php @@ -0,0 +1,9 @@ +getConnectedAdapters(); + +$templateData['hybridauth'] = $hybridauth; +$templateData['adapters'] = $adapters; \ No newline at end of file diff --git a/application/include/controlleurs/compte.php b/application/include/controlleurs/compte.php new file mode 100644 index 0000000..b1fa036 --- /dev/null +++ b/application/include/controlleurs/compte.php @@ -0,0 +1,18 @@ +getConnectedAdapters(); + +$templateData['adapters'] = $adapters; + +$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, '?'), +]; diff --git a/application/include/modeles/authentification.model b/application/include/modeles/authentification.model new file mode 100644 index 0000000..716809e --- /dev/null +++ b/application/include/modeles/authentification.model @@ -0,0 +1,4 @@ +name : authentification +page_title: Hybrid Authentification de l'application +description : La page d'authentification +params : params diff --git a/application/include/modeles/compte.model b/application/include/modeles/compte.model new file mode 100644 index 0000000..419a991 --- /dev/null +++ b/application/include/modeles/compte.model @@ -0,0 +1,4 @@ +name : compte +page_title: Compte(s) utilisateurs de l'application +description : La page d'accès privé +params : params diff --git a/application/include/vues/system/system.blade.php b/application/include/vues/system/system.blade.php index b5be8c9..6d09006 100644 --- a/application/include/vues/system/system.blade.php +++ b/application/include/vues/system/system.blade.php @@ -1,9 +1,24 @@ + {{$page_title}} - + + + @section('top-css') + @endsection + + @section('top-javascript') + @endsection + + + @yield('body') + +@section('bottom-javascript') +@endsection + + \ No newline at end of file diff --git a/application/include/vues/view/authentification.blade.php b/application/include/vues/view/authentification.blade.php new file mode 100644 index 0000000..8a08b01 --- /dev/null +++ b/application/include/vues/view/authentification.blade.php @@ -0,0 +1,33 @@ +@extends('body') + +@section('sidebar') + @parent + +

This is appended to the master sidebar.

+@endsection + +@section('content') +

Sign in

+ +