big update : session authentification guard, some exemaples and docs
This commit is contained in:
parent
eb54203916
commit
5be76d38f6
|
@ -23,10 +23,6 @@ class Application
|
|||
|
||||
public function launch()
|
||||
{
|
||||
//on declare la session lors du chargement du controlleur,
|
||||
// ainsi on instancie la page précédente et le javascript et le css asynchrone
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
|
||||
$controlleur = new Controlleur($this);
|
||||
//si la page n'est un controlleur d'action alors on affiche l'écran
|
||||
if (!$this->url->page['control']) {
|
||||
|
|
38
application/class/Asynchonous.php
Normal file
38
application/class/Asynchonous.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace MVC\Classe;
|
||||
|
||||
class Asynchonous
|
||||
{
|
||||
private $_css;
|
||||
private $_javascript;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_css = "";
|
||||
$this->_javascript = "";
|
||||
}
|
||||
|
||||
public function addCss($code)
|
||||
{
|
||||
$this->_css .= "\n";
|
||||
$this->_css .= $code;
|
||||
}
|
||||
|
||||
public function addJs($code)
|
||||
{
|
||||
$this->_javascript .= "\n";
|
||||
$this->_javascript .= $code;
|
||||
}
|
||||
|
||||
public function printCss()
|
||||
{
|
||||
echo $this->_css;
|
||||
}
|
||||
|
||||
public function printJs()
|
||||
{
|
||||
echo $this->_javascript;
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ class Bdd
|
|||
{
|
||||
public $bdd;
|
||||
|
||||
public function __construct($bdd = 'default')
|
||||
public function __construct($bdd = 'bdd')
|
||||
{
|
||||
switch ($bdd) {
|
||||
case 'bdd1':
|
||||
|
|
|
@ -37,6 +37,15 @@ class Controlleur
|
|||
require TRAITEMENT_PATH . DIRECTORY_SEPARATOR . $application->url->page['name'] . '.php';
|
||||
} else {
|
||||
$this->modele = new Modele($application->url->page);
|
||||
if(isset($this->modele->page['authentification']) && $this->modele->page['authentification'] == 'yes'){
|
||||
//on declare la session lors du chargement du controlleur,
|
||||
// ainsi on instancie la page précédente et le javascript et le css asynchrone
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
}else{
|
||||
\MVC\Object\Session::sessionStart();
|
||||
\MVC\Object\History::setPagePrecedente();
|
||||
\MVC\Object\Asynchronous::declare();
|
||||
}
|
||||
$this->vue = new Vue($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,8 +192,10 @@ class Url
|
|||
$scheme = 'http';
|
||||
}
|
||||
$base_url = $scheme . "://" . $url;
|
||||
$url = $base_url;
|
||||
}else{
|
||||
$base_url = PATH_URL;
|
||||
$url = $base_url . BASE_SERVER_DIRECTORY;
|
||||
}
|
||||
if ($isControlPatern) {
|
||||
$uri = self::controlLink_rewrite($page, $params);
|
||||
|
@ -202,6 +204,10 @@ class Url
|
|||
}
|
||||
|
||||
|
||||
return ( $base_url . BASE_SERVER_DIRECTORY . $uri);
|
||||
return ( $url . $uri);
|
||||
}
|
||||
|
||||
public static function getBaseDirectory(){
|
||||
return '/' . BASE_SERVER_DIRECTORY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
define("BASE_SERVER_DIRECTORY", "");
|
||||
|
||||
// Optionnel! il n'est nécessaire que si vous l'utilisez dans les fichiers de traitement ou dans une commande console
|
||||
// si vous l'utilisez dans les fichiers de traitement -> il est plus simple d'utiliser l'Objet page précédente
|
||||
define('PATH_URL',"http://www.domain.org");
|
||||
define('PATH_URL',"http://www.domain.org/");
|
||||
|
||||
define('ENV', "DEV");
|
|
@ -8,7 +8,7 @@ class DocConduit extends Conduit
|
|||
// Route('/docs')
|
||||
public function index()
|
||||
{
|
||||
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
$files = array();
|
||||
|
||||
if ($handle = opendir(DATA_PATH . '/docs')) {
|
||||
|
@ -36,7 +36,7 @@ class DocConduit extends Conduit
|
|||
// Route('/docs/file/{file}')
|
||||
public function readfile()
|
||||
{
|
||||
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
$markdown = file_get_contents(DATA_PATH . '/docs/' . $this->file);
|
||||
|
||||
$my_html = MarkdownExtra::defaultTransform($markdown);
|
||||
|
|
|
@ -8,6 +8,7 @@ class FooConduit extends Conduit
|
|||
// Route('/foo')
|
||||
public function index()
|
||||
{
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
echo "blob of foo";
|
||||
return $this->render('foo', array('page_title' => 'Foo', 'description' => 'FooConduit'));
|
||||
}
|
||||
|
@ -15,6 +16,7 @@ class FooConduit extends Conduit
|
|||
// Route('/foo/{id}')
|
||||
public function load()
|
||||
{
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
echo "load of foo";
|
||||
return $this->render('foo', array('page_title' => 'Foo', 'description' => 'FooConduit', 'id' => $this->id));
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ class IndexConduit extends Conduit
|
|||
// Route('/')
|
||||
public function homepage()
|
||||
{
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
echo "IndexControlleur";
|
||||
return $this->render('index', array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge'));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
name : admin
|
||||
page_title : Administration de l'application
|
||||
description : Administration de l'application
|
||||
engine : blade
|
||||
params : params
|
||||
|
||||
engine : blade
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
name : beers
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
params : module_params
|
||||
|
||||
engine : blade
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
name : cgu
|
||||
page_title: Conditions Générale d'Utilisation de l'application
|
||||
description : abracadabla
|
||||
|
||||
engine : blade
|
||||
params : params
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
name : donate
|
||||
page_title : Be a sponsor
|
||||
description : Page permettant de devenir un sponsor du framework SAND
|
||||
params : module_params
|
||||
|
||||
engine : blade
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
name : error-access-denied
|
||||
page_title : Page 403 (Accès restreint) de l'application
|
||||
description : Page 403 (Accès restreint) de l'application
|
||||
params : module_params
|
||||
|
||||
engine : blade
|
||||
authentification : no
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
name : error
|
||||
page_title: Page 404 (Page Non Trouvé) de l'application
|
||||
description : Page 404 (Page Non Trouvé) de l'application
|
||||
params : params
|
||||
|
||||
engine : blade
|
||||
authentification : no
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
name : gitlist
|
||||
page_title : Dépot Git
|
||||
description : Le dépot de travail du framework
|
||||
engine: blade
|
||||
|
||||
engine : blade
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil, dépot git du framework}
|
||||
arianelink : {index, gitlist}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
name : index
|
||||
page_title : Accueil de l'application
|
||||
description : zatou stra bracadabla
|
||||
|
||||
engine : blade
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
name : policy
|
||||
page_title: Politique de Confidentialité de l'application
|
||||
description : abracadabla
|
||||
|
||||
engine : blade
|
||||
params : params
|
||||
authentification : yes
|
||||
|
||||
ariane : {acceuil}
|
||||
arianelink : {index}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<div id="breadcrumbs" class="fullwidth">
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<ol class="breadcrumb-sand">
|
||||
@foreach($ariane as $value)
|
||||
@if($value == end($ariane))
|
||||
<li class="breadcrumb-item active" aria-current="page">{{$value}}</li>
|
||||
|
|
|
@ -45,14 +45,16 @@
|
|||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/bootstrap-5.0.0-beta1-dist/js/bootstrap.min.js')}}"></script>
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/custom.js')}}"></script>
|
||||
|
||||
/*
|
||||
SCRIPT JS permettant de ne valider qu'une seule fois un formulaire
|
||||
ATTENTION tous les formulaires sont affecté
|
||||
Lors d'une validation bootstrap personnalisé veuillez utilisé
|
||||
la class do-resubmit sur le formulaire afin de permettre
|
||||
l'activation supplémentaire du bouton.
|
||||
*/
|
||||
<script>
|
||||
|
||||
/*
|
||||
SCRIPT JS permettant de ne valider qu'une seule fois un formulaire
|
||||
ATTENTION tous les formulaires sont affecté
|
||||
Lors d'une validation bootstrap personnalisé veuillez utilisé
|
||||
la class do-resubmit sur le formulaire afin de permettre
|
||||
l'activation supplémentaire du bouton.
|
||||
*/
|
||||
|
||||
window.onload = function() {
|
||||
let PreventAllforms = document.querySelectorAll("form");
|
||||
Array.prototype.slice.call(PreventAllforms)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/themes/{{ theme }}/css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/themes/{{ theme }}/css/gitgraph.css">
|
||||
<link rel="shortcut icon" type="image/png" href="{{ app.request.basepath }}/themes/{{ theme }}/img/favicon.png"
|
||||
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/themes/{{ theme }}/css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/themes/{{ theme }}/css/gitgraph.css">
|
||||
<!--[if lt IE 9]>
|
||||
<script type="application/javascript" src="{{ app.request.basepath }}/themes/{{ theme }}/js/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
|
|
@ -35,7 +35,7 @@ class Session
|
|||
public static function authentification()
|
||||
{
|
||||
self::sessionStart();
|
||||
$_SESSION['user_login'] = 'root';
|
||||
$_SESSION['user_login'] = 'anonymous';
|
||||
$_SESSION['acl_admin'] = 0;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class Session
|
|||
require_once CONFIG_PATH . DIRECTORY_SEPARATOR . 'cas-authentification-config.php';
|
||||
|
||||
// Enable debugging
|
||||
\phpCAS::setLogger();
|
||||
\phpCAS::setDebug(LOG_PATH.'/cas.log');
|
||||
// Enable verbose error messages. Disable in production!
|
||||
\phpCAS::setVerbose(true);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class XssToken
|
|||
|
||||
public static function getNew($title,$message,$type)
|
||||
{
|
||||
$_SESSION['xss_token'] = generateUniqueToken('xss',25);
|
||||
$_SESSION['xss_token'] = self::generateUniqueToken('xss',25);
|
||||
}
|
||||
|
||||
public static function remove(){
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
|
||||
$bdd = new Bdd();
|
||||
$dns = \MVC\Domain\Dns::getDNS($bdd, $url_params['ip']);
|
||||
$alias = array();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
\MVC\Object\Session::createAndTestSession();
|
||||
|
||||
$path = PATH_URL;
|
||||
$bdd = new \MVC\Classe\Bdd();
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
name : %%MODULE%%
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
engine : blade
|
||||
ariane : {%%MODULE%%}
|
||||
arianelink : {%%MODULE%%}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ name : %%PAGE%%
|
|||
page_title : module_title
|
||||
description : module_description
|
||||
engine : %%ENGINE%%
|
||||
authentification : no
|
||||
ariane : {acceuil, %%PAGE%%}
|
||||
arianelink : {index, %%PAGE%%}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ C'est un choix applicatif qu'il faut faire au moment de la contruction de l'appl
|
|||
Vous devez instancier le fichier `application/include/controlleurs/{Name}HttpReponse.php`
|
||||
qui est une classe peut implémenter `MVC\Classe\Implement\RestReponse` ou `MVC\Classe\Implement\HttpReponse` sachant que la différence se situe au niveau des méthodes qu'il doit instancier.
|
||||
|
||||
*Voici un exemple avec `RestResponse`
|
||||
##Voici un exemple avec `RestResponse`
|
||||
```php
|
||||
<?php
|
||||
|
||||
|
@ -58,7 +58,7 @@ class NameHttpReponse extends RestReponse
|
|||
}
|
||||
```
|
||||
|
||||
*voici un exemple avec `HttpResponse`
|
||||
##voici un exemple avec `HttpResponse`
|
||||
```php
|
||||
<?php
|
||||
|
||||
|
|
|
@ -90,6 +90,13 @@ dl, ol, ul {
|
|||
background-color: whitesmoke;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
.breadcrumb-sand {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 0;
|
||||
margin-bottom: 1rem;
|
||||
list-style: none;
|
||||
}
|
||||
/** Page content spacing **/
|
||||
#page-content{
|
||||
padding-top: 2rem;
|
||||
|
|
|
@ -381,15 +381,15 @@ a:hover {
|
|||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 9px;
|
||||
/*margin: 0 0 9px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px
|
||||
line-height: 18px*/
|
||||
}
|
||||
|
||||
p small {
|
||||
font-size: 11px;
|
||||
color: #999
|
||||
/*font-size: 11px;
|
||||
color: #999*/
|
||||
}
|
||||
|
||||
.lead {
|
||||
|
@ -400,65 +400,65 @@ p small {
|
|||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0;
|
||||
/*margin: 0;
|
||||
font-family: inherit;
|
||||
font-weight: bold;
|
||||
color: inherit;
|
||||
text-rendering: optimizelegibility
|
||||
text-rendering: optimizelegibility*/
|
||||
}
|
||||
|
||||
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
|
||||
font-weight: normal;
|
||||
color: #999
|
||||
/*font-weight: normal;
|
||||
color: #999*/
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
line-height: 36px
|
||||
/*font-size: 30px;
|
||||
line-height: 36px*/
|
||||
}
|
||||
|
||||
h1 small {
|
||||
font-size: 18px
|
||||
/*font-size: 18px*/
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 36px
|
||||
/*font-size: 24px;
|
||||
line-height: 36px*/
|
||||
}
|
||||
|
||||
h2 small {
|
||||
font-size: 18px
|
||||
/*font-size: 18px*/
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
line-height: 27px
|
||||
/*font-size: 18px;
|
||||
line-height: 27px*/
|
||||
}
|
||||
|
||||
h3 small {
|
||||
font-size: 14px
|
||||
/*font-size: 14px*/
|
||||
}
|
||||
|
||||
h4, h5, h6 {
|
||||
line-height: 18px
|
||||
/*line-height: 18px*/
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px
|
||||
/*font-size: 14px*/
|
||||
}
|
||||
|
||||
h4 small {
|
||||
font-size: 12px
|
||||
/*font-size: 12px*/
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 12px
|
||||
/*font-size: 12px*/
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 11px;
|
||||
/*font-size: 11px;
|
||||
color: #999;
|
||||
text-transform: uppercase
|
||||
text-transform: uppercase*/
|
||||
}
|
||||
|
||||
.page-header {
|
||||
|
@ -477,7 +477,7 @@ ul, ol {
|
|||
}
|
||||
|
||||
ul ul, ul ol, ol ol, ol ul {
|
||||
margin-bottom: 0
|
||||
/*margin-bottom: 0*/
|
||||
}
|
||||
|
||||
ul {
|
||||
|
@ -1934,7 +1934,7 @@ table .span24 {
|
|||
height: 14px;
|
||||
*margin-right: .3em;
|
||||
line-height: 14px;
|
||||
vertical-align: text-top;
|
||||
/*vertical-align: text-top;*/
|
||||
background-image: url("../img/glyphicons-halflings.png");
|
||||
background-position: 14px 14px;
|
||||
background-repeat: no-repeat
|
||||
|
|
Loading…
Reference in a new issue