<?php

setlocale(LC_TIME, 'fr_FR');
date_default_timezone_set(TIME_ZONE);

require DIR_PHP_LIBS.'PHPMailer/Exception.php';
require DIR_PHP_LIBS.'PHPMailer/PHPMailer.php';
require DIR_PHP_LIBS.'PHPMailer/SMTP.php';

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

spl_autoload_register(function ($class_name) {
    (file_exists(DIR_PHP_CLASS.'/'.$class_name.'.class.php'))?	
    require_once DIR_PHP_CLASS.'/'.$class_name.'.class.php' : '';
});

// Filtre les IP authorisés à accéder au site
if(!is_null(WHITE_IP)){
    if(!in_array(htmlspecialchars(core::getUserIP()), WHITE_IP)){
        header("Location: /noAccess.php");
        exit();
    }
}

if(debug::isFile("debug")){
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    debug::startTimer();
}

if(debug::isFile("maintenance") AND $_SERVER['HTTP_HOST'] != DOMAIN_CMS){
    get::page("maintenance");
    exit();
}
