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
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -228,7 +228,6 @@ if (empty($result) === false) {
|
|||
|
||||
if ($is_management_allowed === true) {
|
||||
// Form to add new categories or search categories.
|
||||
echo "<div class='w100p right_align'>";
|
||||
if (is_metaconsole() === true) {
|
||||
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
||||
} else {
|
||||
|
@ -236,9 +235,21 @@ if ($is_management_allowed === 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 '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
}
|
||||
|
|
|
@ -1,21 +1,36 @@
|
|||
<?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();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
// Include functions code
|
||||
// Include functions code.
|
||||
require_once $config['homedir'].'/include/functions_categories.php';
|
||||
|
||||
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', '');
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$buttons = [
|
||||
'list' => [
|
||||
'active' => false,
|
||||
|
@ -68,8 +83,8 @@ if (defined('METACONSOLE')) {
|
|||
|
||||
$buttons[$tab]['active'] = false;
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
// Header.
|
||||
if (is_metaconsole() === true) {
|
||||
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
|
||||
} else {
|
||||
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
|
||||
|
@ -186,32 +201,30 @@ if (defined('METACONSOLE')) {
|
|||
|
||||
echo '</table>';
|
||||
|
||||
echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>";
|
||||
echo '<tr>';
|
||||
echo '<td align=right>';
|
||||
if ($action == 'update') {
|
||||
if ($action === 'update') {
|
||||
html_print_input_hidden('update_category', 1);
|
||||
html_print_submit_button(
|
||||
__('Update'),
|
||||
'update_button',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
}
|
||||
|
||||
if ($action == 'new') {
|
||||
$buttonCaption = __('Update');
|
||||
$buttonName = 'update_button';
|
||||
$buttonIcon = 'update';
|
||||
} else if ($action === 'new') {
|
||||
html_print_input_hidden('create_category', 1);
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'create_button',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
$buttonCaption = __('Create');
|
||||
$buttonName = 'create_button';
|
||||
$buttonIcon = 'next';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
$buttonCaption,
|
||||
$buttonName,
|
||||
false,
|
||||
[ 'icon' => $buttonIcon ],
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
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
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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_agents = (bool) get_parameter('get_group_agents');
|
||||
|
||||
if ($get_group_json) {
|
||||
if ($get_group_json === true) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
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]);
|
||||
|
||||
if ($result) {
|
||||
if ((bool) $result === true) {
|
||||
$result = db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_module_group' => 0],
|
||||
|
@ -223,11 +223,11 @@ if ($is_management_allowed === true && $delete_group === true) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('There was a problem deleting group'));
|
||||
} else {
|
||||
ui_print_success_message(__('Group successfully deleted'));
|
||||
}
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Group successfully deleted'),
|
||||
__('There was a problem deleting group')
|
||||
);
|
||||
}
|
||||
|
||||
// Prepare pagination.
|
||||
|
@ -298,13 +298,17 @@ if (empty($groups) === false) {
|
|||
|
||||
if ($is_management_allowed === true) {
|
||||
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_submit_button(
|
||||
__('Create module group'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next"'
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Create module group'),
|
||||
'crt',
|
||||
false,
|
||||
[ 'icon' => 'next' ],
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
|
|
@ -418,7 +418,7 @@ class HTML
|
|||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => [ 'icon' => 'back' ],
|
||||
'attributes' => [ 'icon' => 'cancel' ],
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
|
|
|
@ -436,64 +436,27 @@ class ModuleTemplates extends HTML
|
|||
return;
|
||||
}
|
||||
|
||||
// It's important to keep the structure and order in the same way for backwards compatibility.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$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, 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
|
||||
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 '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;
|
||||
}
|
||||
$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, 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
|
||||
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
|
||||
);
|
||||
|
||||
$components = db_get_all_rows_sql($sql);
|
||||
|
||||
$row_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) {
|
||||
if (is_numeric($row_name)) {
|
||||
if (is_numeric($row_name) === true) {
|
||||
$inv_names[] = $row_name;
|
||||
} else {
|
||||
$row_names[] = $row_name;
|
||||
|
@ -501,17 +464,17 @@ class ModuleTemplates extends HTML
|
|||
}
|
||||
|
||||
$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-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
|
||||
// Clean up output buffering
|
||||
// Clean up output buffering.
|
||||
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 "\n";
|
||||
|
||||
|
@ -960,7 +923,7 @@ class ModuleTemplates extends HTML
|
|||
'label' => __('Create'),
|
||||
'name' => 'crt',
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub wand"',
|
||||
'attributes' => ['icon' => 'wand'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
@ -970,7 +933,7 @@ class ModuleTemplates extends HTML
|
|||
'label' => __('Delete selected'),
|
||||
'name' => 'erase',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'attributes' => ['icon' => 'cancel'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue