Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -6,64 +6,55 @@
*
* @package observium
* @subpackage web
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Print permission error and exit if the user doesn't have write permissions
if (!is_entity_write_permitted($device['device_id'], 'device'))
{
print_error_permission();
return;
if (!is_entity_write_permitted($device['device_id'], 'device')) {
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] = '***'; }
}
}
$export_device = $device;
device_filter_secrets($export_device, $config['snmp']['hide_auth'], '***');
if (get_var_true($vars['saveas']) && $vars['filename']) {
if (get_var_true($vars['saveas']) && $vars['filename']) {
download_as_file(gzencode(safe_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 {
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.");
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));
$form = ['type' => 'rows',
'space' => '10px',
'url' => generate_url($vars)];
// Filename
$form['row'][0]['filename'] = array(
'type' => 'text',
'name' => 'Filename',
'value' => $device['hostname'] . '.json.txt.gz',
//'div_class' => 'col-md-8',
'width' => '100%',
'placeholder' => TRUE);
$form['row'][0]['filename'] = [
'type' => 'text',
'name' => 'Filename',
'value' => $device['hostname'] . '.json.txt.gz',
//'div_class' => 'col-md-8',
'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'
);
$form['row'][0]['saveas'] = [
'type' => 'submit',
'name' => 'Export',
'icon' => 'icon-save',
'right' => TRUE,
'value' => 'yes'
];
print_form($form);
r($export_device);
}
}
unset($export_device, $params, $param);
unset($export_device, $params, $param);
// EOF