SMMP/index.php

35 lines
1.5 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){ $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(){ $subMenu = 'index'; include __ROOT__.'/view.php'; });
$R->get('machines/?', function(){ $subMenu = 'index'; include __ROOT__.'/view.php'; });
$R->get('users/?', function(){ $subMenu = 'index'; include __ROOT__.'/view.php'; });
$R->get('sync/?', function(){ $subMenu = 'index'; include __ROOT__.'/view.php'; });
$R->get('settings/?', function(){ $subMenu = 'index'; include __ROOT__.'/view.php'; });
$R->post('.*', function(){
echo 'Acces POST';
});
/* [2] On lance le routeur
===================================================*/
$R->run();
?>