Example #1
0
                if ($tablenamedilenum[$v2] == 1) {
                    @unlink(MOKUAI_DIR . '/' . $biaoshi . '/' . $version . '/Modal/' . $nodes[$v]['table'] . '.php');
                }
            }
            foreach ($nodes[$nodefilename]['template'] as $k2 => $v2) {
                if ($templatenamedilenum[$v2] == 1) {
                    @unlink(MOKUAI_DIR . '/' . $biaoshi . '/' . $version . '/View/' . $nodetype . '_' . $nodes[$v]['template'] . '.htm');
                }
            }
            unset($nodes[$v]);
        }
        if ($nodes != $nodes_temp) {
            $nodes = array_sort($nodes, 'displayorder', 'asc');
            file_put_contents(MOKUAI_DIR . "/server/1.0/Data/node_" . $biaoshi . "_" . $version . ".xml", diconv(array2xml($nodes, 1), "UTF-8", $_G['charset'] . "//IGNORE"));
        }
        update_node($biaoshi, $version);
        echo '<style>.floattopempty { height: 30px !important; height: auto; } </style>';
        cpmsg(lang('plugin/yiqixueba', 'edit_node_succeed'), 'action=' . $this_page . '&&subop=mokuainode&biaoshi=' . $biaoshi . '&version=' . $version . '&nodetype=' . $nodetype, 'succeed');
    }
} elseif ($subop == 'nodeview') {
    dsetcookie('debugmokuai', $biaoshi);
    //人性化
    $nodetype = getgpc('nodetype');
    $node = getgpc('node');
    $nodexml_file = MOKUAI_DIR . "/server/1.0/Data/node_" . $biaoshi . "_" . $version . ".xml";
    $nodes = xml2array(file_get_contents($nodexml_file));
    $view_file = MOKUAI_DIR . '/' . $biaoshi . '/' . $version . '/Controler/admincp_' . $node . '.php';
    require_once $view_file;
} elseif ($subop == 'nodeedit') {
    $nodes = $nodes_temp = xml2array(file_get_contents(MOKUAI_DIR . "/server/1.0/Data/node_" . $biaoshi . "_" . $version . ".xml"));
    $nodetype = trim($_GET['nodetype']);
Example #2
0
}
$node = null;
if (get_request('nodeid')) {
    $node = get_node_by_nodeid($_REQUEST['nodeid']);
    if (!$node) {
        access_deny();
    }
}
/*
 * Actions
 */
if (isset($_REQUEST['save'])) {
    if (get_request('nodeid')) {
        $nodeid = get_request('nodeid');
        DBstart();
        $result = update_node($nodeid, get_request('name'), get_request('ip'), get_request('port'));
        $result = DBend($result);
        show_messages($result, _('Node updated'), _('Cannot update node'));
        $audit_action = AUDIT_ACTION_UPDATE;
    } else {
        DBstart();
        $nodeid = add_node(get_request('new_nodeid'), get_request('name'), get_request('ip'), get_request('port'), get_request('nodetype'), get_request('masterid'));
        $result = DBend($nodeid);
        show_messages($result, _('Node added'), _('Cannot add node'));
        $audit_action = AUDIT_ACTION_ADD;
    }
    if ($result) {
        add_audit($audit_action, AUDIT_RESOURCE_NODE, 'Node [' . $_REQUEST['name'] . '] id [' . $nodeid . ']');
        unset($_REQUEST['form']);
    }
} elseif (isset($_REQUEST['delete'])) {
Example #3
0
$page['file'] = 'nodes.php';
$page['hist_arg'] = array();
include_once 'include/page_header.php';
$fields = array('nodeid' => array(T_ZBX_INT, O_NO, null, DB_ID, '(isset({form})&&({form}=="update"))'), 'new_nodeid' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), 'name' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), 'timezone' => array(T_ZBX_INT, O_OPT, null, BETWEEN(-12, +13), 'isset({save})'), 'ip' => array(T_ZBX_IP, O_OPT, null, null, 'isset({save})'), 'node_type' => array(T_ZBX_INT, O_OPT, null, IN(ZBX_NODE_CHILD . ',' . ZBX_NODE_MASTER . ',' . ZBX_NODE_LOCAL), 'isset({save})&&!isset({nodeid})'), 'masterid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 65535), 'isset({save})'), 'slave_history' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})'), 'slave_trends' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_refresh' => array(T_ZBX_INT, O_OPT, NULL, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder();
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST);
if (0 == count($available_nodes)) {
    access_deny();
}
if (isset($_REQUEST['save'])) {
    $result = false;
    if (isset($_REQUEST['nodeid'])) {
        $audit_action = AUDIT_ACTION_UPDATE;
        DBstart();
        $result = update_node($_REQUEST['nodeid'], $_REQUEST['new_nodeid'], $_REQUEST['name'], $_REQUEST['timezone'], $_REQUEST['ip'], $_REQUEST['port'], $_REQUEST['slave_history'], $_REQUEST['slave_trends']);
        $result = DBend($result);
        $nodeid = $_REQUEST['nodeid'];
        show_messages($result, S_NODE_UPDATED, S_CANNOT_UPDATE_NODE);
    } else {
        $audit_action = AUDIT_ACTION_ADD;
        $_REQUEST['masterid'] = isset($_REQUEST['masterid']) ? $_REQUEST['masterid'] : null;
        DBstart();
        $nodeid = add_node($_REQUEST['new_nodeid'], $_REQUEST['name'], $_REQUEST['timezone'], $_REQUEST['ip'], $_REQUEST['port'], $_REQUEST['slave_history'], $_REQUEST['slave_trends'], $_REQUEST['node_type'], $_REQUEST['masterid']);
        $result = DBend($nodeid);
        show_messages($result, S_NODE_ADDED, S_CANNOT_ADD_NODE);
    }
    add_audit_if($result, $audit_action, AUDIT_RESOURCE_NODE, 'Node [' . $_REQUEST['name'] . '] id [' . $nodeid . ']');
    if ($result) {
        unset($_REQUEST['form']);
    }