Use global descartes loader

This commit is contained in:
osaajani 2019-10-29 18:34:37 +01:00
parent d3408e0600
commit 1d69b5dfce
2 changed files with 15 additions and 48 deletions

View File

@ -1,39 +1,19 @@
#!/usr/bin/php
<?php
require_once(__DIR__ . '/descartes/load.php');
###############
# ENVIRONMENT #
###############
define('ENVIRONMENT', 'dev');
define('FROM_WEB', true);
require_once(__DIR__ . '/descartes/load-environment.php');
##############
# INCLUSIONS #
##############
require_once(PWD . '/descartes/autoload.php');
require_once(PWD . '/vendor/autoload.php');
require_once(PWD . '/descartes/Console.php');
require_once(PWD . '/routes.php');
#########
# MODEL #
#########
#Define raspisms settings
$bdd = Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$model_setting = new \models\Setting($bdd);
#####################
# RASPISMS SETTINGS #
#####################
$bdd = descartes\Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_setting = new \controllers\internals\Setting($bdd);
$settings = $model_setting->all();
$settings = $internal_setting->all();
foreach ($settings as $setting)
{
define('RASPISMS_SETTINGS_' . mb_convert_case($setting['name'], MB_CASE_UPPER), $setting['value']);
}
###########
# ROUTAGE #
###########
//Partie gérant l'appel des controlleurs
$console = new \Console($argv);
$console->executeCommand($console->getCommand());
//Execute command
descartes\Console::execute_command($argv);

View File

@ -1,13 +1,5 @@
<?php
###############
# ENVIRONMENT #
###############
require_once(__DIR__ . '/descartes/load-environment.php');
###########
# ROUTING #
###########
require_once(PWD . '/routes.php'); //Include routes
require_once(__DIR__ . '/descartes/load.php');
############
# SESSIONS #
@ -21,15 +13,10 @@
$_SESSION['csrf'] = str_shuffle(uniqid().uniqid());
}
##############
# INCLUDE #
##############
//Use autoload
require_once(PWD . '/descartes/autoload.php');
require_once(PWD . '/vendor/autoload.php');
#Define raspisms settings
$bdd = Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
#####################
# RASPISMS SETTINGS #
#####################
$bdd = descartes\Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_setting = new \controllers\internals\Setting($bdd);
$settings = $internal_setting->all();
@ -39,4 +26,4 @@
}
//Routing current query
Router::route(ROUTES, $_SERVER['REQUEST_URI']);
descartes\Router::route(ROUTES, $_SERVER['REQUEST_URI']);