fix category, Os, tags, user_edit synch
This commit is contained in:
parent
a0982cd260
commit
ec6cb4d532
|
@ -1,40 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Category.
|
||||
*
|
||||
* @category Category
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
// Check login and ACLs
|
||||
// Check login and ACLs.
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
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'])) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access Categories Management');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Include functions code
|
||||
// Include functions code.
|
||||
require_once $config['homedir'].'/include/functions_categories.php';
|
||||
|
||||
// Get parameters
|
||||
// Get parameters.
|
||||
$delete = (int) get_parameter('delete_category', 0);
|
||||
$search = (int) get_parameter('search_category', 0);
|
||||
$category_name = (string) get_parameter('category_name', '');
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$buttons = [
|
||||
'list' => [
|
||||
'active' => false,
|
||||
|
@ -66,34 +81,42 @@ if (defined('METACONSOLE')) {
|
|||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
// Header.
|
||||
if (is_metaconsole() === true) {
|
||||
ui_meta_print_header(__('Categories configuration'), __('List'), $buttons);
|
||||
} else {
|
||||
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
|
||||
}
|
||||
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All profiles information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
// Two actions can performed in this page: search and delete categories
|
||||
// Delete action: This will delete a category
|
||||
if ($delete != 0) {
|
||||
// Delete action: This will delete a category.
|
||||
if ($is_management_allowed === true && $delete != 0) {
|
||||
$return_delete = categories_delete_category($delete);
|
||||
if (!$return_delete) {
|
||||
db_pandora_audit('Category management', "Fail try to delete category #$delete");
|
||||
db_pandora_audit('Category management', 'Fail try to delete category #'.$delete);
|
||||
ui_print_error_message(__('Error deleting category'));
|
||||
} else {
|
||||
db_pandora_audit('Category management', "Delete category #$delete");
|
||||
db_pandora_audit('Category management', 'Delete category #'.$delete);
|
||||
ui_print_success_message(__('Successfully deleted category'));
|
||||
}
|
||||
}
|
||||
|
||||
// statements for pagination
|
||||
// Statements for pagination.
|
||||
$url = ui_get_url_refresh();
|
||||
$total_categories = categories_get_category_count();
|
||||
|
||||
$filter['offset'] = (int) get_parameter('offset');
|
||||
$filter['limit'] = (int) $config['block_size'];
|
||||
// Search action: This will filter the display category view
|
||||
// Search action: This will filter the display category view.
|
||||
$result = false;
|
||||
|
||||
$result = db_get_all_rows_filter(
|
||||
|
@ -104,12 +127,12 @@ $result = db_get_all_rows_filter(
|
|||
]
|
||||
);
|
||||
|
||||
// Display categories previously filtered or not
|
||||
// Display categories previously filtered or not.
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
if (!empty($result)) {
|
||||
// Prepare pagination
|
||||
if (empty($result) === false) {
|
||||
// Prepare pagination.
|
||||
ui_pagination($total_categories, $url);
|
||||
|
||||
$table = new stdClass();
|
||||
|
@ -123,7 +146,9 @@ if (!empty($result)) {
|
|||
$table->style[0] = 'font-weight: bold; text-align:left';
|
||||
$table->style[1] = 'text-align:center; width: 100px;';
|
||||
$table->head[0] = __('Category name');
|
||||
$table->head[1] = __('Actions');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[1] = __('Actions');
|
||||
}
|
||||
|
||||
foreach ($result as $category) {
|
||||
if ($rowPair) {
|
||||
|
@ -137,7 +162,7 @@ if (!empty($result)) {
|
|||
|
||||
$data = [];
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
|
||||
$data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
|
||||
'images/config.png',
|
||||
|
@ -150,18 +175,25 @@ if (!empty($result)) {
|
|||
['title' => 'Delete']
|
||||
).'</a>';
|
||||
} else {
|
||||
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
|
||||
$table->cellclass[][1] = 'action_buttons';
|
||||
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
['title' => 'Edit']
|
||||
).'</a>';
|
||||
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['title' => 'Delete']
|
||||
).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
|
||||
} else {
|
||||
$data[0] = $category['name'];
|
||||
}
|
||||
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][1] = 'action_buttons';
|
||||
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
['title' => 'Edit']
|
||||
).'</a>';
|
||||
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['title' => 'Delete']
|
||||
).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
|
@ -170,21 +202,23 @@ if (!empty($result)) {
|
|||
html_print_table($table);
|
||||
ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
} else {
|
||||
// No categories available or selected
|
||||
// No categories available or selected.
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
|
||||
}
|
||||
|
||||
// Form to add new categories or search categories
|
||||
echo "<div class='w100p right_align'>";
|
||||
if (defined('METACONSOLE')) {
|
||||
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
||||
} else {
|
||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
||||
}
|
||||
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 {
|
||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
|
||||
}
|
||||
|
||||
html_print_input_hidden('create_category', '1', true);
|
||||
html_print_submit_button(__('Create category'), 'create_button', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
enterprise_hook('close_meta_frame');
|
||||
}
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Os.
|
||||
*
|
||||
* @category Os
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -22,6 +37,14 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
|||
return;
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All profiles information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
|
||||
$table->width = '100%';
|
||||
|
@ -31,11 +54,19 @@ $table->head[0] = '';
|
|||
$table->head[1] = __('ID');
|
||||
$table->head[2] = __('Name');
|
||||
$table->head[3] = __('Description');
|
||||
$table->head[4] = '';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[4] = '';
|
||||
}
|
||||
|
||||
$table->align[0] = 'center';
|
||||
$table->align[4] = 'center';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->align[4] = 'center';
|
||||
}
|
||||
|
||||
$table->size[0] = '20px';
|
||||
$table->size[4] = '20px';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->size[4] = '20px';
|
||||
}
|
||||
|
||||
// Prepare pagination.
|
||||
$offset = (int) get_parameter('offset');
|
||||
|
@ -59,30 +90,36 @@ foreach ($osList as $os) {
|
|||
$data = [];
|
||||
$data[] = ui_print_os_icon($os['id_os'], false, true);
|
||||
$data[] = $os['id_os'];
|
||||
if (is_metaconsole()) {
|
||||
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
if (is_metaconsole() === true) {
|
||||
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
|
||||
} else {
|
||||
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
|
||||
$data[] = io_safe_output($os['name']);
|
||||
}
|
||||
|
||||
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true);
|
||||
|
||||
$table->cellclass[][4] = 'action_buttons';
|
||||
if ($os['id_os'] > 16) {
|
||||
if (is_metaconsole()) {
|
||||
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][4] = 'action_buttons';
|
||||
if ($os['id_os'] > 16) {
|
||||
if (is_metaconsole()) {
|
||||
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>';
|
||||
} else {
|
||||
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
|
||||
// The original icons of pandora don't delete.
|
||||
$data[] = '';
|
||||
}
|
||||
} else {
|
||||
// The original icons of pandora don't delete.
|
||||
$data[] = '';
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
if (isset($data) === true) {
|
||||
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset);
|
||||
html_print_table($table);
|
||||
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
|
@ -90,7 +127,7 @@ if (isset($data)) {
|
|||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
echo '<form method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=builder">';
|
||||
echo "<div style='text-align:right;width:".$table->width."'>";
|
||||
html_print_submit_button(__('Create OS'), '', false, 'class="sub next"');
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Os.
|
||||
*
|
||||
* @category Os
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -25,7 +40,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
|||
$action = get_parameter('action', 'new');
|
||||
$idOS = get_parameter('id_os', 0);
|
||||
$id_message = get_parameter('message', 0);
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$tab = get_parameter('tab2', 'list');
|
||||
} else {
|
||||
$tab = get_parameter('tab', 'list');
|
||||
|
@ -42,133 +57,140 @@ if ($idOS) {
|
|||
$icon = get_parameter('icon', 0);
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
}
|
||||
|
||||
$message = '';
|
||||
if ($is_management_allowed === true) {
|
||||
switch ($action) {
|
||||
case 'edit':
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
$classButton = 'class="sub upd"';
|
||||
break;
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
case 'new':
|
||||
$actionHidden = 'save';
|
||||
$textButton = __('Create');
|
||||
$classButton = 'class="sub next"';
|
||||
break;
|
||||
case 'save':
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
|
||||
case 'edit':
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
$classButton = 'class="sub upd"';
|
||||
break;
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
}
|
||||
|
||||
case 'save':
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
$resultOrId = false;
|
||||
if ($name != '') {
|
||||
$resultOrId = db_process_sql_insert('tconfig_os', $values);
|
||||
}
|
||||
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
}
|
||||
if ($resultOrId === false) {
|
||||
$message = 2;
|
||||
$tab = 'builder';
|
||||
$actionHidden = 'save';
|
||||
$textButton = __('Create');
|
||||
$classButton = 'class="sub next"';
|
||||
} else {
|
||||
$tab = 'list';
|
||||
$message = 1;
|
||||
}
|
||||
|
||||
$resultOrId = false;
|
||||
if ($name != '') {
|
||||
$resultOrId = db_process_sql_insert('tconfig_os', $values);
|
||||
}
|
||||
if (is_metaconsole() === true) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
if ($resultOrId === false) {
|
||||
$message = 2;
|
||||
$tab = 'builder';
|
||||
case 'update':
|
||||
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
|
||||
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
|
||||
$icon = get_parameter('icon', 0);
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole() === true) {
|
||||
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
|
||||
}
|
||||
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
}
|
||||
|
||||
$result = false;
|
||||
if ($name != '') {
|
||||
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
$message = 3;
|
||||
$tab = 'list';
|
||||
} else {
|
||||
$message = 4;
|
||||
$tab = 'builder';
|
||||
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
|
||||
$name = $os['name'];
|
||||
}
|
||||
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
$classButton = 'class="sub upd"';
|
||||
if (is_metaconsole() === true) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
|
||||
$count = db_get_all_rows_sql($sql);
|
||||
$count = $count[0]['count'];
|
||||
|
||||
if ($count > 0) {
|
||||
$message = 5;
|
||||
} else {
|
||||
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
|
||||
if ($result) {
|
||||
$message = 6;
|
||||
} else {
|
||||
$message = 7;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'new':
|
||||
$actionHidden = 'save';
|
||||
$textButton = __('Create');
|
||||
$classButton = 'class="sub next"';
|
||||
} else {
|
||||
$tab = 'list';
|
||||
$message = 1;
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
|
||||
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
|
||||
$icon = get_parameter('icon', 0);
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
|
||||
}
|
||||
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
}
|
||||
|
||||
$result = false;
|
||||
if ($name != '') {
|
||||
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
$message = 3;
|
||||
$tab = 'list';
|
||||
} else {
|
||||
$message = 4;
|
||||
$tab = 'builder';
|
||||
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
|
||||
$name = $os['name'];
|
||||
}
|
||||
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
$classButton = 'class="sub upd"';
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
|
||||
$count = db_get_all_rows_sql($sql);
|
||||
$count = $count[0]['count'];
|
||||
|
||||
if ($count > 0) {
|
||||
$message = 5;
|
||||
} else {
|
||||
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
|
||||
if ($result) {
|
||||
$message = 6;
|
||||
} else {
|
||||
$message = 7;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$buttons = [
|
||||
'list' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
|
||||
'images/list.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('List OS'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
],
|
||||
'builder' => [
|
||||
$buttons = [];
|
||||
$buttons['list'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
|
||||
'images/list.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('List OS'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
];
|
||||
if ($is_management_allowed === true) {
|
||||
$buttons['builder'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=builder">'.html_print_image(
|
||||
'images/builder.png',
|
||||
|
@ -178,17 +200,17 @@ $buttons = [
|
|||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
],
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
if (is_metaconsole() === false) {
|
||||
// Header.
|
||||
ui_print_page_header(__('Edit OS'), '', false, '', true, $buttons);
|
||||
}
|
||||
|
||||
if (!empty($id_message)) {
|
||||
if (empty($id_message) === false) {
|
||||
switch ($id_message) {
|
||||
case 1:
|
||||
echo ui_print_success_message(__('Success creating OS'), '', true);
|
||||
|
@ -227,12 +249,13 @@ if (!empty($id_message)) {
|
|||
switch ($tab) {
|
||||
case 'list':
|
||||
include_once $config['homedir'].'/godmode/setup/os.list.php';
|
||||
return;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 'builder':
|
||||
include_once $config['homedir'].'/godmode/setup/os.builder.php';
|
||||
return;
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Tags.
|
||||
*
|
||||
* @category Tags
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
// Check login and ACLs
|
||||
// Check login and ACLs.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
|
@ -23,36 +38,36 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
|||
return;
|
||||
}
|
||||
|
||||
// Include functions code
|
||||
// Include functions code.
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
// Get parameters
|
||||
// Get parameters.
|
||||
$delete = (int) get_parameter('delete_tag', 0);
|
||||
$tag_name = (string) get_parameter('tag_name', '');
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
|
||||
if ($delete != 0 && is_metaconsole()) {
|
||||
if ($delete !== 0 && is_metaconsole() === true) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
if ($tag_name != '' && is_metaconsole()) {
|
||||
if ($tag_name != '' && is_metaconsole() === true) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Metaconsole nodes
|
||||
// Metaconsole nodes.
|
||||
$servers = false;
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
$servers = metaconsole_get_servers();
|
||||
}
|
||||
|
||||
// Ajax tooltip to deploy module's count info of a tag.
|
||||
if (is_ajax()) {
|
||||
if (is_ajax() === true) {
|
||||
ob_clean();
|
||||
|
||||
$get_tag_tooltip = (bool) get_parameter('get_tag_tooltip', 0);
|
||||
|
||||
if ($get_tag_tooltip) {
|
||||
if ($get_tag_tooltip === true) {
|
||||
$id_tag = (int) get_parameter('id_tag');
|
||||
$tag = tags_search_tag_id($id_tag);
|
||||
if ($tag === false) {
|
||||
|
@ -60,7 +75,7 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
$local_modules_count = 0;
|
||||
if (is_metaconsole() && !empty($servers)) {
|
||||
if (is_metaconsole() === true && empty($servers) === false) {
|
||||
$local_modules_count = array_reduce(
|
||||
$servers,
|
||||
function ($counter, $server) use ($id_tag) {
|
||||
|
@ -78,7 +93,7 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
$policy_modules_count = 0;
|
||||
if (is_metaconsole() && !empty($servers)) {
|
||||
if (is_metaconsole() === true && empty($servers) === false) {
|
||||
$policy_modules_count = array_reduce(
|
||||
$servers,
|
||||
function ($counter, $server) use ($id_tag) {
|
||||
|
@ -106,8 +121,7 @@ if (is_ajax()) {
|
|||
return;
|
||||
}
|
||||
|
||||
// ~ enterprise_hook('open_meta_frame');
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
$sec = 'gmodules';
|
||||
|
@ -129,11 +143,8 @@ $buttons = [
|
|||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// Print header
|
||||
// ui_meta_print_header(__('Tags'), "", $buttons);
|
||||
} else {
|
||||
// Header
|
||||
if (is_metaconsole() === false) {
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Tags configuration'),
|
||||
'images/tag.png',
|
||||
|
@ -145,39 +156,47 @@ if (is_metaconsole()) {
|
|||
}
|
||||
|
||||
// Two actions can performed in this page: search and delete tags
|
||||
// Delete action: This will delete a tag
|
||||
if ($delete != 0) {
|
||||
// Delete action: This will delete a tag.
|
||||
if ($delete !== 0) {
|
||||
$return_delete = tags_delete_tag($delete);
|
||||
|
||||
if ($return_delete === false) {
|
||||
db_pandora_audit('Tag management', "Fail try to delete tag #$delete");
|
||||
db_pandora_audit('Tag management', 'Fail try to delete tag #'.$delete);
|
||||
ui_print_error_message(__('Error deleting tag'));
|
||||
} else {
|
||||
db_pandora_audit('Tag management', "Delete tag #$delete");
|
||||
db_pandora_audit('Tag management', 'Delete tag #'.$delete);
|
||||
ui_print_success_message(__('Successfully deleted tag'));
|
||||
}
|
||||
}
|
||||
|
||||
// Search action: This will filter the display tag view
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All tags information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
// Search action: This will filter the display tag view.
|
||||
$filter = [];
|
||||
// Filtered view?
|
||||
if (!empty($tag_name)) {
|
||||
if (empty($tag_name) === false) {
|
||||
$filter['name'] = $tag_name;
|
||||
}
|
||||
|
||||
// If the user has filtered the view
|
||||
// If the user has filtered the view.
|
||||
$filter_performed = !empty($filter);
|
||||
|
||||
$filter['offset'] = (int) get_parameter('offset');
|
||||
$filter['limit'] = (int) $config['block_size'];
|
||||
|
||||
// statements for pagination
|
||||
// Statements for pagination.
|
||||
$url = ui_get_url_refresh();
|
||||
$total_tags = tags_get_tag_count($filter);
|
||||
|
||||
$result = tags_search_tag(false, $filter);
|
||||
|
||||
// Filter form
|
||||
// Filter form.
|
||||
$table = new StdClass();
|
||||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
|
@ -198,18 +217,18 @@ $table->data[] = $row;
|
|||
$filter_form = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/tag/tag&tag_name="'.$tag_name.'>';
|
||||
$filter_form .= html_print_table($table, true);
|
||||
$filter_form .= '</form>';
|
||||
// End of filter form
|
||||
if (!empty($result)) {
|
||||
if (!is_metaconsole()) {
|
||||
// End of filter form.
|
||||
if (empty($result) === false) {
|
||||
if (is_metaconsole() === false) {
|
||||
echo $filter_form;
|
||||
} else {
|
||||
ui_toggle($filter_form, __('Show Options'));
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
ui_pagination($total_tags, $url);
|
||||
|
||||
// Display tags previously filtered or not
|
||||
// Display tags previously filtered or not.
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
|
@ -240,7 +259,9 @@ if (!empty($result)) {
|
|||
$table->head[3] = __('Number of modules affected');
|
||||
$table->head[4] = __('Email');
|
||||
$table->head[5] = __('Phone');
|
||||
$table->head[6] = __('Actions');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = __('Actions');
|
||||
}
|
||||
|
||||
foreach ($result as $tag) {
|
||||
if ($rowPair) {
|
||||
|
@ -254,11 +275,18 @@ if (!empty($result)) {
|
|||
|
||||
$data = [];
|
||||
|
||||
$data[0] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>".$tag['name'].'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$data[0] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>";
|
||||
$data[0] .= $tag['name'];
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = $tag['name'];
|
||||
}
|
||||
|
||||
$data[1] = ui_print_truncate_text($tag['description'], 'description', false);
|
||||
$data[2] = '<a href="'.$tag['url'].'">'.$tag['url'].'</a>';
|
||||
|
||||
// The tooltip needs a title on the item, don't delete the title
|
||||
// The tooltip needs a title on the item, don't delete the title.
|
||||
$data[3] = '<a class="tag_details img_help" title="'.__('Tag details').'"
|
||||
href="'.ui_get_full_url(false, false, false, false).'/ajax.php?page=godmode/tag/tag&get_tag_tooltip=1&id_tag='.$tag['id_tag'].'">'.html_print_image(
|
||||
'images/zoom.png',
|
||||
|
@ -267,7 +295,7 @@ if (!empty($result)) {
|
|||
).'</a> ';
|
||||
|
||||
$modules_count = 0;
|
||||
if (is_metaconsole() && !empty($servers)) {
|
||||
if (is_metaconsole() === true && empty($servers) === false) {
|
||||
$tag_id = $tag['id_tag'];
|
||||
$modules_count = array_reduce(
|
||||
$servers,
|
||||
|
@ -292,11 +320,20 @@ if (!empty($result)) {
|
|||
if ($email_large == $email_small) {
|
||||
$output = $email_large;
|
||||
} else {
|
||||
$output = "<div title='".sprintf(__('Emails for the tag: %s'), $tag['name'])."' class='email_large invisible' id='email_large_".$tag['id_tag']."'>".$email_large.'</div>'.'<span id="value_'.$tag['id_tag'].'">'.$email_small.'</span> '."<a href='javascript: show_dialog(".$tag['id_tag'].")'>".html_print_image(
|
||||
$title_mail = sprintf(__('Emails for the tag: %s'), $tag['name']);
|
||||
$output = "<div title='".$title_mail."' class='email_large invisible' id='email_large_".$tag['id_tag']."'>";
|
||||
$output .= $email_large;
|
||||
$output .= '</div>';
|
||||
$output .= '<span id="value_'.$tag['id_tag'].'">';
|
||||
$output .= $email_small;
|
||||
$output .= '</span> ';
|
||||
$output .= "<a href='javascript: show_dialog(".$tag['id_tag'].")'>";
|
||||
$output .= html_print_image(
|
||||
'images/rosette.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
).''.'</a></span>';
|
||||
);
|
||||
$output .= '</a></span>';
|
||||
}
|
||||
|
||||
$data[4] = $output;
|
||||
|
@ -306,39 +343,51 @@ if (!empty($result)) {
|
|||
if ($phone_large == $phone_small) {
|
||||
$output = $phone_large;
|
||||
} else {
|
||||
$output = "<div title='".sprintf(__('Phones for the tag: %s'), $tag['name'])."' class='phone_large invisible' id='phone_large_".$tag['id_tag']."'>".$phone_large.'</div>'.'<span id="value_'.$tag['id_tag'].'">'.$phone_small.'</span> '."<a href='javascript: show_phone_dialog(".$tag['id_tag'].")'>".html_print_image(
|
||||
$t_phone = sprintf(__('Phones for the tag: %s'), $tag['name']);
|
||||
$output = "<div title='".$t_phone."' class='phone_large invisible' id='phone_large_".$tag['id_tag']."'>";
|
||||
$output .= $phone_large;
|
||||
$output .= '</div>';
|
||||
$output .= '<span id="value_'.$tag['id_tag'].'">'.$phone_small.'</span> ';
|
||||
$output .= "<a href='javascript: show_phone_dialog(".$tag['id_tag'].")'>";
|
||||
$output .= html_print_image(
|
||||
'images/rosette.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
).''.'</a></span>';
|
||||
);
|
||||
$output .= '</a></span>';
|
||||
}
|
||||
|
||||
$data[5] = $output;
|
||||
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>".html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => 'Edit',
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => 'Delete',
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>";
|
||||
$data[6] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => 'Edit',
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</a>';
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => 'Delete',
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($total_tags, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
} else {
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
ui_toggle($filter_form, __('Show Options'));
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No tags defined')]);
|
||||
} else if ($filter_performed) {
|
||||
|
@ -349,26 +398,26 @@ if (!empty($result)) {
|
|||
}
|
||||
}
|
||||
|
||||
echo '<table border=0 cellpadding=0 cellspacing=0 width=100%>';
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<table border=0 cellpadding=0 cellspacing=0 width=100%>';
|
||||
echo '<tr>';
|
||||
echo '<td align=right>';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/tag/edit_tag&action=new">';
|
||||
html_print_input_hidden('create_tag', '1', true);
|
||||
html_print_submit_button(__('Create tag'), 'create_button', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '<td align=right>';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/tag/edit_tag&action=new">';
|
||||
html_print_input_hidden('create_tag', '1', true);
|
||||
html_print_submit_button(__('Create tag'), 'create_button', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
if ($delete != 0 && is_metaconsole()) {
|
||||
if ($delete != 0 && is_metaconsole() === true) {
|
||||
close_meta_frame();
|
||||
}
|
||||
|
||||
// ~ enterprise_hook('close_meta_frame');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("a.tag_details")
|
||||
.tooltip({
|
||||
track: true,
|
||||
|
@ -376,7 +425,6 @@ if ($delete != 0 && is_metaconsole()) {
|
|||
open: function (evt, ui) {
|
||||
var elem = $(this);
|
||||
var uri = elem.prop('href');
|
||||
|
||||
if (typeof uri !== 'undefined' && uri.length > 0) {
|
||||
var jqXHR = $.ajax(uri).done(function(data) {
|
||||
elem.tooltip('option', 'content', data);
|
||||
|
@ -384,14 +432,12 @@ if ($delete != 0 && is_metaconsole()) {
|
|||
// Store the connection handler
|
||||
elem.data('jqXHR', jqXHR);
|
||||
}
|
||||
|
||||
$(".ui-tooltip>.ui-tooltip-content:not(.cluetip-default)")
|
||||
.addClass("cluetip-default");
|
||||
},
|
||||
close: function (evt, ui) {
|
||||
var elem = $(this);
|
||||
var jqXHR = elem.data('jqXHR');
|
||||
|
||||
// Close the connection handler
|
||||
if (typeof jqXHR !== 'undefined')
|
||||
jqXHR.abort();
|
||||
|
@ -401,19 +447,16 @@ if ($delete != 0 && is_metaconsole()) {
|
|||
event.preventDefault();
|
||||
})
|
||||
.css('cursor', 'help');
|
||||
|
||||
$(".email_large, .phone_large").dialog({
|
||||
autoOpen: false,
|
||||
resizable: true,
|
||||
width: 400,
|
||||
height: 200
|
||||
});
|
||||
|
||||
function show_dialog(id) {
|
||||
$("#email_large_" + id).dialog("open");
|
||||
}
|
||||
function show_phone_dialog(id) {
|
||||
$("#phone_large_" + id).dialog("open");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -100,8 +100,16 @@ $create_profile = (bool) get_parameter('create_profile');
|
|||
$update_profile = (bool) get_parameter('update_profile');
|
||||
$id_profile = (int) get_parameter('id');
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All profiles information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
// Profile deletion.
|
||||
if ($delete_profile === true) {
|
||||
if ($is_management_allowed === true && $delete_profile === true) {
|
||||
// Delete profile.
|
||||
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
||||
$ret = profile_delete_profile_and_clean_users($id_profile);
|
||||
|
@ -119,7 +127,7 @@ if ($delete_profile === true) {
|
|||
}
|
||||
|
||||
// Store the variables when create or update.
|
||||
if ($create_profile === true || $update_profile === true) {
|
||||
if ($is_management_allowed === true && ($create_profile === true || $update_profile === true)) {
|
||||
$name = get_parameter('name');
|
||||
|
||||
// Agents.
|
||||
|
@ -186,7 +194,7 @@ if ($create_profile === true || $update_profile === true) {
|
|||
}
|
||||
|
||||
// Update profile.
|
||||
if ($update_profile === true) {
|
||||
if ($is_management_allowed === true && $update_profile === true) {
|
||||
if (empty($name) === false) {
|
||||
$ret = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);
|
||||
if ($ret !== false) {
|
||||
|
@ -232,7 +240,7 @@ if ($update_profile === true) {
|
|||
}
|
||||
|
||||
// Create profile.
|
||||
if ($create_profile === true) {
|
||||
if ($is_management_allowed === true && $create_profile === true) {
|
||||
if (empty($name) === false) {
|
||||
$ret = db_process_sql_insert('tperfil', $values);
|
||||
|
||||
|
@ -277,14 +285,6 @@ if ($create_profile === true) {
|
|||
$id_profile = 0;
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All users information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
|
@ -364,7 +364,14 @@ $img = html_print_image(
|
|||
);
|
||||
|
||||
foreach ($profiles as $profile) {
|
||||
$data['profiles'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.$profile['name'].'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$data['profiles'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">';
|
||||
$data['profiles'] .= $profile['name'];
|
||||
$data['profiles'] .= '</a>';
|
||||
} else {
|
||||
$data['profiles'] = $profile['name'];
|
||||
}
|
||||
|
||||
$data['AR'] = (empty($profile['agent_view']) === false) ? $img : '';
|
||||
$data['AW'] = (empty($profile['agent_edit']) === false) ? $img : '';
|
||||
$data['AD'] = (empty($profile['agent_disable']) === false) ? $img : '';
|
||||
|
@ -386,29 +393,23 @@ foreach ($profiles as $profile) {
|
|||
$data['VM'] = (empty($profile['vconsole_management']) === false) ? $img : '';
|
||||
$data['PM'] = (empty($profile['pandora_management']) === false) ? $img : '';
|
||||
$table->cellclass[]['operations'] = 'action_buttons';
|
||||
$data['operations'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
if ($is_management_allowed === true) {
|
||||
$data['operations'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['operations'] .= '</a>';
|
||||
).'</a>';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
* User edit.
|
||||
*
|
||||
* @category Extensions
|
||||
* @category Users
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
|
@ -145,7 +144,7 @@ if (isset($_GET['modified']) && !$view_mode) {
|
|||
$upd_info['data_section'] = $visual_console;
|
||||
}
|
||||
|
||||
if (!empty($password_new)) {
|
||||
if (empty($password_new) === false) {
|
||||
$correct_password = false;
|
||||
|
||||
$user_credentials_check = process_user_login($config['id_user'], $current_password, true);
|
||||
|
@ -252,10 +251,18 @@ if ($status != -1) {
|
|||
);
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
echo '<div class="user_form_title">'.__('Edit my User').'</div>';
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All users information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').': </p>';
|
||||
$user_id .= '<span>'.$id.'</span></div>';
|
||||
|
@ -686,7 +693,7 @@ if (!is_metaconsole()) {
|
|||
</div>';
|
||||
|
||||
if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) {
|
||||
// eHorus user remote login
|
||||
// EHorus user remote login.
|
||||
$table_remote = new StdClass();
|
||||
$table_remote->data = [];
|
||||
$table_remote->width = '100%';
|
||||
|
@ -695,13 +702,12 @@ if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) {
|
|||
$table_remote->size['name'] = '30%';
|
||||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
|
||||
// Title
|
||||
// Title.
|
||||
$row = [];
|
||||
$row['control'] = '<p class="edit_user_labels">'.__('eHorus user configuration').': </p>';
|
||||
$table_remote->data['ehorus_user_level_conf'] = $row;
|
||||
|
||||
// Enable/disable eHorus for this user
|
||||
// Enable/disable eHorus for this user.
|
||||
$row = [];
|
||||
$row['name'] = __('eHorus user acces enabled');
|
||||
$row['control'] = html_print_checkbox_switch('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
|
||||
|
@ -748,7 +754,7 @@ if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
|
|||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Integria IMS user level authentication.
|
||||
// Title
|
||||
// Title.
|
||||
$row = [];
|
||||
$row['control'] = '<p class="edit_user_labels">'.__('Integria user configuration').': </p>';
|
||||
$table_remote->data['integria_user_level_conf'] = $row;
|
||||
|
@ -784,26 +790,29 @@ if ($config['integria_enabled'] && $config['integria_user_level_conf']) {
|
|||
}
|
||||
|
||||
|
||||
echo '<div class="edit_user_button">';
|
||||
if (!$config['user_can_update_info']) {
|
||||
echo '<i>'.__('You can not change your user info under the current authentication scheme').'</i>';
|
||||
} else {
|
||||
html_print_csrf_hidden();
|
||||
html_print_submit_button(__('Update'), 'uptbutton', $view_mode, 'class="sub upd"');
|
||||
}
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<div class="edit_user_button">';
|
||||
if (!$config['user_can_update_info']) {
|
||||
echo '<i>'.__('You can not change your user info under the current authentication scheme').'</i>';
|
||||
} else {
|
||||
html_print_csrf_hidden();
|
||||
html_print_submit_button(__('Update'), 'uptbutton', $view_mode, 'class="sub upd"');
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo '<div id="edit_user_profiles" class="white_box">';
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
echo '<p class="edit_user_labels">'.__('Profiles/Groups assigned to this user').'</p>';
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->title = __('Profiles/Groups assigned to this user');
|
||||
|
@ -818,7 +827,7 @@ $table->head = [];
|
|||
$table->align = [];
|
||||
$table->style = [];
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
}
|
||||
|
@ -869,7 +878,7 @@ echo '</div>';
|
|||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
?>
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue