Beispiel #1
0
 */
if ($_SESSION['userlevel'] < 10) {
    print_error_permission();
    return;
}
$export_device = $device;
if ($config['snmp']['hide_auth']) {
    $params = array('snmp_community', 'snmp_authlevel', 'snmp_authname', 'snmp_authpass', 'snmp_authalgo', 'snmp_cryptopass', 'snmp_cryptoalgo');
    foreach ($params as $param) {
        if (strlen($export_device[$param])) {
            $export_device[$param] = '***';
        }
    }
}
if ($vars['saveas'] == 'yes' && $vars['filename']) {
    download_as_file(gzencode(_json_encode($export_device)), $vars['filename']);
} else {
    if ($config['snmp']['hide_auth']) {
        print_warning("NOTE, <strong>\$config['snmp']['hide_auth']</strong> is set to <strong>TRUE</strong>, snmp community and snmp v3 auth hidden from output and export.");
    } else {
        print_error("WARNING, <strong>\$config['snmp']['hide_auth']</strong> is set to <strong>FALSE</strong>, snmp community and snmp v3 auth <strong>NOT hidden</strong> from output and export.");
    }
    $form = array('type' => 'rows', 'space' => '10px', 'url' => generate_url($vars));
    // Filename
    $form['row'][0]['filename'] = array('type' => 'text', 'name' => 'Filename', 'value' => $device['hostname'] . '.json.txt.gz', 'width' => '100%', 'placeholder' => TRUE);
    // Compress
    //$form['row'][0]['compress'] = array(
    //                                'type'        => 'switch',
    //                                'value'       => 1);
    // Search button
    $form['row'][0]['saveas'] = array('type' => 'submit', 'name' => 'Export', 'icon' => 'icon-save', 'right' => TRUE, 'value' => 'yes');
        } else {
            $templates_filename .= 'all';
        }
        $form = array('type' => 'rows', 'space' => '10px', 'url' => generate_url($vars));
        // Filename
        $form['row'][0]['filename'] = array('type' => 'text', 'name' => 'Filename', 'value' => $templates_filename . '.xml', 'grid_xs' => 8, 'width' => '100%', 'placeholder' => TRUE);
        // Save as human formatted XML
        $form['row'][0]['formatted'] = array('type' => 'select', 'grid_xs' => 4, 'value' => class_exists('DOMDocument') ? 'yes' : 'no', 'values' => array('yes' => 'Formatted', 'no' => 'Unformatted'));
        // search button
        $form['row'][0]['saveas'] = array('type' => 'submit', 'name' => 'Save as..', 'icon' => 'icon-save', 'right' => TRUE, 'value' => 'yes');
        print_form($form);
        print_xml($templates_xml);
        //r(xml_to_array($templates_xml));
    } else {
        $templates_filename = $templates_export;
        download_as_file($templates_xml, $templates_filename, $vars);
    }
    unset($for_export, $templates_xml, $templates_export, $templates_filename, $form);
}
//foreach (dbFetchRows("SELECT * FROM `alert_table` LEFT JOIN `alert_table-state` ON `alert_table`.`alert_table_id` = `alert_table-state`.`alert_table_id`") as $entry)
foreach (dbFetchRows("SELECT * FROM `alert_table`" . $where) as $entry) {
    $alert_table[$entry['alert_test_id']][$entry['alert_table_id']] = $entry;
}
echo generate_box_open();
echo '<table class="table table-condensed  table-striped  table-hover">
  <thead>
    <tr>
    <th class="state-marker"></th>
    <th style="width: 1px;"></th>
    <th style="width: 250px">Name</th>
    <th style="width: 40px"></th>