SMMP/index.php

48 lines
2.1 KiB
PHP
Raw Normal View History

<?php define('__ROOT__', dirname(__FILE__) );
require_once 'manager/autoloader.php';
/* [0] On initialise le routeur
===================================================*/
$R = new router\Router( $_GET['url'] );
// var_dump($R);
/* [1] On cree les regles de routage
===================================================*/
$R->get('/?', function(){ header('Location: /dashboard/'); });
$R->get('dashboard/(?::submenu/)*', function($sm){ var_dump(func_get_args()); $subMenu = $sm; include __ROOT__.'/view.php'; });
$R->get('machines/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; });
$R->get('users/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; });
$R->get('sync/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; });
$R->get('settings/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; });
$R->get('dashboard', function(){ header('Location: /dashboard/'); });
$R->get('machines', function(){ header('Location: /machines/'); });
$R->get('users', function(){ header('Location: /users/'); });
$R->get('sync', function(){ header('Location: /sync/'); });
$R->get('settings', function(){ header('Location: /settings/'); });
$R->get('dashboard/', function(){ include __ROOT__.'/view.php'; });
$R->get('machines/', function(){ include __ROOT__.'/view.php'; });
$R->get('users/', function(){ include __ROOT__.'/view.php'; });
$R->get('sync/', function(){ include __ROOT__.'/view.php'; });
$R->get('settings/', function(){ include __ROOT__.'/view.php'; });
// Correction d'
$R->get('.+', function(){ header('Location: /dashboard/'); });
$R->post('.*', function(){
var_dump( 'Acces POST : '.$_GET['url'] );
});
/* [2] On lance le routeur
===================================================*/
$R->run();
?>