<?php
if(core::ifGet("actif")){
    if(core::getGet("actif") == "true"){
        core::addFileMaintenance();

        historique::recRef("/parametres.html");
        historique::add(array(
            "idType" => historique::getIdRef("ACTION"),
            "idUser" => session::getId(),
            "idPage" => historique::getIdRef("/parametres.html"),
            "log" => "Mode maintenance : Activation"
        ));

        alert::recSuccess("Le mode maintenance est activé");
    } else {
        core::removeFileMaintenance();

        historique::recRef("/parametres.html");
        historique::add(array(
            "idType" => historique::getIdRef("ACTION"),
            "idUser" => session::getId(),
            "idPage" => historique::getIdRef("/parametres.html"),
            "log" => "Mode maintenance : Désactivation"
        ));

        alert::recSuccess("Le mode maintenance est déactivé");
    }
}

header("Location: /parametres.html");
exit();