2017-11-23 10:23:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/* [1] On definit les chemins absolus si c'est pas deja fait
|
|
|
|
=========================================================*/
|
|
|
|
if( !defined('__ROOT__') ) define('__ROOT__', dirname(__FILE__) );
|
|
|
|
if( !defined('__CONFIG__') ) define('__CONFIG__', __ROOT__.'/config' );
|
|
|
|
if( !defined('__BUILD__') ) define('__BUILD__', __ROOT__.'/build' );
|
|
|
|
if( !defined('__PUBLIC__') ) define('__PUBLIC__', __ROOT__.'/public_html' );
|
|
|
|
|
|
|
|
|
|
|
|
/* ACTIVE LE DEBUGGAGE (WARNING + EXCEPTION)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function debug(){
|
|
|
|
ini_set('display_errors',1);
|
|
|
|
ini_set('display_startup_errors',1);
|
|
|
|
error_reporting(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-26 10:40:59 +00:00
|
|
|
/* Secure Hash Function
|
|
|
|
*
|
|
|
|
* @raw<String> Data to hash
|
|
|
|
* @salt<String> Salt to use for hashing
|
|
|
|
* @pepper<String> Pepper to use for hashing
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function secure_hash(String $raw, String $salt='2104\'dsa:">AS"D:', String $pepper='3894.234123;\'21'){
|
|
|
|
return hash('sha512', $pepper.hash('sha512', $raw.$salt));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-23 10:23:09 +00:00
|
|
|
/* AUTOLOADER
|
|
|
|
*
|
|
|
|
* @className<String> Nom de la classe appelee
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function autoloader($className){
|
|
|
|
$path = '';
|
|
|
|
|
|
|
|
/* [1] On utilise le namespace pour localiser
|
|
|
|
===============================================*/
|
|
|
|
// On remplace les '\' par des '/'
|
|
|
|
$path = str_replace('\\', '/', $className) . '.php';
|
|
|
|
$path = __BUILD__.'/'.$path;
|
|
|
|
|
|
|
|
// Si le fichier existe
|
|
|
|
if( file_exists($path) )
|
|
|
|
require_once $path; // on inclue le fichier
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// On definit l'autoloader comme autoloader (obvious)
|
|
|
|
spl_autoload_register('autoloader', false, true);
|
|
|
|
|
|
|
|
|
|
|
|
?>
|