Пример #1
0
try {
    require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    include_file('core', 'pin', 'config', 'arduidom');
    if (!isConnect('admin')) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__));
    }
    if (init('action') == 'startDaemon') {
        if (arduidom::deamon_start(true)) {
            ajax::success();
        } else {
            ajax::error("Le démon n'a pas démarré !");
        }
    }
    if (init('action') == 'bt_Prerequis') {
        arduidom::dependancy_install();
        ajax::success();
    }
    if (init('action') == 'stopDaemon') {
        if (arduidom::deamon_stop()) {
            ajax::success();
        } else {
            ajax::error("Le démon n'a pas été stoppé !");
        }
    }
    if (init('action') == 'checkDaemon') {
        if (arduidom::deamon_info()['state'] == 'ok') {
            ajax::success();
        } else {
            ajax::error("Le démon ne fonctionne pas !");
        }