27 lines
749 B
PHP
Executable File
27 lines
749 B
PHP
Executable File
<?php require_once '../autoloader.php';
|
|
|
|
use \router\core\Router;
|
|
use \database\core\Repo;
|
|
use \api\core\Request;
|
|
use \api\core\AuthSystemDefault;
|
|
use \database\core\DatabaseDriver;
|
|
|
|
/* (1) Start session */
|
|
session_start();
|
|
if( count($_SESSION['USER']) > 0 )
|
|
$_SESSION['NAME'] = $_SESSION['USER']['username'];
|
|
elseif( count($_SESSION['ADMIN']) > 0 )
|
|
$_SESSION['NAME'] = $_SESSION['ADMIN']['username'];
|
|
elseif( !isset($_SESSION['NAME']) || strlen($_SESSION['NAME']) == 0 )
|
|
$_SESSION['NAME'] = 'guest'.uniqid();
|
|
|
|
/* (2) Set default Driver for Repos */
|
|
Repo::setDriver(DatabaseDriver::get());
|
|
|
|
/* (3) Set default AuthSystem */
|
|
Request::setAuthSystem(new AuthSystemDefault);
|
|
|
|
/* (4) launch router */
|
|
Router::launch($_GET['url']);
|
|
|