2015-10-29 00:47:40 +01:00
|
|
|
<?php
|
2017-03-29 23:46:26 +02:00
|
|
|
@include 'config.php';
|
2015-10-29 00:47:40 +01:00
|
|
|
require_once 'vendor/autoload.php';
|
|
|
|
|
|
|
|
// REDBEAN CONFIGURATION
|
|
|
|
use RedBeanPHP\Facade as RedBean;
|
2017-03-15 06:17:16 +01:00
|
|
|
|
|
|
|
if(defined('MYSQL_HOST') && defined('MYSQL_DATABASE') && defined('MYSQL_USER') && defined('MYSQL_PASSWORD')) {
|
2018-03-28 04:30:18 +02:00
|
|
|
if(!defined('MYSQL_PORT')) define('MYSQL_PORT', '3306');
|
|
|
|
RedBean::setup('mysql:host='. MYSQL_HOST . ';port=' . MYSQL_PORT . ';dbname=' . MYSQL_DATABASE , MYSQL_USER, MYSQL_PASSWORD);
|
2017-03-15 06:17:16 +01:00
|
|
|
RedBean::setAutoResolve(true);
|
|
|
|
}
|
2015-10-29 00:47:40 +01:00
|
|
|
|
|
|
|
// SLIM FRAMEWORK
|
|
|
|
\Slim\Slim::registerAutoLoader();
|
|
|
|
$app = new \Slim\Slim();
|
|
|
|
|
2016-05-15 00:08:30 +02:00
|
|
|
// LOAD LIBRARIES
|
|
|
|
include_once 'libs/Controller.php';
|
|
|
|
include_once 'libs/ControllerGroup.php';
|
|
|
|
include_once 'libs/Hashing.php';
|
2016-07-15 00:06:47 +02:00
|
|
|
include_once 'libs/MailSender.php';
|
2016-08-01 05:34:55 +02:00
|
|
|
include_once 'libs/Date.php';
|
2016-08-04 05:59:04 +02:00
|
|
|
include_once 'libs/DataStoreList.php';
|
2017-01-12 20:45:01 +01:00
|
|
|
include_once 'libs/LinearCongruentialGenerator.php';
|
|
|
|
include_once 'libs/FileManager.php';
|
|
|
|
include_once 'libs/FileDownloader.php';
|
|
|
|
include_once 'libs/FileUploader.php';
|
2016-05-15 00:08:30 +02:00
|
|
|
|
2017-01-14 22:19:21 +01:00
|
|
|
Controller::init();
|
|
|
|
|
2016-07-26 23:30:51 +02:00
|
|
|
// LOAD DATA
|
|
|
|
spl_autoload_register(function ($class) {
|
|
|
|
$classPath = "data/{$class}.php";
|
|
|
|
|
|
|
|
if(file_exists($classPath)) {
|
|
|
|
include_once $classPath;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-10-29 00:47:40 +01:00
|
|
|
// LOAD MODELS
|
|
|
|
spl_autoload_register(function ($class) {
|
|
|
|
$classPath = "models/{$class}.php";
|
|
|
|
|
|
|
|
if(file_exists($classPath)) {
|
2016-06-19 01:08:53 +02:00
|
|
|
include_once $classPath;
|
2015-10-29 00:47:40 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-08-04 05:59:04 +02:00
|
|
|
//Load custom validations
|
2016-08-04 20:18:29 +02:00
|
|
|
include_once 'libs/validations/dataStoreId.php';
|
2016-08-04 21:01:24 +02:00
|
|
|
include_once 'libs/validations/userEmail.php';
|
2016-08-20 23:24:22 +02:00
|
|
|
include_once 'libs/validations/captcha.php';
|
2016-10-03 21:44:41 +02:00
|
|
|
include_once 'libs/validations/validLanguage.php';
|
2016-09-09 05:38:58 +02:00
|
|
|
include_once 'libs/validations/validTicketNumber.php';
|
2016-08-04 05:59:04 +02:00
|
|
|
|
2015-10-29 00:47:40 +01:00
|
|
|
// LOAD CONTROLLERS
|
|
|
|
foreach (glob('controllers/*.php') as $controller) {
|
2016-06-19 01:08:53 +02:00
|
|
|
include_once $controller;
|
2015-10-29 00:47:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$app->run();
|