<?php

// Core du serveur //
include('classes/paf_core/PAFServer.class.php');
include('classes/paf_core/FormControl.class.php');

// Core du chat //
include('classes/ca_core/Salle.class.php');
include('classes/ca_core/Utilisateur.class.php');
include('classes/ca_core/Session.class.php');
include('classes/ca_core/Encryption.class.php');

include('classes/ca_core/modules/Login.class.php');
include('classes/ca_core/modules/Message.class.php');
include('classes/ca_core/modules/PingTimeOut.class.php');
include('classes/ca_core/modules/Salles.class.php');
include('classes/ca_core/modules/Logout.class.php');

// Classe de output //
include('classes/paf_core/JSONOutput.class.php');

// Les modules services //
include('classes/ca_core/modules/services/AdminServ.class.php');
include('classes/ca_core/modules/services/NickServ.class.php');

// Classe de status //
include('classes/ca_core/status/CommandStatus.class.php');

// Chargement des configurations //
include('classes/misc/configuration/ConfigurationLoader.class.php');
ConfigurationLoader::loadConfiguration('configuration.ini');

// Classe extra //
$lstModuleExtra = ConfigurationLoader::getConfiguration('Modules');

for ($i=0, $limit = count($lstModuleExtra['modules']); $i<$limit; $i++) {
	include($lstModuleExtra['modules'][$i]);
}

// Connexion base de données //
include('classes/misc/bd/BDConnexion.class.php');
include('classes/misc/bd/MySQLNative.class.php');
$mysqlConfig = ConfigurationLoader::getConfiguration('MySQL');
BDConnexion::setBDConnexion(new MySQLNative(
	$mysqlConfig['mysql_server'],
	$mysqlConfig['mysql_username'],
	$mysqlConfig['mysql_password'],
	$mysqlConfig['mysql_database']
));

PAFServer::getInstance()->start($_POST);
?>