Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

glpi / src / plugins / vigilo / front / menu.php @ 77f0ba6f

History | View | Annotate | Download (1.09 KB)

1
<?php
2

    
3
include(
4
    dirname(dirname(dirname(__DIR__))) .
5
    DIRECTORY_SEPARATOR . "inc" .
6
    DIRECTORY_SEPARATOR . "includes.php"
7
);
8

    
9
if (PluginVigiloMenu::canView()) {
10
    Html::header(
11
        __('Vigilo', 'vigilo'),
12
        $_SERVER["PHP_SELF"],
13
        "plugins",
14
        "PluginVigiloMenu",
15
        "menu"
16
    );
17

    
18
    $res = null;
19
    $pipes = array();
20

    
21
    if (!empty($_POST["deploy"])) {
22
        $fds = array(
23
            1 => array("pipe", "w"),
24
            2 => array("pipe", "w"),
25
        );
26

    
27
        $debug  = empty($_POST['debug']) ? '' : '--debug';
28
        $force  = empty($_POST['force']) ? '' : '--force';
29
        $cmd    = "/usr/bin/sudo -n /usr/bin/vigiconf deploy $force $debug";
30
        $env    = array(
31
            "LC_ALL" => isset($_SESSION["glpilanguage"]) ? $_SESSION["glpilanguage"] : "en",
32
            "PATH" => getenv("PATH")
33
        );
34
        $res    = proc_open($cmd, $fds, $pipes, NULL, $env);
35

    
36
        if (!is_resource($res)) {
37
            $res = false;
38
        }
39
    }
40
    PluginVigiloMenu::displayMenu($res, $pipes);
41
} else {
42
    Html::displayRightError();
43
}
44

    
45
Html::footer();