-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
55 lines (44 loc) · 1.67 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
use dofus\controllers\RssController;
use dofus\controllers\UsersController;
use dofus\controllers\GiftsController;
use dofus\controllers\ServersController;
use dofus\DatabaseFactory;
use dofus\models\Accounts;
use dofus\models\AccountsInformations;
use dofus\utils\Picker;
// Importation de l'autoloader
require 'vendor/autoload.php';
session_start();
// Definition de la timezone
date_default_timezone_set('Europe/Paris');
setlocale(LC_TIME, "fr_FR");
// Variables globales
define('DS', DIRECTORY_SEPARATOR);
define('SRC', __DIR__ . DS . 'src');
define('ASSETS', __DIR__ . DS . 'assets');
// Configuration de la connexion a la base de donnees
DatabaseFactory::setConfig();
DatabaseFactory::makeConnection();
// Initialisation de Slim
$app = new \Slim\App([
'settings' => [
'displayErrorDetails' => true // Affichage des erreurs
]
]);
$container = $app->getContainer();
$container['notFoundHandler'] = function ($container) {
return function ($request, $response) use ($container) {
return $container['response']
->withStatus(404)
->withHeader('Content-Type', 'text/html')
->write('File not found.');
};
};
$app->post('/{cmntt:[a-zA-Z]+}/register', UsersController::class . ':register');
$app->get('/crypto.png', UsersController::class . ':captcha');
$app->get('/registration_come_from.{cmntt:[a-zA-Z]+}', UsersController::class . ':registrationComeFrom');
$app->get('/rss/rss.game.{cmntt:[a-zA-Z]+}.xml', RssController::class . ':rss');
$app->get('/game_actions.l.{cmntt:[a-zA-Z]+}', GiftsController::class . ':gifts');
$app->get('/serverstatus.{cmntt:[a-zA-Z]+}.xml', ServersController::class . ':serverStatus');
$app->run();