コード例 #1
0
ファイル: sysmaps.php プロジェクト: songyuanjie/zabbix-stats
    $xml = zbxXML::arrayToXML($sysmaps);
    print $xml;
    exit;
}
// IMPORT ///////////////////////////////////
$rules = get_request('rules', array());
if (!isset($_FILES['import_file'])) {
    foreach (array('maps', 'icons', 'background') as $key) {
        $rules[$key]['exist'] = 1;
        $rules[$key]['missed'] = 1;
    }
}
if (isset($_FILES['import_file']) && is_file($_FILES['import_file']['tmp_name'])) {
    require_once 'include/export.inc.php';
    DBstart();
    $result = zbxXML::import($_FILES['import_file']['tmp_name']);
    if ($result) {
        $result = zbxXML::parseMap($rules);
    }
    $result = DBend($result);
    show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL);
}
$_REQUEST['go'] = get_request('go', 'none');
if (isset($_REQUEST['save'])) {
    if (isset($_REQUEST['sysmapid'])) {
        // TODO check permission by new value.
        $map = array('sysmapid' => $_REQUEST['sysmapid'], 'name' => $_REQUEST['name'], 'width' => $_REQUEST['width'], 'height' => $_REQUEST['height'], 'backgroundid' => $_REQUEST['backgroundid'], 'highlight' => get_request('highlight', 0), 'markelements' => get_request('markelements', 0), 'expandproblem' => get_request('expandproblem', 0), 'label_type' => $_REQUEST['label_type'], 'label_location' => $_REQUEST['label_location'], 'show_unack' => get_request('show_unack', 0));
        DBstart();
        $result = CMap::update($map);
        $result = DBend($result);
        add_audit_if($result, AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_MAP, 'Name [' . $_REQUEST['name'] . ']');