Changes
This commit is contained in:
parent
195611a3c1
commit
32466c6906
|
@ -14,7 +14,7 @@
|
||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -228,7 +228,6 @@ if (empty($result) === false) {
|
||||||
|
|
||||||
if ($is_management_allowed === true) {
|
if ($is_management_allowed === true) {
|
||||||
// Form to add new categories or search categories.
|
// Form to add new categories or search categories.
|
||||||
echo "<div class='w100p right_align'>";
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,9 +235,21 @@ if ($is_management_allowed === true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_input_hidden('create_category', '1', true);
|
html_print_input_hidden('create_category', '1', true);
|
||||||
html_print_submit_button(__('Create category'), 'create_button', false, 'class="sub next"');
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
__('Create category'),
|
||||||
|
'create_button',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,36 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Edit Category.
|
||||||
|
*
|
||||||
|
* @category Category
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
// Include functions code
|
// Include functions code.
|
||||||
require_once $config['homedir'].'/include/functions_categories.php';
|
require_once $config['homedir'].'/include/functions_categories.php';
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
|
@ -36,7 +51,7 @@ $create_category = (int) get_parameter('create_category', 0);
|
||||||
$name_category = (string) get_parameter('name_category', '');
|
$name_category = (string) get_parameter('name_category', '');
|
||||||
$tab = (string) get_parameter('tab', 'list');
|
$tab = (string) get_parameter('tab', 'list');
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
$buttons = [
|
$buttons = [
|
||||||
'list' => [
|
'list' => [
|
||||||
'active' => false,
|
'active' => false,
|
||||||
|
@ -68,8 +83,8 @@ if (defined('METACONSOLE')) {
|
||||||
|
|
||||||
$buttons[$tab]['active'] = false;
|
$buttons[$tab]['active'] = false;
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
|
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
|
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
|
||||||
|
@ -186,32 +201,30 @@ if (defined('METACONSOLE')) {
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>";
|
if ($action === 'update') {
|
||||||
echo '<tr>';
|
|
||||||
echo '<td align=right>';
|
|
||||||
if ($action == 'update') {
|
|
||||||
html_print_input_hidden('update_category', 1);
|
html_print_input_hidden('update_category', 1);
|
||||||
html_print_submit_button(
|
$buttonCaption = __('Update');
|
||||||
__('Update'),
|
$buttonName = 'update_button';
|
||||||
'update_button',
|
$buttonIcon = 'update';
|
||||||
false,
|
} else if ($action === 'new') {
|
||||||
'class="sub next"'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'new') {
|
|
||||||
html_print_input_hidden('create_category', 1);
|
html_print_input_hidden('create_category', 1);
|
||||||
html_print_submit_button(
|
$buttonCaption = __('Create');
|
||||||
__('Create'),
|
$buttonName = 'create_button';
|
||||||
'create_button',
|
$buttonIcon = 'next';
|
||||||
false,
|
|
||||||
'class="sub next"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td>';
|
html_print_div(
|
||||||
echo '</tr>';
|
[
|
||||||
echo '</table>';
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
$buttonCaption,
|
||||||
|
$buttonName,
|
||||||
|
false,
|
||||||
|
[ 'icon' => $buttonIcon ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,7 +43,7 @@ if (is_ajax() === true) {
|
||||||
$get_group_json = (bool) get_parameter('get_group_json');
|
$get_group_json = (bool) get_parameter('get_group_json');
|
||||||
$get_group_agents = (bool) get_parameter('get_group_agents');
|
$get_group_agents = (bool) get_parameter('get_group_agents');
|
||||||
|
|
||||||
if ($get_group_json) {
|
if ($get_group_json === true) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], $id_group, 'AR')) {
|
if (! check_acl($config['id_user'], $id_group, 'AR')) {
|
||||||
|
@ -174,7 +174,7 @@ if ($is_management_allowed === true && $delete_group === true) {
|
||||||
|
|
||||||
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
|
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
|
||||||
|
|
||||||
if ($result) {
|
if ((bool) $result === true) {
|
||||||
$result = db_process_sql_update(
|
$result = db_process_sql_update(
|
||||||
'tagente_modulo',
|
'tagente_modulo',
|
||||||
['id_module_group' => 0],
|
['id_module_group' => 0],
|
||||||
|
@ -223,11 +223,11 @@ if ($is_management_allowed === true && $delete_group === true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $result) {
|
ui_print_result_message(
|
||||||
ui_print_error_message(__('There was a problem deleting group'));
|
$result,
|
||||||
} else {
|
__('Group successfully deleted'),
|
||||||
ui_print_success_message(__('Group successfully deleted'));
|
__('There was a problem deleting group')
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare pagination.
|
// Prepare pagination.
|
||||||
|
@ -298,13 +298,17 @@ if (empty($groups) === false) {
|
||||||
|
|
||||||
if ($is_management_allowed === true) {
|
if ($is_management_allowed === true) {
|
||||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
|
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
html_print_div(
|
||||||
html_print_submit_button(
|
[
|
||||||
__('Create module group'),
|
'class' => 'action-buttons',
|
||||||
'crt',
|
'content' => html_print_submit_button(
|
||||||
false,
|
__('Create module group'),
|
||||||
'class="sub next"'
|
'crt',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ class HTML
|
||||||
'name' => 'submit',
|
'name' => 'submit',
|
||||||
'label' => __('Go back'),
|
'label' => __('Go back'),
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'attributes' => [ 'icon' => 'back' ],
|
'attributes' => [ 'icon' => 'cancel' ],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
@ -436,64 +436,27 @@ class ModuleTemplates extends HTML
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's important to keep the structure and order in the same way for backwards compatibility.
|
$sql = sprintf(
|
||||||
switch ($config['dbtype']) {
|
'
|
||||||
case 'mysql':
|
SELECT components.name, components.description, components.type, components.max, components.min, components.module_interval,
|
||||||
$sql = sprintf(
|
components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid,
|
||||||
'
|
components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter,
|
||||||
SELECT components.name, components.description, components.type, components.max, components.min, components.module_interval,
|
components.max_timeout, components.max_retries, components.history_data, components.min_warning, components.max_warning, components.str_warning, components.min_critical,
|
||||||
components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid,
|
components.max_critical, components.str_critical, components.min_ff_event, components.dynamic_interval, components.dynamic_max, components.dynamic_min, components.dynamic_two_tailed, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions
|
||||||
components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter,
|
FROM `tnetwork_component` AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group
|
||||||
components.max_timeout, components.max_retries, components.history_data, components.min_warning, components.max_warning, components.str_warning, components.min_critical,
|
WHERE tpc.id_nc = components.id_nc
|
||||||
components.max_critical, components.str_critical, components.min_ff_event, components.dynamic_interval, components.dynamic_max, components.dynamic_min, components.dynamic_two_tailed, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions
|
AND components.id_group = comp_group.id_sg
|
||||||
FROM `tnetwork_component` AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group
|
AND tpc.id_np = %d',
|
||||||
WHERE tpc.id_nc = components.id_nc
|
$this->id_np
|
||||||
AND components.id_group = comp_group.id_sg
|
);
|
||||||
AND tpc.id_np = %d',
|
|
||||||
$this->id_np
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
|
||||||
$sql = sprintf(
|
|
||||||
'
|
|
||||||
SELECT components.name, components.description, components.type, components.max, components.min, components.module_interval,
|
|
||||||
components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid,
|
|
||||||
components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter,
|
|
||||||
components.max_timeout, components.max_retries, components.history_data, components.min_warning, components.max_warning, components.str_warning, components.min_critical,
|
|
||||||
components.max_critical, components.str_critical, components.min_ff_event, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions
|
|
||||||
FROM "tnetwork_component" AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group
|
|
||||||
WHERE tpc.id_nc = components.id_nc
|
|
||||||
AND components.id_group = comp_group.id_sg
|
|
||||||
AND tpc.id_np = %d',
|
|
||||||
$this->id_np
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$sql = sprintf(
|
|
||||||
'
|
|
||||||
SELECT components.name, components.description, components.type, components.max, components.min, components.module_interval,
|
|
||||||
components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid,
|
|
||||||
components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter,
|
|
||||||
components.max_timeout, components.max_retries, components.history_data, components.min_warning, components.max_warning, components.str_warning, components.min_critical,
|
|
||||||
components.max_critical, components.str_critical, components.min_ff_event, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions
|
|
||||||
FROM tnetwork_component AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group
|
|
||||||
WHERE tpc.id_nc = components.id_nc
|
|
||||||
AND components.id_group = comp_group.id_sg
|
|
||||||
AND tpc.id_np = %d',
|
|
||||||
$this->id_np
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$components = db_get_all_rows_sql($sql);
|
$components = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
$row_names = [];
|
$row_names = [];
|
||||||
$inv_names = [];
|
$inv_names = [];
|
||||||
// Find the names of the rows that we are getting and throw away the duplicate numeric keys
|
// Find the names of the rows that we are getting and throw away the duplicate numeric keys.
|
||||||
foreach ($components[0] as $row_name => $detail) {
|
foreach ($components[0] as $row_name => $detail) {
|
||||||
if (is_numeric($row_name)) {
|
if (is_numeric($row_name) === true) {
|
||||||
$inv_names[] = $row_name;
|
$inv_names[] = $row_name;
|
||||||
} else {
|
} else {
|
||||||
$row_names[] = $row_name;
|
$row_names[] = $row_name;
|
||||||
|
@ -501,17 +464,17 @@ class ModuleTemplates extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = io_safe_output($profile_info['name']);
|
$fileName = io_safe_output($profile_info['name']);
|
||||||
// Send headers to tell the browser we're sending a file
|
// Send headers to tell the browser we're sending a file.
|
||||||
header('Content-type: application/octet-stream');
|
header('Content-type: application/octet-stream');
|
||||||
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
|
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header('Expires: 0');
|
header('Expires: 0');
|
||||||
|
|
||||||
// Clean up output buffering
|
// Clean up output buffering.
|
||||||
while (@ob_end_clean()) {
|
while (@ob_end_clean()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then print the first line (row names)
|
// Then print the first line (row names).
|
||||||
echo '"'.implode('"'.$config['csv_divider'].'"', $row_names).'"';
|
echo '"'.implode('"'.$config['csv_divider'].'"', $row_names).'"';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
|
@ -960,7 +923,7 @@ class ModuleTemplates extends HTML
|
||||||
'label' => __('Create'),
|
'label' => __('Create'),
|
||||||
'name' => 'crt',
|
'name' => 'crt',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'attributes' => 'class="sub wand"',
|
'attributes' => ['icon' => 'wand'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -970,7 +933,7 @@ class ModuleTemplates extends HTML
|
||||||
'label' => __('Delete selected'),
|
'label' => __('Delete selected'),
|
||||||
'name' => 'erase',
|
'name' => 'erase',
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'attributes' => 'class="sub cancel"',
|
'attributes' => ['icon' => 'cancel'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue