File size: 2,696 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
ob_start();

$request = isset( $_POST['request'] ) ? G::sanitizeInput($_POST['request']) : (isset( $_GET['request'] ) ? G::sanitizeInput($_GET['request']) : null);

switch ($request) {
    case 'loadMenu':
        if (! isset( $_GET['menu'] )) {
            exit( 0 );
        }

        global $G_TMP_MENU;

        $oMenu = new Menu();
        $oMenu->load( 'setup' );
        $items = array ();

        foreach ($oMenu->Options as $i => $option) {
            if ($oMenu->Types[$i] == $_GET['menu']) {
                $items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#',
                //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
                'text' => $oMenu->Labels[$i],
                //'icon'  => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
                //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
                'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i]
                );
            } else if (in_array( $oMenu->Types[$i], array ('','admToolsContent'
            ) ) && $_GET['menu'] == 'plugins') {
                $items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#',
                //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
                'text' => $oMenu->Labels[$i],
                //'icon'  => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
                //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
                'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i]
                );
            }
        }

        if (isset( $_SESSION['DEV_FLAG'] ) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings') {
            unset( $_SESSION['DEV_FLAG'] );
            $items[] = array ('id' => 'translations','url' => '../tools/main','text' => 'Translations','loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_'
            );
        }

        $x = ob_get_contents();
        ob_end_clean();

        ///////
        if ($_GET["menu"] == "plugins") {
            $i = 0;

            foreach ($items as $index => $value) {
                if ($items[$index]["id"] == "PMENTERPRISE") {
                    $i = $index;
                    break;
                }
            }

            $itemAux = $items[$i];

            array_splice( $items, $i, 1 );
            array_unshift( $items, $itemAux );
        }

        ///////
        echo G::json_encode( $items );
        break;
}