resolved conflict
This commit is contained in:
commit
7c5b2c8f2c
|
@ -68,7 +68,7 @@ check_root_permissions () {
|
|||
|
||||
install_autodiscover () {
|
||||
local arch=$1
|
||||
wget https://pandorafms.com/library/wp-content/uploads/2020/04/autodiscover-linux.zip
|
||||
wget http://firefly.artica.es/projects/autodiscover-linux.zip
|
||||
unzip autodiscover-linux.zip
|
||||
chmod +x $arch/autodiscover
|
||||
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, FreeBSD Version
|
||||
# Version 7.0NG.756, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, HP-UX Version
|
||||
# Version 7.0NG.756, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, Solaris Version
|
||||
# Version 7.0NG.756, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, HPUX Version
|
||||
# Version 7.0NG.756, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.755, Solaris version
|
||||
# Version 7.0NG.756, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, AIX version
|
||||
# Version 7.0NG.756, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.755-210712
|
||||
Version: 7.0NG.756-210809
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.755-210712"
|
||||
pandora_version="7.0NG.756-210809"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -31,7 +31,7 @@ fi
|
|||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.755"
|
||||
VERSION="7.0NG.756"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.755" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.756" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.755" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.756" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.755</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.755 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.755</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.756</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.756 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.756</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, FreeBSD Version
|
||||
# Version 7.0NG.756, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, HP-UX Version
|
||||
# Version 7.0NG.756, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, GNU/Linux
|
||||
# Version 7.0NG.756, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, NetBSD Version
|
||||
# Version 7.0NG.756, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.755, Solaris Version
|
||||
# Version 7.0NG.756, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.755';
|
||||
use constant AGENT_BUILD => '210712';
|
||||
use constant AGENT_VERSION => '7.0NG.756';
|
||||
use constant AGENT_BUILD => '210809';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.755
|
||||
%define release 210712
|
||||
%define version 7.0NG.756
|
||||
%define release 210809
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.755
|
||||
%define release 210712
|
||||
%define version 7.0NG.756
|
||||
%define release 210809
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.755"
|
||||
PI_BUILD="210712"
|
||||
PI_VERSION="7.0NG.756"
|
||||
PI_BUILD="210809"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.755
|
||||
# Version 7.0NG.756
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.755}
|
||||
{Pandora FMS Windows Agent v7.0NG.756}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{210712}
|
||||
{210809}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.755 Build 210712")
|
||||
#define PANDORA_VERSION ("7.0NG.756 Build 210809")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.755(Build 210712))"
|
||||
VALUE "ProductVersion", "(7.0NG.756(Build 210809))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.755-210712
|
||||
Version: 7.0NG.756-210809
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.755-210712"
|
||||
pandora_version="7.0NG.756-210809"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
global $config;
|
||||
|
||||
check_login();
|
||||
// ACL Check
|
||||
// ACL Check.
|
||||
if (!check_acl($config['id_user'], 0, 'AR')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -56,12 +56,12 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main function of module groups and the enter point to
|
||||
* execute the code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* The main function of module groups and the enter point to
|
||||
* execute the code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function mainModuleGroups()
|
||||
{
|
||||
global $config;
|
||||
|
@ -94,7 +94,7 @@ function mainModuleGroups()
|
|||
$user_groups = users_get_groups($config['user'], 'AR');
|
||||
$info = array_filter(
|
||||
$info,
|
||||
function ($v, $k) use ($user_groups) {
|
||||
function ($v) use ($user_groups) {
|
||||
return $user_groups[$v['id']] != null;
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
|
@ -102,7 +102,7 @@ function mainModuleGroups()
|
|||
|
||||
$info = array_filter(
|
||||
$info,
|
||||
function ($v, $k) use ($agent_group_search) {
|
||||
function ($v) use ($agent_group_search) {
|
||||
return preg_match(
|
||||
'/'.$agent_group_search.'/i',
|
||||
$v['name']
|
||||
|
@ -111,7 +111,7 @@ function mainModuleGroups()
|
|||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
|
||||
if (!empty($info)) {
|
||||
if (empty($info) === false) {
|
||||
$groups_view = ($is_not_paginated) ? $info : array_slice(
|
||||
$info,
|
||||
$offset,
|
||||
|
@ -156,7 +156,7 @@ function mainModuleGroups()
|
|||
|
||||
$array_module_group = array_filter(
|
||||
$array_module_group,
|
||||
function ($v, $k) use ($module_group_search) {
|
||||
function ($v) use ($module_group_search) {
|
||||
return preg_match('/'.$module_group_search.'/i', $v);
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
|
@ -332,13 +332,16 @@ function mainModuleGroups()
|
|||
// Orange when the cell for this model group and agent has at least one alert fired.
|
||||
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
||||
$color = COL_CRITICAL;
|
||||
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
// Red when the cell for this model group and agent
|
||||
// has at least one module in critical state and the rest in any state.
|
||||
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||
$color = COL_WARNING;
|
||||
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
// Yellow when the cell for this model group and agent
|
||||
// has at least one in warning state and the rest in green state.
|
||||
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||
$color = COL_UNKNOWN;
|
||||
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
// Grey when the cell for this model group and agent
|
||||
// has at least one module in unknown state and the rest in any state.
|
||||
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||
$color = COL_NORMAL;
|
||||
// Green when the cell for this model group and agent has OK state all modules.
|
||||
|
@ -348,7 +351,7 @@ function mainModuleGroups()
|
|||
}
|
||||
|
||||
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
|
||||
$data[$i][$j] .= "<a class='info_cell white font_18px' rel='$rel' href='$url'>";
|
||||
$data[$i][$j] .= '<a class="info_cell white font_18px" rel="'.$rel.'" href="'.$url.'">';
|
||||
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
||||
$data[$i][$j] .= '</a></div>';
|
||||
} else {
|
||||
|
|
|
@ -1,418 +0,0 @@
|
|||
<?php
|
||||
|
||||
// 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; 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.
|
||||
function pluginreg_extension_main()
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
ui_require_css_file('first_task');
|
||||
ui_print_page_header(__('Plugin registration'), 'images/extensions.png', false, '', true, '');
|
||||
|
||||
echo '<div class="new_task">
|
||||
<div class="image_task">';
|
||||
echo html_print_image('images/first_task/icono_grande_import.png', true, ['title' => __('Plugin Registration') ]);
|
||||
echo '</div>';
|
||||
echo '<div class="text_task">';
|
||||
echo '<h3>'.__('Plugin registration').'</h3>';
|
||||
echo '<p id="description_task">'.__(
|
||||
"This extension makes registering server plugins an easier task.
|
||||
Here you can upload a server plugin in .pspz zipped format.
|
||||
Please refer to the official documentation on how to obtain and use Server Plugins.
|
||||
<br><br>You can get more plugins in our <a href='http://pandorafms.com/Library/Library/'>Public Resource Library</a> "
|
||||
).'</p>';
|
||||
// Upload form
|
||||
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
||||
echo '<table class="" id="table1" width="100%" border="0" cellpadding="4" cellspacing="4">';
|
||||
echo "<tr><td class='datos'><input type='file' name='plugin_upload' />";
|
||||
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
|
||||
echo '</form></table>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
$zip = null;
|
||||
$upload = false;
|
||||
if (isset($_FILES['plugin_upload'])) {
|
||||
$config['plugin_store'] = $config['attachment_store'].'/plugin';
|
||||
|
||||
$name_file = $_FILES['plugin_upload']['name'];
|
||||
|
||||
$zip = zip_open($_FILES['plugin_upload']['tmp_name']);
|
||||
$upload = true;
|
||||
}
|
||||
|
||||
if ($zip) {
|
||||
while ($zip_entry = zip_read($zip)) {
|
||||
if (zip_entry_open($zip, $zip_entry, 'r')) {
|
||||
if (zip_entry_name($zip_entry) == 'plugin_definition.ini') {
|
||||
$basepath = $config['attachment_store'];
|
||||
} else {
|
||||
$basepath = $config['plugin_store'];
|
||||
}
|
||||
|
||||
$filename = $basepath.'/'.zip_entry_name($zip_entry);
|
||||
$fp = fopen($filename, 'w');
|
||||
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
||||
fwrite($fp, $buf);
|
||||
fclose($fp);
|
||||
chmod($filename, 0755);
|
||||
zip_entry_close($zip_entry);
|
||||
}
|
||||
}
|
||||
|
||||
zip_close($zip);
|
||||
}
|
||||
|
||||
if ($upload) {
|
||||
// Parse with sections
|
||||
if (! $ini_array = parse_ini_file($config['attachment_store'].'/plugin_definition.ini', true)) {
|
||||
echo '<h2 class=error>'.__('Cannot load INI file').'</h2>';
|
||||
} else {
|
||||
$version = preg_replace('/.*[.]/', '', $name_file);
|
||||
|
||||
$exec_path = $config['plugin_store'].'/'.$ini_array['plugin_definition']['filename'];
|
||||
|
||||
$file_exec_path = $exec_path;
|
||||
|
||||
if (isset($ini_array['plugin_definition']['execution_command'])
|
||||
&& ($ini_array['plugin_definition']['execution_command'] != '')
|
||||
) {
|
||||
$exec_path = $ini_array['plugin_definition']['execution_command'].' '.$config['plugin_store'].'/'.$ini_array['plugin_definition']['filename'];
|
||||
}
|
||||
|
||||
if (isset($ini_array['plugin_definition']['execution_postcommand'])
|
||||
&& ($ini_array['plugin_definition']['execution_postcommand'] != '')
|
||||
) {
|
||||
$exec_path = $exec_path.' '.$ini_array['plugin_definition']['execution_postcommand'];
|
||||
}
|
||||
|
||||
if (!file_exists($file_exec_path)) {
|
||||
echo '<h2 class=error>'.__('Plugin exec not found. Aborting!').'</h2>';
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
} else {
|
||||
// Verify if a plugin with the same name is already registered
|
||||
$sql0 = "SELECT COUNT(*)
|
||||
FROM tplugin
|
||||
WHERE name = '".io_safe_input($ini_array['plugin_definition']['name'])."'";
|
||||
$result = db_get_sql($sql0);
|
||||
|
||||
if ($result > 0) {
|
||||
echo '<h2 class=error>'.__('Plugin already registered. Aborting!').'</h2>';
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
} else {
|
||||
$values = [
|
||||
'name' => io_safe_input($ini_array['plugin_definition']['name']),
|
||||
'description' => io_safe_input($ini_array['plugin_definition']['description']),
|
||||
'max_timeout' => $ini_array['plugin_definition']['timeout'],
|
||||
'execute' => io_safe_input($exec_path),
|
||||
'net_dst_opt' => $ini_array['plugin_definition']['ip_opt'],
|
||||
'net_port_opt' => $ini_array['plugin_definition']['port_opt'],
|
||||
'user_opt' => $ini_array['plugin_definition']['user_opt'],
|
||||
'pass_opt' => $ini_array['plugin_definition']['pass_opt'],
|
||||
'parameters' => $ini_array['plugin_definition']['parameters'],
|
||||
'plugin_type' => $ini_array['plugin_definition']['plugin_type'],
|
||||
];
|
||||
|
||||
switch ($version) {
|
||||
case 'pspz':
|
||||
// Fixed the static parameters
|
||||
// for
|
||||
// the dinamic parameters of pandoras 5
|
||||
$total_macros = 0;
|
||||
$macros = [];
|
||||
|
||||
if (!isset($values['parameters'])) {
|
||||
$values['parameters'] = '';
|
||||
}
|
||||
|
||||
if ($values['net_dst_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Target IP from net';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['net_dst_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if ($values['ip_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Target IP';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['ip_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if ($values['net_port_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Port from net';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['net_port_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if ($values['port_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Port';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['port_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if ($values['user_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Username';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['user_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if ($values['pass_opt'] != '') {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Password';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['pass_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
// A last parameter is defined always to
|
||||
// add the old "Plug-in parameters" in the
|
||||
// side of the module
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Plug-in Parameters';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= ' _field'.$total_macros.'_';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
|
||||
break;
|
||||
|
||||
case 'pspz2':
|
||||
// Fill the macros field.
|
||||
$total_macros = $ini_array['plugin_definition']['total_macros_provided'];
|
||||
|
||||
$macros = [];
|
||||
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
|
||||
$label = 'macro_'.$it_macros;
|
||||
|
||||
$macro = [];
|
||||
|
||||
$macro['macro'] = '_field'.$it_macros.'_';
|
||||
$macro['hide'] = $ini_array[$label]['hide'];
|
||||
$macro['desc'] = io_safe_input(
|
||||
$ini_array[$label]['description']
|
||||
);
|
||||
$macro['help'] = io_safe_input(
|
||||
$ini_array[$label]['help']
|
||||
);
|
||||
$macro['value'] = io_safe_input(
|
||||
$ini_array[$label]['value']
|
||||
);
|
||||
|
||||
$macros[(string) $it_macros] = $macro;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($macros)) {
|
||||
$values['macros'] = json_encode($macros);
|
||||
}
|
||||
|
||||
$create_id = db_process_sql_insert('tplugin', $values);
|
||||
|
||||
if (empty($create_id)) {
|
||||
ui_print_error_message(
|
||||
__('Plug-in Remote Registered unsuccessfull')
|
||||
);
|
||||
ui_print_info_message(
|
||||
__('Please check the syntax of file "plugin_definition.ini"')
|
||||
);
|
||||
} else {
|
||||
for ($ax = 1; $ax <= $ini_array['plugin_definition']['total_modules_provided']; $ax++) {
|
||||
$label = 'module'.$ax;
|
||||
|
||||
$plugin_user = '';
|
||||
if (isset($ini_array[$label]['plugin_user'])) {
|
||||
$plugin_user = $ini_array[$label]['plugin_user'];
|
||||
}
|
||||
|
||||
$plugin_pass = '';
|
||||
if (isset($ini_array[$label]['plugin_pass'])) {
|
||||
$plugin_pass = $ini_array[$label]['plugin_pass'];
|
||||
}
|
||||
|
||||
$plugin_parameter = '';
|
||||
if (isset($ini_array[$label]['plugin_parameter'])) {
|
||||
$plugin_parameter = $ini_array[$label]['plugin_parameter'];
|
||||
}
|
||||
|
||||
$unit = '';
|
||||
if (isset($ini_array[$label]['unit'])) {
|
||||
$unit = $ini_array[$label]['unit'];
|
||||
}
|
||||
|
||||
$values = [
|
||||
'name' => io_safe_input($ini_array[$label]['name']),
|
||||
'description' => io_safe_input($ini_array[$label]['description']),
|
||||
'id_group' => $ini_array[$label]['id_group'],
|
||||
'type' => $ini_array[$label]['type'],
|
||||
'max' => isset($ini_array[$label]['max']) ? $ini_array[$label]['max'] : '',
|
||||
'min' => isset($ini_array[$label]['min']) ? $ini_array[$label]['min'] : '',
|
||||
'module_interval' => isset($ini_array[$label]['module_interval']) ? $ini_array[$label]['module_interval'] : '',
|
||||
'id_module_group' => $ini_array[$label]['id_module_group'],
|
||||
'id_modulo' => $ini_array[$label]['id_modulo'],
|
||||
'plugin_user' => io_safe_input($plugin_user),
|
||||
'plugin_pass' => io_safe_input($plugin_pass),
|
||||
'plugin_parameter' => io_safe_input($plugin_parameter),
|
||||
'unit' => io_safe_input($unit),
|
||||
'max_timeout' => isset($ini_array[$label]['max_timeout']) ? $ini_array[$label]['max_timeout'] : '',
|
||||
'history_data' => isset($ini_array[$label]['history_data']) ? $ini_array[$label]['history_data'] : '',
|
||||
'dynamic_interval' => isset($ini_array[$label]['dynamic_interval']) ? $ini_array[$label]['dynamic_interval'] : '',
|
||||
'dynamic_min' => isset($ini_array[$label]['dynamic_min']) ? $ini_array[$label]['dynamic_min'] : '',
|
||||
'dynamic_max' => isset($ini_array[$label]['dynamic_max']) ? $ini_array[$label]['dynamic_max'] : '',
|
||||
'dynamic_two_tailed' => isset($ini_array[$label]['dynamic_two_tailed']) ? $ini_array[$label]['dynamic_two_tailed'] : '',
|
||||
'min_warning' => isset($ini_array[$label]['min_warning']) ? $ini_array[$label]['min_warning'] : '',
|
||||
'max_warning' => isset($ini_array[$label]['max_warning']) ? $ini_array[$label]['max_warning'] : '',
|
||||
'str_warning' => isset($ini_array[$label]['str_warning']) ? $ini_array[$label]['str_warning'] : '',
|
||||
'min_critical' => isset($ini_array[$label]['min_critical']) ? $ini_array[$label]['min_critical'] : '',
|
||||
'max_critical' => isset($ini_array[$label]['max_critical']) ? $ini_array[$label]['max_critical'] : '',
|
||||
'str_critical' => isset($ini_array[$label]['str_critical']) ? $ini_array[$label]['str_critical'] : '',
|
||||
'min_ff_event' => isset($ini_array[$label]['min_ff_event']) ? $ini_array[$label]['min_ff_event'] : '',
|
||||
'tcp_port' => isset($ini_array[$label]['tcp_port']) ? $ini_array[$label]['tcp_port'] : '',
|
||||
'id_plugin' => $create_id,
|
||||
];
|
||||
|
||||
$macros_component = $macros;
|
||||
|
||||
switch ($version) {
|
||||
case 'pspz':
|
||||
// Fixed the static parameters
|
||||
// for
|
||||
// the dinamic parameters of pandoras 5
|
||||
foreach ($macros_component as $key => $macro) {
|
||||
if ($macro['desc'] == 'Target IP from net') {
|
||||
if (!empty($values['ip_target'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['ip_target']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($macro['desc'] == 'Target IP') {
|
||||
if (!empty($values['ip_target'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['ip_target']);
|
||||
}
|
||||
} else if ($macro['desc'] == 'Port from net') {
|
||||
if (!empty($values['tcp_port'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['tcp_port']);
|
||||
}
|
||||
} else if ($macro['desc'] == 'Port') {
|
||||
if (!empty($values['tcp_port'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['tcp_port']);
|
||||
}
|
||||
} else if ($macro['desc'] == 'Username') {
|
||||
if (!empty($values['plugin_user'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['plugin_user']);
|
||||
}
|
||||
} else if ($macro['desc'] == 'Password') {
|
||||
if (!empty($values['plugin_pass'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['plugin_pass']);
|
||||
}
|
||||
} else if ($macro['desc'] == 'Plug-in Parameters') {
|
||||
if (!empty($values['plugin_parameter'])) {
|
||||
$macros_component[$key]['value'] = io_safe_input($values['plugin_parameter']);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'pspz2':
|
||||
if ($total_macros > 0) {
|
||||
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
|
||||
$macro = 'macro_'.$it_macros.'_value';
|
||||
|
||||
// Set the value or use the default
|
||||
if (isset($ini_array[$label][$macro])) {
|
||||
$macros_component[(string) $it_macros]['value'] = io_safe_input($ini_array[$label][$macro]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($macros_component)) {
|
||||
$values['macros'] = json_encode($macros_component);
|
||||
}
|
||||
|
||||
db_process_sql_insert('tnetwork_component', $values);
|
||||
|
||||
echo '<h3 class=suc>'.__('Module plugin registered').' : '.$ini_array[$label]['name'].'</h3>';
|
||||
}
|
||||
|
||||
echo '<h2 class=suc>'.__('Plugin').' '.$ini_array['plugin_definition']['name'].' '.__('Registered successfully').'</h2>';
|
||||
}
|
||||
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extensions_add_godmode_menu_option(__('Register plugin'), 'PM', 'gservers', null, 'v1r1');
|
||||
extensions_add_godmode_function('pluginreg_extension_main');
|
|
@ -1047,8 +1047,8 @@ function process_upload_xml($xml)
|
|||
|
||||
// Extract policies.
|
||||
if ($hook_enterprise === true) {
|
||||
$centralized_management = !is_central_policies_on_node();
|
||||
if ($centralized_management) {
|
||||
$centralized_management = is_management_allowed();
|
||||
if ($centralized_management === true) {
|
||||
process_upload_xml_policy($xml, $group_filter);
|
||||
}
|
||||
}
|
||||
|
@ -1080,9 +1080,17 @@ function resource_registration_extension_main()
|
|||
return;
|
||||
}
|
||||
|
||||
$centralized_management = !is_central_policies_on_node();
|
||||
if (!$centralized_management) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. Go to metaconsole to create a policy.'));
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. Go to %s to create a policy.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/policymanager'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div class=notify>';
|
||||
|
@ -1091,7 +1099,7 @@ function resource_registration_extension_main()
|
|||
|
||||
echo '<br /><br />';
|
||||
|
||||
// Upload form
|
||||
// Upload form.
|
||||
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
||||
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
|
||||
echo '<tr>';
|
||||
|
@ -1105,7 +1113,7 @@ function resource_registration_extension_main()
|
|||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
if (!isset($_FILES['resource_upload']['tmp_name'])) {
|
||||
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,19 @@ function users_extension_main_god($god=true)
|
|||
$image = 'images/user.png';
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
||||
|
||||
// Get groups user has permission
|
||||
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
|
||||
if ($check_profile === false && !users_is_admin()) {
|
||||
return ui_print_error_message(
|
||||
__('This user does not have any associated profile'),
|
||||
'',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Get groups user has permission.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// Is admin or has group permissions all.
|
||||
$groups = implode(',', array_keys($group_um, 1));
|
||||
|
@ -44,51 +53,85 @@ function users_extension_main_god($god=true)
|
|||
// Get user conected last 5 minutes.Show only those on which the user has permission.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($rows)) {
|
||||
$rows = [];
|
||||
echo "<div class='nf'>".__('No other users connected').'</div>';
|
||||
} else {
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
|
@ -105,7 +148,7 @@ function users_extension_main_god($god=true)
|
|||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
// Get data
|
||||
// Get data.
|
||||
foreach ($rows as $row) {
|
||||
// Get data of user's last login.
|
||||
switch ($config['dbtype']) {
|
||||
|
@ -135,6 +178,10 @@ function users_extension_main_god($god=true)
|
|||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rowPair) {
|
||||
|
|
|
@ -82,6 +82,14 @@ include/lib/WSManager.php
|
|||
include/lib/WebSocketServer.php
|
||||
include/lib/WebSocketUser.php
|
||||
operation/network/network_explorer.php
|
||||
enterprise/meta/advanced/synchronizing.php
|
||||
enterprise/meta/advanced/synchronizing.os.php
|
||||
enterprise/meta/advanced/synchronizing.module_groups.php
|
||||
enterprise/meta/advanced/synchronizing.component.php
|
||||
enterprise/meta/advanced/synchronizing.alert.php
|
||||
enterprise/meta/advanced/synchronizing.user.php
|
||||
enterprise/meta/advanced/synchronizing.tag.php
|
||||
enterprise/meta/advanced/synchronizing.group.php
|
||||
operation/visual_console/pure_ajax.php
|
||||
include/ajax/update_manager.ajax.php
|
||||
godmode/update_manager/update_manager.css
|
||||
|
@ -90,6 +98,8 @@ godmode/update_manager/update_manager.online.php
|
|||
include/javascript/update_manager.js
|
||||
enterprise/include/functions_update_manager.php
|
||||
include/ajax/rolling_release.ajax.php
|
||||
extensions/plugin_registration.php
|
||||
enterprise/include/functions_plugins.php
|
||||
include/help/en/help_event_alert.php
|
||||
include/help/es/help_event_alert.php
|
||||
enterprise/godmode/alerts/alert_events.php
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `title` TEXT default '';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert_template_module` int(10) unsigned NOT NULL,
|
||||
|
@ -10,9 +14,20 @@ CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
|
|||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tsync_queue` (
|
||||
`id` serial,
|
||||
`sql` MEDIUMTEXT,
|
||||
`target` bigint(20) unsigned NOT NULL,
|
||||
`utimestamp` bigint(20) default '0',
|
||||
`operation` text,
|
||||
`table` text,
|
||||
`error` MEDIUMTEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
UPDATE `tlink` SET `link` = 'https://pandorafms.com/manual/' WHERE `id_link` = 0000000001;
|
||||
|
||||
UPDATE pandora.tuser_task
|
||||
UPDATE `tuser_task`
|
||||
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}'
|
||||
WHERE id=2;
|
||||
|
||||
|
@ -21,8 +36,7 @@ UPDATE `tuser_task_scheduled` SET
|
|||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 2;
|
||||
|
||||
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `title` TEXT default '';
|
||||
UPDATE `tconfig` SET `value` = 0 WHERE `token` = 'centralized_management';
|
||||
|
||||
DELETE ta FROM `tagente` ta LEFT JOIN `tgrupo` tg on ta.`id_grupo` = tg.`id_grupo` WHERE tg.`id_grupo` IS NULL;
|
||||
|
||||
|
|
|
@ -418,6 +418,8 @@ ALTER TABLE `tmetaconsole_setup` MODIFY COLUMN `meta_dbuser` text NULL,
|
|||
|
||||
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `server_uid` TEXT NOT NULL default '';
|
||||
|
||||
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprofile_view`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1438,13 +1440,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 47);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 48);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 755);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 756);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
|
@ -2565,7 +2567,7 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL;
|
|||
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
|
||||
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
|
||||
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
|
||||
UPDATE pandora.tuser_task
|
||||
UPDATE `tuser_task`
|
||||
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE id=2;
|
||||
DELETE FROM `tuser_task` WHERE id = 6;
|
||||
|
||||
|
@ -2739,7 +2741,7 @@ CREATE TABLE `tremote_command_target` (
|
|||
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
=========
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `trecon_script`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -4043,6 +4045,20 @@ DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
|
|||
|
||||
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tsync_queue`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tsync_queue` (
|
||||
`id` serial,
|
||||
`sql` MEDIUMTEXT,
|
||||
`target` bigint(20) unsigned NOT NULL,
|
||||
`utimestamp` bigint(20) default '0',
|
||||
`operation` text,
|
||||
`table` text,
|
||||
`error` MEDIUMTEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
|
||||
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
|
||||
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;
|
||||
|
|
|
@ -11,21 +11,25 @@
|
|||
// 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.
|
||||
require_once 'include/functions.php';
|
||||
require_once 'include/functions_html.php';
|
||||
require_once 'include/functions_ui.php';
|
||||
require_once 'include/functions_io.php';
|
||||
require_once 'include/functions_extensions.php';
|
||||
require_once __DIR__.'/../include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_html.php';
|
||||
require_once __DIR__.'/../include/functions_ui.php';
|
||||
require_once __DIR__.'/../include/functions_io.php';
|
||||
require_once __DIR__.'/../include/functions_extensions.php';
|
||||
|
||||
global $config;
|
||||
$config['homedir'] = realpath(__DIR__.'/../');
|
||||
|
||||
echo '<html>';
|
||||
ob_start('ui_process_page_head');
|
||||
echo '<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">';
|
||||
echo '</head>'."\n";
|
||||
|
||||
require_once 'include/functions_themes.php';
|
||||
require_once __DIR__.'/../include/functions_themes.php';
|
||||
ob_start('ui_process_page_body');
|
||||
|
||||
// At this point, $login_screen is setted with the error type desired
|
||||
require 'login_page.php';
|
||||
// At this point, $login_screen is set with the error type desired.
|
||||
require __DIR__.'/login_page.php';
|
||||
|
||||
?>
|
||||
</body>
|
||||
|
|
|
@ -63,6 +63,7 @@ switch ($login_screen) {
|
|||
case 'error_perms':
|
||||
case 'homedir_bad_defined':
|
||||
case 'homeurl_bad_defined':
|
||||
case 'disabled_access_node':
|
||||
$logo_link = 'index.php';
|
||||
$logo_title = __('Go to Login');
|
||||
break;
|
||||
|
@ -208,6 +209,7 @@ if (is_metaconsole() === true) {
|
|||
switch ($login_screen) {
|
||||
case 'logout':
|
||||
case 'login':
|
||||
case 'disabled_access_node':
|
||||
if (!empty($page) && !empty($sec)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
html_print_input_hidden(io_safe_input($key), io_safe_input($value));
|
||||
|
@ -508,9 +510,29 @@ if ($login_screen == 'logout') {
|
|||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($login_screen === 'disabled_access_node') {
|
||||
echo '<div id="disabled_access_node" title="'.__('User node access not enabled').'">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]);
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
|
||||
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
switch ($login_screen) {
|
||||
case 'error_dbconfig':
|
||||
case 'error_authconfig':
|
||||
case 'disabled_node_access':
|
||||
if (!isset($config['rb_product_name_alt'])) {
|
||||
$title = __('Problem with %s database', get_product_name());
|
||||
} else {
|
||||
|
@ -694,6 +716,29 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||
});
|
||||
break;
|
||||
|
||||
case 'disabled_access_node':
|
||||
$(document).ready (function () {
|
||||
$(function() {
|
||||
$("#disabled_access_node").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-hide-login-logout").click (function () {
|
||||
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
$(document).ready (function () {
|
||||
// IE9- modal warning window
|
||||
|
|
|
@ -31,9 +31,8 @@ ui_require_css_file('maintenance');
|
|||
?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Ups ...</h1>
|
||||
<div class="responsive">
|
||||
|
||||
<div class="responsive center padding-6">
|
||||
<p><?php echo __('Maintenance tasks in progress'); ?></p>
|
||||
<br>
|
||||
<br>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* Static page to lock access to console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Applications.VMware
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
ui_require_css_file('maintenance');
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<div class="responsive center padding-6">
|
||||
<p><?php echo __('You cannot use this node until system is unified'); ?></p>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
html_print_image(
|
||||
'images/maintenance.png',
|
||||
false,
|
||||
[
|
||||
'class' => 'responsive',
|
||||
'width' => 800,
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<p>
|
||||
<?php
|
||||
echo __(
|
||||
'Please navigate to %s to unify system',
|
||||
'<a href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/command_center'
|
||||
).'" target="_new">'.__('command center').'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<br>
|
||||
<p><?php echo __('You will be automatically redirected when all tasks finish'); ?></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
setTimeout(
|
||||
function() {
|
||||
location.reload();
|
||||
},
|
||||
10000
|
||||
);
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
|
@ -230,7 +230,7 @@ if (!$new_agent && $alias != '') {
|
|||
$agent_options_update = 'agent_options_update';
|
||||
|
||||
// Delete link from here.
|
||||
if (!is_central_policies_on_node()) {
|
||||
if (is_management_allowed() === true) {
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
|
@ -392,9 +392,9 @@ $table_os .= '</span></div></div></div>';
|
|||
|
||||
// Network server.
|
||||
$servers = servers_get_names();
|
||||
if (!array_key_exists($server_name, $servers)) {
|
||||
$server_Name = 0;
|
||||
// Set the agent have not server.
|
||||
// Set the agent have not server.
|
||||
if (array_key_exists($server_name, $servers) === false) {
|
||||
$server_name = 0;
|
||||
}
|
||||
|
||||
$table_server = '<div class="label_select"><p class="input_label">'.__('Server').'</p>';
|
||||
|
@ -500,7 +500,10 @@ if (enterprise_installed()) {
|
|||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
|
||||
array_merge(
|
||||
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
|
||||
[$agent['id_grupo']]
|
||||
)
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
|
|
|
@ -1494,7 +1494,7 @@ if ($update_module || $create_module) {
|
|||
$ff_event_normal = (int) get_parameter('ff_event_normal');
|
||||
$ff_event_warning = (int) get_parameter('ff_event_warning');
|
||||
$ff_event_critical = (int) get_parameter('ff_event_critical');
|
||||
$ff_type = (int) get_parameter('ff_type', $module['ff_type']);
|
||||
$ff_type = (int) get_parameter('ff_type');
|
||||
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
|
||||
$ff_timeout = (int) get_parameter('ff_timeout');
|
||||
$unit = (string) get_parameter('unit');
|
||||
|
|
|
@ -110,9 +110,14 @@ ui_print_standard_header(
|
|||
]
|
||||
);
|
||||
|
||||
if (is_central_policies_on_node()) {
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. To delete an agent go to metaconsole.')
|
||||
__(
|
||||
'This node is configured with centralized mode. Go to %s to delete an agent',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -912,7 +917,7 @@ if ($agents !== false) {
|
|||
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
|
||||
if ($check_aw && !is_central_policies_on_node()) {
|
||||
if ($check_aw && is_management_allowed() === true) {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
|
|
|
@ -170,9 +170,9 @@ $checked = get_parameter('checked');
|
|||
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
if ($policy_page) {
|
||||
$show_creation = !is_central_policies_on_node();
|
||||
$show_creation = is_management_allowed();
|
||||
} else {
|
||||
if (!isset($all_groups)) {
|
||||
if (isset($all_groups) === false) {
|
||||
$all_groups = agents_get_all_groups_agent(
|
||||
$agent['id_agente'],
|
||||
$agent['id_grupo']
|
||||
|
@ -184,7 +184,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($show_creation) {
|
||||
if ($show_creation === true) {
|
||||
// Create module/type combo.
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
if (!$policy_page) {
|
||||
|
|
|
@ -108,6 +108,7 @@ function add_component_selection($id_network_component_type)
|
|||
$data[0] = __('Using module component').' ';
|
||||
|
||||
$component_groups = network_components_get_groups($id_network_component_type);
|
||||
|
||||
$data[1] = '<span id="component_group" class="left">';
|
||||
$data[1] .= html_print_select(
|
||||
$component_groups,
|
||||
|
@ -1385,7 +1386,7 @@ $(document).ready (function () {
|
|||
tag_name = $(value).html();
|
||||
if (tag_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
$("select[name='id_tag_selected[]']").append(value);
|
||||
$("#id_tag_available").find("option[value='" + id_tag + "']").remove();
|
||||
$("#id_tag_available").find("option[value='" + tag_name + "']").remove();
|
||||
$("#id_tag_selected").find("option[value='']").remove();
|
||||
if($("#id_tag_available option").length == 0) {
|
||||
$("select[name='id_tag_available[]']").append(value);
|
||||
|
|
|
@ -213,9 +213,15 @@ if ($delete_action) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
$is_management_allowed = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/alert_actions&tab=action&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -320,7 +326,7 @@ $table->head = [];
|
|||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Command');
|
||||
$table->head[2] = __('Group');
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
@ -337,7 +343,7 @@ $table->align[3] = 'left';
|
|||
$table->align[4] = 'left';
|
||||
|
||||
$filter = [];
|
||||
if (!is_user_admin($config['id_user']) && $group === 0) {
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
$filter['talert_actions.id_group'] = array_keys(
|
||||
users_get_groups(false, 'LM')
|
||||
);
|
||||
|
@ -406,7 +412,7 @@ foreach ($actions as $action) {
|
|||
$data[3] = '';
|
||||
$data[4] = '';
|
||||
|
||||
if (is_central_policies_on_node() === false
|
||||
if (is_management_allowed() === true
|
||||
&& check_acl($config['id_user'], $action['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[] = [
|
||||
|
@ -459,7 +465,7 @@ if (isset($data)) {
|
|||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -48,7 +48,11 @@ if (is_ajax()) {
|
|||
$id = (int) get_parameter('id', 0);
|
||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
// Snmp alerts are not in the metaconsole so they cannot be centralized.
|
||||
$is_management_allowed = false;
|
||||
if ($get_recovery_fields !== 0) {
|
||||
$is_management_allowed = !is_management_allowed();
|
||||
}
|
||||
|
||||
// If command ID is not provided, check for action id.
|
||||
if ($id == 0) {
|
||||
|
@ -144,7 +148,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"removeTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -156,7 +160,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"addTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -171,7 +175,7 @@ if (is_ajax()) {
|
|||
'class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||
|
@ -181,7 +185,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"removeTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -193,7 +197,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"addTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -208,7 +212,7 @@ if (is_ajax()) {
|
|||
'class="fields_recovery"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||
|
@ -222,7 +226,7 @@ if (is_ajax()) {
|
|||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -234,7 +238,7 @@ if (is_ajax()) {
|
|||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -253,7 +257,7 @@ if (is_ajax()) {
|
|||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -265,7 +269,7 @@ if (is_ajax()) {
|
|||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -301,7 +305,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$rfield .= html_print_select(
|
||||
|
@ -315,7 +319,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
|
||||
|
@ -329,7 +333,7 @@ if (is_ajax()) {
|
|||
'style="min-height:40px; '.$style.'" class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
|
||||
|
@ -341,7 +345,7 @@ if (is_ajax()) {
|
|||
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else {
|
||||
$fields_value_select = [];
|
||||
|
@ -375,7 +379,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_select(
|
||||
$fields_value_select,
|
||||
|
@ -388,7 +392,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields_recovery',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else {
|
||||
$ffield = html_print_textarea(
|
||||
|
@ -399,7 +403,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
|
@ -409,7 +413,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields_recovery min-height-40px',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +426,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
|
@ -432,7 +436,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields_recovery min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -610,11 +614,15 @@ if ($copy_command) {
|
|||
}
|
||||
}
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
$is_management_allowed = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/alert_commands&tab=command&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -682,7 +690,7 @@ foreach ($commands as $command) {
|
|||
$table->cellclass[]['action'] = 'action_buttons';
|
||||
|
||||
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
|
||||
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
|
||||
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
|
||||
$config['id_user
|
||||
']
|
||||
|
@ -714,7 +722,7 @@ if (isset($data) === true && count($table->data) > 0) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||
if ($is_management_allowed === true && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -259,9 +259,14 @@ if ($delete_template) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alert templates information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/alert_templates&tab=template'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -409,7 +414,7 @@ foreach ($templates as $template) {
|
|||
$data[1] = ui_print_group_icon($template['id_group'], true);
|
||||
$data[3] = alerts_get_alert_templates_type_name($template['type']);
|
||||
|
||||
if (is_central_policies_on_node() === false
|
||||
if (is_management_allowed() === true
|
||||
&& check_acl($config['id_user'], $template['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[][4] = 'action_buttons';
|
||||
|
@ -469,7 +474,7 @@ if (isset($data) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -101,11 +101,16 @@ if (!$is_in_group && $al_action['id_group'] != 0) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_action&tab=action&pure=0&id='.$id
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -130,6 +135,10 @@ if ($id) {
|
|||
$create_wu_integria = $action['create_wu_integria'];
|
||||
}
|
||||
|
||||
if (users_can_manage_group_all('LW') === false && !$id) {
|
||||
$group = users_get_first_group(false, 'LW', false);
|
||||
}
|
||||
|
||||
// Hidden div with help hint to fill with javascript.
|
||||
html_print_div(
|
||||
[
|
||||
|
@ -178,7 +187,7 @@ $table->data[0][1] = html_print_input_text(
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
if (io_safe_output($name) == 'Monitoring Event') {
|
||||
|
@ -214,7 +223,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
).'</div>';
|
||||
$table->colspan[1][1] = 2;
|
||||
|
||||
|
@ -248,10 +257,10 @@ $table->data[2][1] = html_print_select_from_sql(
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[2][1] .= ' ';
|
||||
if ($is_central_policies_on_node === false
|
||||
if ($is_management_allowed === true
|
||||
&& check_acl($config['id_user'], 0, 'PM') && !$disabled
|
||||
) {
|
||||
$table->data[2][1] .= __('Create Command');
|
||||
|
@ -275,7 +284,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
|
@ -359,7 +368,7 @@ echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/ale
|
|||
$table_html = html_print_table($table, true);
|
||||
|
||||
echo $table_html;
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
|
@ -618,9 +627,6 @@ $(document).ready (function () {
|
|||
$("#group option").each(function(index, value) {
|
||||
var current_group = $(value).val();
|
||||
});
|
||||
if (data.id_group != 0 && $("#group").val() != data.id_group) {
|
||||
$("#group").val(0);
|
||||
}
|
||||
|
||||
var integria_custom_fields_values = [];
|
||||
var integria_custom_fields_rvalues = [];
|
||||
|
|
|
@ -105,6 +105,7 @@ if ($update_command) {
|
|||
$alert['command'] = $command;
|
||||
$alert['description'] = $description;
|
||||
$alert['id_group'] = $id_group;
|
||||
$alert['fields_hidden'] = io_json_mb_encode($fields_hidden);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,11 +156,16 @@ if (empty($fields_hidden) === false) {
|
|||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_command&pure=0&id='.$id
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -203,7 +209,7 @@ $table->data['name'][2] = html_print_input_text(
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->colspan['command'][1] = 3;
|
||||
|
@ -216,7 +222,7 @@ $table->data['command'][1] = html_print_textarea(
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$return_all_group = false;
|
||||
|
@ -240,7 +246,7 @@ $table->data['group'][1] = '<div class="w250px inline">'.html_print_select_group
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
).'</div>';
|
||||
|
||||
$table->colspan['description'][1] = 3;
|
||||
|
@ -253,7 +259,7 @@ $table->data['description'][1] = html_print_textarea(
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
|
||||
|
@ -283,7 +289,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||
|
@ -321,7 +327,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->data['field'.$i][4] = __('Hide');
|
||||
|
@ -330,7 +336,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'field'.$i.'_hide',
|
||||
1,
|
||||
$selected,
|
||||
$is_central_policies_on_node,
|
||||
!$is_management_allowed,
|
||||
'cursor: \'pointer\'',
|
||||
'class="hide_inputs"',
|
||||
true
|
||||
|
@ -340,7 +346,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
|
||||
html_print_table($table);
|
||||
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
|
|
|
@ -36,7 +36,9 @@ $id = (int) get_parameter('id');
|
|||
$pure = get_parameter('pure', 0);
|
||||
$step = (int) get_parameter('step', 1);
|
||||
// We set here the number of steps.
|
||||
define('LAST_STEP', 3);
|
||||
if (defined('LAST_STEP') === false) {
|
||||
define('LAST_STEP', 3);
|
||||
}
|
||||
|
||||
if ($duplicate_template) {
|
||||
$source_id = (int) get_parameter('source_id');
|
||||
|
@ -368,17 +370,19 @@ function update_template($step)
|
|||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
__(
|
||||
'This node is configured with centralized mode. All alerts templates information is read only. Go to Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_template&pure=0&id='.$id.'&step='.$step
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// We set here the number of steps.
|
||||
define('LAST_STEP', 3);
|
||||
|
||||
$step = (int) get_parameter('step', 1);
|
||||
|
||||
$create_alert = (bool) get_parameter('create_alert');
|
||||
|
@ -609,7 +613,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$monday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Tue');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -617,7 +621,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$tuesday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Wed');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -625,7 +629,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$wednesday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Thu');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -633,7 +637,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$thursday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Fri');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -641,7 +645,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$friday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Sat');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -649,7 +653,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$saturday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Sun');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -657,7 +661,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$sunday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Use special days list');
|
||||
|
@ -666,7 +670,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$special_day,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Time from');
|
||||
|
@ -687,7 +691,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[1][2] = __('Time to');
|
||||
$table->data[1][3] = html_print_input_text(
|
||||
|
@ -707,7 +711,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->colspan['threshold'][1] = 3;
|
||||
|
@ -723,7 +727,7 @@ if ($step == 2) {
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Min. number of alerts');
|
||||
|
@ -744,7 +748,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[3][2] = __('Reset counter for non-sustained alerts');
|
||||
|
@ -757,7 +761,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$min_alerts_reset_counter,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
'',
|
||||
false,
|
||||
$create_template == 1 ? 'checked=checked' : ''
|
||||
|
@ -781,7 +785,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[4][2] = __('Disable event');
|
||||
|
@ -790,7 +794,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$disable_event,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[5][0] = __('Default action');
|
||||
|
@ -818,7 +822,7 @@ if ($step == 2) {
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
false,
|
||||
false,
|
||||
0
|
||||
|
@ -840,7 +844,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
|
||||
$table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true);
|
||||
|
@ -949,7 +953,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->colspan[0][1] = 2;
|
||||
|
||||
|
@ -975,7 +979,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"removeTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
|
@ -988,7 +992,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"addTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
|
@ -1004,7 +1008,7 @@ if ($step == 2) {
|
|||
'class="fields" min-height-40px',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
// Recovery.
|
||||
|
@ -1016,7 +1020,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"removeTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
|
@ -1029,7 +1033,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"addTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
|
@ -1045,7 +1049,7 @@ if ($step == 2) {
|
|||
'class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -1102,7 +1106,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
|
||||
|
@ -1134,7 +1138,7 @@ if ($step == 2) {
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
).'</div>';
|
||||
|
||||
|
||||
|
@ -1147,7 +1151,7 @@ if ($step == 2) {
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Priority');
|
||||
|
@ -1162,7 +1166,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -1200,7 +1204,7 @@ if ($id) {
|
|||
}
|
||||
|
||||
if (!$disabled) {
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
if ($step >= LAST_STEP) {
|
||||
html_print_submit_button(
|
||||
__('Finish'),
|
||||
|
|
|
@ -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,47 @@ 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 categories information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure']
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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 +132,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 +151,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 +167,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 +180,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 +207,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');
|
||||
}
|
||||
|
|
|
@ -263,15 +263,7 @@ if (defined('METACONSOLE')) {
|
|||
$sec = 'gagente';
|
||||
}
|
||||
|
||||
if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0) {
|
||||
if (isset($config['metaconsole_agent_cache']) && $config['metaconsole_agent_cache'] == 1) {
|
||||
$confirm_bottom = " onsubmit=' return message_check_create();'";
|
||||
}
|
||||
} else {
|
||||
$confirm_bottom = '';
|
||||
}
|
||||
|
||||
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'"'.$confirm_bottom.' >';
|
||||
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'" >';
|
||||
html_print_table($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"');
|
||||
|
@ -291,15 +283,6 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function message_check_create() {
|
||||
var return_value = false;
|
||||
|
||||
return_value = confirm("<?php echo __("WARNING: You\'re trying to create a group in a node member of a metaconsole.\\n\\nThis group and all of this contents will not be visible in the metaconsole.\\n\\nIf you want to create a visible group, you must do it from the metaconsole and propagate to the node. "); ?>");
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function icon_changed () {
|
||||
var inputs = [];
|
||||
var data = this.value;
|
||||
|
|
|
@ -379,6 +379,19 @@ if (is_metaconsole() === true) {
|
|||
);
|
||||
}
|
||||
|
||||
$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 groups information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/groups/group_list&tab=groups'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Load credential store view before parse list-tree forms.
|
||||
if ($tab == 'credbox') {
|
||||
include_once __DIR__.'/credential_store.php';
|
||||
|
@ -392,7 +405,10 @@ $delete_group = (bool) get_parameter('delete_group');
|
|||
$pure = get_parameter('pure', 0);
|
||||
|
||||
// Create group.
|
||||
if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
|
||||
if ($is_management_allowed === true
|
||||
&& $create_group === true
|
||||
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
|
||||
) {
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
$id_parent = (int) get_parameter('id_parent');
|
||||
|
@ -448,7 +464,7 @@ if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
|
|||
}
|
||||
|
||||
// Update group.
|
||||
if ($update_group) {
|
||||
if ($is_management_allowed === true && $update_group === true) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
|
@ -520,7 +536,10 @@ if ($update_group) {
|
|||
}
|
||||
|
||||
// Delete group.
|
||||
if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
|
||||
if ($is_management_allowed === true
|
||||
&& $delete_group === true
|
||||
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
|
||||
) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$usedGroup = groups_check_used($id_group);
|
||||
|
@ -701,7 +720,6 @@ if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Credential store is loaded previously in this document to avoid
|
||||
// process group tree - list forms.
|
||||
if ($tab == 'tree') {
|
||||
|
@ -817,15 +835,24 @@ if ($tab == 'tree') {
|
|||
$table->headstyle[4] = 'min-width: 100px;';
|
||||
$table->head[5] = __('Description');
|
||||
$table->headstyle[5] = 'min-width: 100px;';
|
||||
$table->head[6] = __('Actions');
|
||||
$table->headstyle[6] = 'min-width: 100px;';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = __('Actions');
|
||||
$table->headstyle[6] = 'min-width: 100px;';
|
||||
}
|
||||
|
||||
$table->align = [];
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->align[6] = 'left';
|
||||
}
|
||||
|
||||
$table->size[0] = '3%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '5%';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->size[6] = '5%';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
|
@ -837,7 +864,12 @@ if ($tab == 'tree') {
|
|||
}
|
||||
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||
} else {
|
||||
$table->data[$key][1] = $group['nombre'];
|
||||
}
|
||||
|
||||
if ($group['icon'] != '') {
|
||||
$table->data[$key][2] = html_print_image(
|
||||
'images/groups_small/'.$group['icon'].'.png',
|
||||
|
@ -862,36 +894,38 @@ if ($tab == 'tree') {
|
|||
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->cellclass[$key][6] = 'action_buttons';
|
||||
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Edit'),
|
||||
'title' => __('Edit'),
|
||||
'border' => '0',
|
||||
]
|
||||
).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[$key][6] = 'action_buttons';
|
||||
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Edit'),
|
||||
'title' => __('Edit'),
|
||||
'border' => '0',
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
|
||||
} else {
|
||||
$confirm_message = __('Are you sure?');
|
||||
if (is_metaconsole() === true) {
|
||||
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
|
||||
} else {
|
||||
$confirm_message = __('Are you sure?');
|
||||
}
|
||||
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'border' => '0',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'border' => '0',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
echo ui_pagination(
|
||||
|
@ -924,7 +958,10 @@ if ($tab == 'tree') {
|
|||
}
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
|
||||
if ($is_management_allowed === true
|
||||
&& (bool) check_acl($config['id_user'], 0, 'PM') === true
|
||||
) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
|
||||
echo '<div class="action-buttons w100p">';
|
||||
html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"');
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
* Module Groups.
|
||||
*
|
||||
* @category Extensions
|
||||
* @category Module groups
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
|
@ -40,7 +39,7 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if (is_ajax() === true) {
|
||||
$get_group_json = (bool) get_parameter('get_group_json');
|
||||
$get_group_agents = (bool) get_parameter('get_group_agents');
|
||||
|
||||
|
@ -65,7 +64,7 @@ if (is_ajax()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
if (is_metaconsole() === false) {
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Module groups defined in %s', get_product_name()),
|
||||
|
@ -77,12 +76,25 @@ if (!is_metaconsole()) {
|
|||
);
|
||||
}
|
||||
|
||||
$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 module groups information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$create_group = (bool) get_parameter('create_group');
|
||||
$update_group = (bool) get_parameter('update_group');
|
||||
$delete_group = (bool) get_parameter('delete_group');
|
||||
|
||||
// Create group.
|
||||
if ($create_group) {
|
||||
if ($is_management_allowed === true && $create_group === true) {
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
$id_parent = (int) get_parameter('id_parent');
|
||||
|
@ -115,7 +127,7 @@ if ($create_group) {
|
|||
}
|
||||
|
||||
// Update group.
|
||||
if ($update_group) {
|
||||
if ($is_management_allowed === true && $update_group === true) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
|
@ -151,7 +163,7 @@ if ($update_group) {
|
|||
}
|
||||
|
||||
// Delete group.
|
||||
if ($delete_group) {
|
||||
if ($is_management_allowed === true && $delete_group === true) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
|
||||
|
@ -217,7 +229,6 @@ $total_groups = db_get_num_rows('SELECT * FROM tmodule_group');
|
|||
$url = ui_get_url_refresh(['offset' => false]);
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM tmodule_group
|
||||
ORDER BY name ASC
|
||||
|
@ -229,27 +240,39 @@ $table = new stdClass();
|
|||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
|
||||
if (!empty($groups)) {
|
||||
if (empty($groups) === false) {
|
||||
$table->head = [];
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Delete');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[2] = __('Delete');
|
||||
}
|
||||
|
||||
$table->align = [];
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->size[2] = '5%';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->align[2] = 'left';
|
||||
$table->size[2] = '5%';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
foreach ($groups as $id_group) {
|
||||
$data = [];
|
||||
$data[0] = $id_group['id_mg'];
|
||||
|
||||
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
|
||||
if (is_metaconsole()) {
|
||||
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
|
||||
if (is_metaconsole() === true) {
|
||||
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
} else {
|
||||
$table->cellclass[][2] = 'action_buttons';
|
||||
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
}
|
||||
} else {
|
||||
$table->cellclass[][2] = 'action_buttons';
|
||||
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
$data[1] = '<strong>';
|
||||
$data[1] .= ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT);
|
||||
$data[1] .= '</strong>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
|
@ -267,13 +290,15 @@ if (!empty($groups)) {
|
|||
);
|
||||
}
|
||||
|
||||
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"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
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"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
|
|
@ -38,6 +38,19 @@ if (!check_acl($config['id_user'], 0, 'UM')) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once 'include/functions_agents.php';
|
||||
require_once 'include/functions_alerts.php';
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
|
|
|
@ -201,7 +201,7 @@ $table->data[2][1] = html_print_select(
|
|||
|
||||
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
||||
html_print_table($table);
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
attachActionButton('delete', 'delete', $table->width);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,19 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once 'include/functions_agents.php';
|
||||
require_once 'include/functions_alerts.php';
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
|
|
|
@ -845,11 +845,9 @@ echo '<h3 class="error invisible" id="message"> </h3>';
|
|||
|
||||
html_print_input_hidden('id_agente', $id_agente);
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
attachActionButton('update_agents', 'update', $table->width);
|
||||
}
|
||||
attachActionButton('update_agents', 'update', $table->width);
|
||||
|
||||
// Shown and hide div
|
||||
// Shown and hide div.
|
||||
echo '</div></form>';
|
||||
|
||||
ui_require_jquery_file('form');
|
||||
|
|
|
@ -333,8 +333,15 @@ $agentstab = [
|
|||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($tab == 'massive_policies' && is_central_policies_on_node()) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
|
||||
if ($tab == 'massive_policies' && is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All policies information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/policymanager'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -393,8 +400,15 @@ $agentstab = [
|
|||
</script>
|
||||
|
||||
<?php
|
||||
if (is_central_policies_on_node() && $option == 'delete_agents') {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
|
||||
if (is_management_allowed() === false && $option == 'delete_agents') {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. To delete agents go to %s',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
|
|
@ -282,13 +282,16 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
|
|||
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
|
||||
}
|
||||
|
||||
// This subtabs are only for Pandora Admin
|
||||
// This subtabs are only for Pandora Admin.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
enterprise_hook('ha_cluster');
|
||||
|
||||
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
||||
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
||||
|
||||
$sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin');
|
||||
$sub['godmode/servers/plugin_registration']['id'] = 'register_plugin';
|
||||
|
||||
enterprise_hook('export_target_submenu');
|
||||
|
||||
enterprise_hook('manage_satellite_submenu');
|
||||
|
|
|
@ -255,7 +255,7 @@ foreach ($groups as $group) {
|
|||
|
||||
|
||||
$tabulation = str_repeat(' ', $group['deep']);
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$data[0] = $tabulation.'<a href="index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
|
||||
} else {
|
||||
$data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
|
||||
|
@ -270,8 +270,15 @@ foreach ($groups as $group) {
|
|||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (is_management_allowed() === false && !is_metaconsole()) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.'));
|
||||
if (is_management_allowed() === false && is_metaconsole() === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. Component groups are read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
* Remote components
|
||||
*
|
||||
* @category Extensions
|
||||
* @category Remote Components
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
|
@ -48,7 +47,7 @@ enterprise_include_once('meta/include/functions_components_meta.php');
|
|||
require_once $config['homedir'].'/include/functions_component_groups.php';
|
||||
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$sec = 'advanced';
|
||||
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
|
@ -67,6 +66,11 @@ if (defined('METACONSOLE')) {
|
|||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
}
|
||||
|
||||
$type = (int) get_parameter('type');
|
||||
$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'))));
|
||||
|
@ -87,7 +91,7 @@ $macros = (string) get_parameter('macros');
|
|||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
|
||||
if (!empty($macros)) {
|
||||
if (empty($macros) === false) {
|
||||
$macros = json_decode(base64_decode($macros), true);
|
||||
|
||||
foreach ($macros as $k => $m) {
|
||||
|
@ -179,7 +183,7 @@ $create_network_from_snmp_browser = (bool) get_parameter(
|
|||
0
|
||||
);
|
||||
|
||||
if ($duplicate_network_component) {
|
||||
if ($is_management_allowed === true && $duplicate_network_component) {
|
||||
$source_id = (int) get_parameter('source_id');
|
||||
|
||||
$id = network_components_duplicate_network_component($source_id);
|
||||
|
@ -267,7 +271,7 @@ $custom_string_2 = '';
|
|||
$custom_string_3 = '';
|
||||
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
|
@ -292,6 +296,17 @@ if (defined('METACONSOLE')) {
|
|||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All remote components are read only. Go to %s to manage them.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/modules/manage_network_components&tab=network&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
|
||||
// New support for snmp v3.
|
||||
$tcp_send = $snmp_version;
|
||||
|
@ -307,7 +322,7 @@ if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
|
|||
$custom_string_2 = $command_os;
|
||||
}
|
||||
|
||||
if ($create_component) {
|
||||
if ($is_management_allowed === true && $create_component) {
|
||||
$name_check = db_get_value(
|
||||
'name',
|
||||
'tnetwork_component',
|
||||
|
@ -410,7 +425,7 @@ if ($create_component) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($update_component) {
|
||||
if ($is_management_allowed === true && $update_component) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
if (!empty($name)) {
|
||||
|
@ -502,7 +517,7 @@ if ($update_component) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($delete_component) {
|
||||
if ($is_management_allowed === true && $delete_component) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
$result = network_components_delete_network_component($id);
|
||||
|
@ -527,7 +542,7 @@ if ($delete_component) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($multiple_delete) {
|
||||
if ($is_management_allowed === true && $multiple_delete) {
|
||||
$ids = (array) get_parameter('delete_multiple', []);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
|
@ -645,7 +660,7 @@ $table->data[0][3] = html_print_input_text(
|
|||
255,
|
||||
true
|
||||
);
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->data[0][4] = '<div>';
|
||||
} else {
|
||||
$table->data[0][4] = '<div class="action-buttons">';
|
||||
|
@ -660,7 +675,7 @@ $table->data[0][4] .= html_print_submit_button(
|
|||
);
|
||||
$table->data[0][4] .= '</div>';
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$filter = '<form class="filters_form" method="post" action="'.$url.'">';
|
||||
$filter .= html_print_table($table, true);
|
||||
$filter .= '</form>';
|
||||
|
@ -713,26 +728,38 @@ unset($table);
|
|||
$table->width = '100%';
|
||||
$table->head = [];
|
||||
$table->class = 'info_table';
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$table->head[0] = __('Module name');
|
||||
$table->head[1] = __('Server');
|
||||
$table->head[2] = __('Type');
|
||||
$table->head[3] = __('Description');
|
||||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = __('Action');
|
||||
}
|
||||
|
||||
$table->size = [];
|
||||
$table->size['checkbox'] = '20px';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->size['checkbox'] = '20px';
|
||||
}
|
||||
|
||||
$table->size[1] = '40px';
|
||||
$table->size[2] = '50px';
|
||||
$table->size[6] = '80px';
|
||||
$table->align[6] = 'left';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->size[6] = '80px';
|
||||
$table->align[6] = 'left';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
foreach ($components as $component) {
|
||||
|
@ -743,19 +770,24 @@ foreach ($components as $component) {
|
|||
$component['min'] = __('N/A');
|
||||
}
|
||||
|
||||
$data['checkbox'] = html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$component['id_nc'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'class="check_delete"',
|
||||
true
|
||||
);
|
||||
if ($is_management_allowed === true) {
|
||||
$data['checkbox'] = html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$component['id_nc'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'class="check_delete"',
|
||||
true
|
||||
);
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] .= io_safe_output($component['name']);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = io_safe_output($component['name']);
|
||||
}
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] .= io_safe_output($component['name']);
|
||||
$data[0] .= '</a>';
|
||||
switch ($component['id_modulo']) {
|
||||
case MODULE_NETWORK:
|
||||
$data[1] .= html_print_image(
|
||||
|
@ -811,32 +843,37 @@ foreach ($components as $component) {
|
|||
$data[4] = network_components_get_group_name($component['id_group']);
|
||||
$data[5] = $component['max'].' / '.$component['min'];
|
||||
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Duplicate'),
|
||||
'title' => __('Duplicate'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Duplicate'),
|
||||
'title' => __('Duplicate'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
if (isset($data) === true) {
|
||||
if ($is_management_allowed === true) {
|
||||
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination(
|
||||
$total_components,
|
||||
|
@ -848,15 +885,17 @@ if (isset($data)) {
|
|||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
echo "<div id='btn_delete_5' class='float-right'>";
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'delete_btn',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
if ($is_management_allowed === true) {
|
||||
echo "<div id='btn_delete_5' class='float-right'>";
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'delete_btn',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
} else {
|
||||
ui_print_info_message(
|
||||
[
|
||||
|
@ -866,31 +905,33 @@ if (isset($data)) {
|
|||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
echo '<div class="right_align mrgn_btn_15px">';
|
||||
html_print_input_hidden('new_component', 1);
|
||||
html_print_select(
|
||||
[
|
||||
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
|
||||
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
|
||||
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
|
||||
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
|
||||
],
|
||||
'id_component_type',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next mrgn_lft_5px"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
echo '<div class="right_align mrgn_btn_15px">';
|
||||
html_print_input_hidden('new_component', 1);
|
||||
html_print_select(
|
||||
[
|
||||
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
|
||||
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
|
||||
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
|
||||
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
|
||||
],
|
||||
'id_component_type',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next mrgn_lft_5px"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ if (isset($id)) {
|
|||
$snmp3_privacy_pass = io_output_password(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
unset($tcp_send);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
|
||||
$command_text = $component['tcp_send'];
|
||||
|
|
|
@ -1,19 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Manage plugins.
|
||||
*
|
||||
* @category Utility
|
||||
* @package Pandora FMS
|
||||
* @subpackage Plugins
|
||||
* @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
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_plugins.php';
|
||||
|
||||
if (is_ajax()) {
|
||||
$get_plugin_description = get_parameter('get_plugin_description');
|
||||
$get_list_modules_and_component_locked_plugin = (bool) get_parameter('get_list_modules_and_component_locked_plugin', 0);
|
||||
|
@ -112,7 +129,6 @@ $edit_file = get_parameter('edit_file', false);
|
|||
$update_file = get_parameter('update_file', false);
|
||||
$plugin_command = get_parameter('plugin_command', '');
|
||||
$tab = get_parameter('tab', '');
|
||||
$deploy_plugin = get_parameter('deploy_plugin', 0);
|
||||
|
||||
if ($view != '') {
|
||||
$form_id = $view;
|
||||
|
@ -283,11 +299,12 @@ $sec = 'gservers';
|
|||
if (($create != '') || ($view != '')) {
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
$management_allowed = is_management_allowed();
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
} else {
|
||||
|
@ -309,8 +326,7 @@ if (($create != '') || ($view != '')) {
|
|||
);
|
||||
}
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
|
@ -619,36 +635,6 @@ if (($create != '') || ($view != '')) {
|
|||
__('To manage plugin you must activate centralized management')
|
||||
);
|
||||
}
|
||||
|
||||
if (!$config['metaconsole_deploy_plugin_server'] && $management_allowed) {
|
||||
$deploy_plugin_server = true;
|
||||
|
||||
echo '<div id="deploy_messages" class="invisible">';
|
||||
echo '<span>'.__('The previous configuration of plugins has been imported from the nodes. Please check that the definitions are correct.').'</br></br>'.'<b>'.__('Note:').'</b>'.__(
|
||||
'These definitions will not be operational until you manually
|
||||
copy the files from the nodes to the atachment/plugin/ directory of the meta console.'
|
||||
).'</br></br>'.__('You can find more information at:')."<a href='https://pandorafms.com/manual'>https://pandorafms.com/manual</a>".'</span>';
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#deploy_messages").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
config_update_value('metaconsole_deploy_plugin_server', 1);
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
__(
|
||||
|
@ -661,8 +647,8 @@ if (($create != '') || ($view != '')) {
|
|||
true
|
||||
);
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
$management_allowed = is_management_allowed();
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
|
@ -820,180 +806,20 @@ if (($create != '') || ($view != '')) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ($plugin_id != 0) {
|
||||
// Delete all the modules with this plugin
|
||||
$plugin_modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['id_plugin' => $plugin_id]
|
||||
);
|
||||
|
||||
if (empty($plugin_modules)) {
|
||||
$plugin_modules = [];
|
||||
}
|
||||
|
||||
foreach ($plugin_modules as $pm) {
|
||||
modules_delete_agent_module($pm['id_agente_modulo']);
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
$policies_ids = db_get_all_rows_filter('tpolicy_modules', ['id_plugin' => $plugin_id]);
|
||||
foreach ($policies_ids as $policies_id) {
|
||||
policies_change_delete_pending_module($policies_id['id']);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_delete_plugin($plugin_id);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_deploy_plugin($deploy_plugin);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deploying plugin'));
|
||||
if ((int) $plugin_id > 0) {
|
||||
// Delete all iformation related with this plugin.
|
||||
$result = plugins_delete_plugin($plugin_id);
|
||||
if (empty($result) === false) {
|
||||
ui_print_error_message(
|
||||
implode('<br>', $result)
|
||||
);
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deployed successfully'));
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin_server) {
|
||||
$setup = db_get_all_rows_in_table('tmetaconsole_setup');
|
||||
// recorremos todos los nodos.
|
||||
foreach ($setup as $key => $value) {
|
||||
// Obtenemos los plugins de la meta.
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
// Conectamos con el nodo.
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$values = [];
|
||||
// Obtenemos los plugin del nodo.
|
||||
$node_plugin_server = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
foreach ($node_plugin_server as $key2 => $plugin) {
|
||||
// Comprobamos si el id esta meta y nodo al mismo tiempo.
|
||||
$key_exists = array_search($plugin['id'], array_column($all_plugin_meta, 'id'));
|
||||
if ($key_exists !== false) {
|
||||
// Si el plugin tiene el mismo id pero diferentes datos.
|
||||
if ($all_plugin_meta[$key_exists] != $plugin) {
|
||||
$old_id = $plugin['id'];
|
||||
$new_id = ($plugin['id'] + (1000 * $value['id']));
|
||||
|
||||
// El plugin del nodo pasa a tener otro id y otro nombre.
|
||||
$plugin['id'] = $new_id;
|
||||
$plugin['name'] = $plugin['name'].'_'.$value['server_name'];
|
||||
$result_update = db_process_sql_update(
|
||||
'tplugin',
|
||||
[
|
||||
'id' => $new_id,
|
||||
'name' => $plugin['name'],
|
||||
],
|
||||
['id' => $old_id]
|
||||
);
|
||||
|
||||
if ($result_update) {
|
||||
db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tpolicy_modules',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
}
|
||||
|
||||
// New plugins to insert in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
} else {
|
||||
// Exists in the node, but does not exist in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore to metaconsole.
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Insert in metaconsole.
|
||||
if (!empty($values)) {
|
||||
foreach ($values as $key2 => $val) {
|
||||
// Insert into metaconsole.
|
||||
$result_insert = db_process_sql_insert('tplugin', $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
foreach ($setup as $key => $value) {
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$all_plugin_node = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
$array_diff = array_diff(array_column($all_plugin_meta, 'id'), array_column($all_plugin_node, 'id'));
|
||||
foreach ($array_diff as $key2 => $pluginid) {
|
||||
$other = [];
|
||||
$plugin_meta = $all_plugin_meta[$key2];
|
||||
|
||||
unset($plugin_meta['id']);
|
||||
$other['name'] = urlencode($plugin_meta['name']);
|
||||
$other['description'] = urlencode($plugin_meta['description']);
|
||||
$other['max_timeout'] = $plugin_meta['max_timeout'];
|
||||
$other['max_retries'] = $plugin_meta['max_retries'];
|
||||
$other['execute'] = urlencode($plugin_meta['execute']);
|
||||
$other['net_dst_opt'] = $plugin_meta['net_dst_opt'];
|
||||
$other['net_port_opt'] = $plugin_meta['net_port_opt'];
|
||||
$other['user_opt'] = $plugin_meta['user_opt'];
|
||||
$other['pass_opt'] = $plugin_meta['pass_opt'];
|
||||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7E', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
$post = ['file' => curl_file_create($file_path)];
|
||||
}
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $url);
|
||||
curl_setopt($curlObj, CURLOPT_POST, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$api_result = curl_exec($curlObj);
|
||||
curl_close($curlObj);
|
||||
}
|
||||
}
|
||||
|
||||
// restore to metaconsole
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
// If not edition or insert, then list available plugins
|
||||
// If not edition or insert, then list available plugins.
|
||||
$rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name');
|
||||
|
||||
if ($rows !== false) {
|
||||
|
@ -1081,16 +907,6 @@ if (($create != '') || ($view != '')) {
|
|||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
if (is_metaconsole()) {
|
||||
echo " <a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&deploy_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image(
|
||||
'images/deploy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Deploy'),
|
||||
'width' => '21 px',
|
||||
]
|
||||
).'</a> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,571 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin registration.
|
||||
*
|
||||
* @category Plugins
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
|
||||
use PandoraFMS\Tools\Files;
|
||||
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
// Check ACL and Login.
|
||||
check_login();
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === false
|
||||
|| (bool) check_acl($config['id_user'], 0, 'AW') === false
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Plugin Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
ui_require_css_file('first_task');
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
enterprise_include_once('meta/include/functions_components_meta.php');
|
||||
enterprise_hook('open_meta_frame');
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('To manage plugin you must activate centralized management')
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
__('PLUGIN REGISTRATION'),
|
||||
'images/gm_servers.png',
|
||||
false,
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$management_allowed = is_management_allowed();
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment, please manage this feature from feature from %s.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/servers/plugin_registration&tab=plugin_registration&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$str = 'This extension makes registering server plugins an easier task.';
|
||||
$str .= ' Here you can upload a server plugin in .pspz zipped format.';
|
||||
$str .= ' Please refer to the official documentation on how to obtain and use Server Plugins.';
|
||||
|
||||
$output = '<div class="new_task">';
|
||||
$output .= '<div class="image_task">';
|
||||
$output .= html_print_image(
|
||||
'images/first_task/icono_grande_import.png',
|
||||
true,
|
||||
['title' => __('Plugin Registration') ]
|
||||
);
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="text_task">';
|
||||
$output .= '<h3>'.__('Plugin registration').'</h3>';
|
||||
$output .= '<p id="description_task">';
|
||||
$output .= __($str);
|
||||
$output .= '<br><br>';
|
||||
$output .= __('You can get more plugins in our');
|
||||
$output .= '<a href="http://pandorafms.com/Library/Library/">';
|
||||
$output .= ' '.__('Public Resource Library');
|
||||
$output .= '</a>';
|
||||
$output .= '</p>';
|
||||
|
||||
// Upload form.
|
||||
$output .= "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
||||
$output .= '<table class="" id="table1" width="100%" border="0" cellpadding="4" cellspacing="4">';
|
||||
$output .= "<tr><td class='datos'><input type='file' name='plugin_upload' />";
|
||||
$output .= "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
|
||||
$output .= '</form></table>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
|
||||
$zip = null;
|
||||
$upload = false;
|
||||
if (isset($_FILES['plugin_upload']) === true) {
|
||||
$basepath = $config['attachment_store'].'/plugin';
|
||||
|
||||
$filename = $_FILES['plugin_upload']['name'];
|
||||
$uploaded_filename = $_FILES['plugin_upload']['tmp_name'];
|
||||
|
||||
$tmp_path = Files::tempdirnam(
|
||||
$config['attachment_store'].'/downloads/',
|
||||
'plugin_uploaded_'
|
||||
);
|
||||
if ($tmp_path === false) {
|
||||
$error = __('Failed to create temporary directory');
|
||||
}
|
||||
} else {
|
||||
$error = '';
|
||||
}
|
||||
|
||||
if ($error === null) {
|
||||
if (Files::unzip($uploaded_filename, $tmp_path) === true) {
|
||||
// Successfully extracted to tmp directory.
|
||||
// Grant execution over all files found.
|
||||
Files::chmod($tmp_path, 0755);
|
||||
|
||||
// Operate.
|
||||
$ini_array = parse_ini_file($tmp_path.'/plugin_definition.ini', true);
|
||||
// Clean plugin_definition.ini file.
|
||||
unlink($tmp_path.'/plugin_definition.ini');
|
||||
|
||||
// Parse with sections.
|
||||
if ($ini_array === false) {
|
||||
$error = __('Cannot load INI file');
|
||||
} else {
|
||||
// Relocate files to target destination.
|
||||
Files::move($tmp_path.'/*', $basepath.'/', true);
|
||||
|
||||
// Extract information.
|
||||
$version = preg_replace('/.*[.]/', '', $filename);
|
||||
$exec_path = $basepath.'/'.$ini_array['plugin_definition']['filename'];
|
||||
$file_exec_path = $exec_path;
|
||||
|
||||
if (isset($ini_array['plugin_definition']['execution_command']) === true
|
||||
&& empty($ini_array['plugin_definition']['execution_command']) === false
|
||||
) {
|
||||
$exec_path = $ini_array['plugin_definition']['execution_command'];
|
||||
$exec_path .= ' '.$basepath.'/';
|
||||
$exec_path .= $ini_array['plugin_definition']['filename'];
|
||||
}
|
||||
|
||||
if (isset($ini_array['plugin_definition']['execution_postcommand']) === true
|
||||
&& empty($ini_array['plugin_definition']['execution_postcommand']) === false
|
||||
) {
|
||||
$exec_path .= ' '.$ini_array['plugin_definition']['execution_postcommand'];
|
||||
}
|
||||
|
||||
if (file_exists($file_exec_path) === false) {
|
||||
$error = __('Plugin exec not found. Aborting!');
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
} else {
|
||||
// Verify if a plugin with the same name is already registered.
|
||||
$sql = sprintf(
|
||||
'SELECT COUNT(*) FROM tplugin WHERE name = "%s"',
|
||||
io_safe_input($ini_array['plugin_definition']['name'])
|
||||
);
|
||||
$result = db_get_sql($sql);
|
||||
|
||||
if ($result > 0) {
|
||||
$error = __('Plugin already registered. Aborting!');
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
} else {
|
||||
$values = [
|
||||
'name' => io_safe_input($ini_array['plugin_definition']['name']),
|
||||
'description' => io_safe_input($ini_array['plugin_definition']['description']),
|
||||
'max_timeout' => $ini_array['plugin_definition']['timeout'],
|
||||
'execute' => io_safe_input($exec_path),
|
||||
'net_dst_opt' => $ini_array['plugin_definition']['ip_opt'],
|
||||
'net_port_opt' => $ini_array['plugin_definition']['port_opt'],
|
||||
'user_opt' => $ini_array['plugin_definition']['user_opt'],
|
||||
'pass_opt' => $ini_array['plugin_definition']['pass_opt'],
|
||||
'parameters' => $ini_array['plugin_definition']['parameters'],
|
||||
'plugin_type' => $ini_array['plugin_definition']['plugin_type'],
|
||||
];
|
||||
|
||||
switch ($version) {
|
||||
case 'pspz':
|
||||
// Fixed the static parameters
|
||||
// for
|
||||
// the dinamic parameters of pandoras 5.
|
||||
$total_macros = 0;
|
||||
$macros = [];
|
||||
|
||||
if (isset($values['parameters']) === false) {
|
||||
$values['parameters'] = '';
|
||||
}
|
||||
|
||||
if (empty($values['net_dst_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Target IP from net';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['net_dst_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if (empty($values['ip_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Target IP';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['ip_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if (empty($values['net_port_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Port from net';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['net_port_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if (empty($values['port_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Port';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['port_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if (empty($values['user_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Username';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['user_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
if (empty($values['pass_opt']) === false) {
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Password';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= $values['pass_opt'].' _field'.$total_macros.'_ ';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
}
|
||||
|
||||
// A last parameter is defined always to
|
||||
// add the old "Plug-in parameters" in the
|
||||
// side of the module.
|
||||
$total_macros++;
|
||||
|
||||
$macro = [];
|
||||
$macro['macro'] = '_field'.$total_macros.'_';
|
||||
$macro['desc'] = 'Plug-in Parameters';
|
||||
$macro['help'] = '';
|
||||
$macro['value'] = '';
|
||||
|
||||
$values['parameters'] .= ' _field'.$total_macros.'_';
|
||||
|
||||
$macros[(string) $total_macros] = $macro;
|
||||
break;
|
||||
|
||||
case 'pspz2':
|
||||
// Fill the macros field.
|
||||
$total_macros = $ini_array['plugin_definition']['total_macros_provided'];
|
||||
|
||||
$macros = [];
|
||||
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
|
||||
$label = 'macro_'.$it_macros;
|
||||
|
||||
$macro = [];
|
||||
|
||||
$macro['macro'] = '_field'.$it_macros.'_';
|
||||
$macro['hide'] = $ini_array[$label]['hide'];
|
||||
$macro['desc'] = io_safe_input(
|
||||
$ini_array[$label]['description']
|
||||
);
|
||||
$macro['help'] = io_safe_input(
|
||||
$ini_array[$label]['help']
|
||||
);
|
||||
$macro['value'] = io_safe_input(
|
||||
$ini_array[$label]['value']
|
||||
);
|
||||
|
||||
$macros[(string) $it_macros] = $macro;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($macros) === false) {
|
||||
$values['macros'] = json_encode($macros);
|
||||
}
|
||||
|
||||
$create_id = db_process_sql_insert('tplugin', $values);
|
||||
|
||||
if (empty($create_id) === true) {
|
||||
ui_print_error_message(
|
||||
__('Plug-in Remote Registered unsuccessfull')
|
||||
);
|
||||
ui_print_info_message(
|
||||
__('Please check the syntax of file "plugin_definition.ini"')
|
||||
);
|
||||
} else {
|
||||
for ($ax = 1; $ax <= $ini_array['plugin_definition']['total_modules_provided']; $ax++) {
|
||||
$label = 'module'.$ax;
|
||||
|
||||
$plugin_user = '';
|
||||
if (isset($ini_array[$label]['plugin_user']) === true) {
|
||||
$plugin_user = $ini_array[$label]['plugin_user'];
|
||||
}
|
||||
|
||||
$plugin_pass = '';
|
||||
if (isset($ini_array[$label]['plugin_pass']) === true) {
|
||||
$plugin_pass = $ini_array[$label]['plugin_pass'];
|
||||
}
|
||||
|
||||
$plugin_parameter = '';
|
||||
if (isset($ini_array[$label]['plugin_parameter']) === true) {
|
||||
$plugin_parameter = $ini_array[$label]['plugin_parameter'];
|
||||
}
|
||||
|
||||
$unit = '';
|
||||
if (isset($ini_array[$label]['unit']) === true) {
|
||||
$unit = $ini_array[$label]['unit'];
|
||||
}
|
||||
|
||||
$values = [
|
||||
'name' => io_safe_input($ini_array[$label]['name']),
|
||||
'description' => io_safe_input($ini_array[$label]['description']),
|
||||
'id_group' => $ini_array[$label]['id_group'],
|
||||
'type' => $ini_array[$label]['type'],
|
||||
'max' => ($ini_array[$label]['max'] ?? ''),
|
||||
'min' => ($ini_array[$label]['min'] ?? ''),
|
||||
'module_interval' => ($ini_array[$label]['module_interval'] ?? ''),
|
||||
'id_module_group' => $ini_array[$label]['id_module_group'],
|
||||
'id_modulo' => $ini_array[$label]['id_modulo'],
|
||||
'plugin_user' => io_safe_input($plugin_user),
|
||||
'plugin_pass' => io_safe_input($plugin_pass),
|
||||
'plugin_parameter' => io_safe_input($plugin_parameter),
|
||||
'unit' => io_safe_input($unit),
|
||||
'max_timeout' => ($ini_array[$label]['max_timeout'] ?? ''),
|
||||
'history_data' => ($ini_array[$label]['history_data'] ?? ''),
|
||||
'dynamic_interval' => ($ini_array[$label]['dynamic_interval'] ?? ''),
|
||||
'dynamic_min' => ($ini_array[$label]['dynamic_min'] ?? ''),
|
||||
'dynamic_max' => ($ini_array[$label]['dynamic_max'] ?? ''),
|
||||
'dynamic_two_tailed' => ($ini_array[$label]['dynamic_two_tailed'] ?? ''),
|
||||
'min_warning' => ($ini_array[$label]['min_warning'] ?? ''),
|
||||
'max_warning' => ($ini_array[$label]['max_warning'] ?? ''),
|
||||
'str_warning' => ($ini_array[$label]['str_warning'] ?? ''),
|
||||
'min_critical' => ($ini_array[$label]['min_critical'] ?? ''),
|
||||
'max_critical' => ($ini_array[$label]['max_critical'] ?? ''),
|
||||
'str_critical' => ($ini_array[$label]['str_critical'] ?? ''),
|
||||
'min_ff_event' => ($ini_array[$label]['min_ff_event'] ?? ''),
|
||||
'tcp_port' => ($ini_array[$label]['tcp_port'] ?? ''),
|
||||
'id_plugin' => $create_id,
|
||||
];
|
||||
|
||||
$macros_component = $macros;
|
||||
|
||||
switch ($version) {
|
||||
case 'pspz':
|
||||
// Fixed the static parameters
|
||||
// for
|
||||
// the dinamic parameters of pandoras 5.
|
||||
foreach ($macros_component as $key => $macro) {
|
||||
if ($macro['desc'] === 'Target IP from net') {
|
||||
if (empty($values['ip_target']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['ip_target']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($macro['desc'] === 'Target IP') {
|
||||
if (empty($values['ip_target']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['ip_target']
|
||||
);
|
||||
}
|
||||
} else if ($macro['desc'] === 'Port from net') {
|
||||
if (empty($values['tcp_port']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['tcp_port']
|
||||
);
|
||||
}
|
||||
} else if ($macro['desc'] === 'Port') {
|
||||
if (empty($values['tcp_port']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['tcp_port']
|
||||
);
|
||||
}
|
||||
} else if ($macro['desc'] === 'Username') {
|
||||
if (empty($values['plugin_user']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['plugin_user']
|
||||
);
|
||||
}
|
||||
} else if ($macro['desc'] === 'Password') {
|
||||
if (empty($values['plugin_pass']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['plugin_pass']
|
||||
);
|
||||
}
|
||||
} else if ($macro['desc'] === 'Plug-in Parameters') {
|
||||
if (empty($values['plugin_parameter']) === false) {
|
||||
$macros_component[$key]['value'] = io_safe_input(
|
||||
$values['plugin_parameter']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'pspz2':
|
||||
if ($total_macros > 0) {
|
||||
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
|
||||
$macro = 'macro_'.$it_macros.'_value';
|
||||
|
||||
// Set the value or use the default.
|
||||
if (isset($ini_array[$label][$macro]) === true) {
|
||||
$macros_component[(string) $it_macros]['value'] = io_safe_input(
|
||||
$ini_array[$label][$macro]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($macros_component) === false) {
|
||||
$values['macros'] = json_encode($macros_component);
|
||||
}
|
||||
|
||||
db_process_sql_insert('tnetwork_component', $values);
|
||||
|
||||
ui_print_success_message(
|
||||
__('Module plugin registered').' : '.$ini_array[$label]['name']
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_success_message(
|
||||
__('Plugin').' '.$ini_array['plugin_definition']['name'].' '.__('Registered successfully')
|
||||
);
|
||||
}
|
||||
|
||||
unlink($config['attachment_store'].'/plugin_definition.ini');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clean.
|
||||
Files::rmrf($tmp_path);
|
||||
} else {
|
||||
$error = __('Unable to uncompress uploaded file');
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($uploaded_filename) === true) {
|
||||
if (is_metaconsole() === true && is_management_allowed() === true) {
|
||||
// Keep uploaded file to be transferred to nodes.
|
||||
if (is_dir($config['attachment_store'].'/downloads/') === false) {
|
||||
mkdir($config['attachment_store'].'/downloads/');
|
||||
}
|
||||
|
||||
$keep = move_uploaded_file(
|
||||
$uploaded_filename,
|
||||
$config['attachment_store'].'/downloads/'.$filename
|
||||
);
|
||||
|
||||
if ($keep === false) {
|
||||
$error = __(
|
||||
'Cannot move uploaded file to %s.',
|
||||
$config['attachment_store'].'/downloads/'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Clean temporary files.
|
||||
unlink($uploaded_filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error !== null && $error !== '') {
|
||||
ui_print_error_message($error);
|
||||
} else if ($error === null
|
||||
&& is_management_allowed() === true
|
||||
&& is_metaconsole() === true
|
||||
) {
|
||||
$attachment = '/'.str_replace(
|
||||
$config['homedir'],
|
||||
'',
|
||||
$config['attachment_store']
|
||||
);
|
||||
|
||||
$sc = new Synchronizer();
|
||||
$sc->queueOperation(
|
||||
Synchronizer::OPERATION_REFRESH_PLUGIN,
|
||||
ui_get_full_url(
|
||||
$attachment.'/downloads/'.$filename,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
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,19 @@ 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 OS definitions are read only. Go to %s to manage them.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
|
||||
$table->width = '100%';
|
||||
|
@ -31,11 +59,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 +95,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 +132,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,10 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* OS Edition
|
||||
* Os.
|
||||
*
|
||||
* @category Server
|
||||
* @category Os
|
||||
* @package Pandora FMS
|
||||
* @subpackage Godmode
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
|
@ -26,7 +26,7 @@
|
|||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -40,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');
|
||||
|
@ -57,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) {
|
||||
case 'new':
|
||||
default:
|
||||
$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',
|
||||
|
@ -193,8 +200,8 @@ $buttons = [
|
|||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
],
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
|
@ -260,11 +267,14 @@ if (empty($id_message) === false) {
|
|||
|
||||
switch ($tab) {
|
||||
case 'list':
|
||||
default:
|
||||
include_once $config['homedir'].'/godmode/setup/os.list.php';
|
||||
break;
|
||||
|
||||
case 'builder':
|
||||
include_once $config['homedir'].'/godmode/setup/os.builder.php';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -986,43 +986,21 @@ if ($create_alert || $update_alert) {
|
|||
echo html_print_select(get_priorities(), 'priority', $priority, '', '', '0', false, false, false);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Alert type (e-mail, event etc.)
|
||||
// Alert type (e-mail, event etc.).
|
||||
echo '<tr><td class="datos">'.__('Alert action').'</td><td class="datos">';
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, name
|
||||
FROM talert_actions
|
||||
ORDER BY name',
|
||||
'alert_type',
|
||||
$alert_type,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, dbms_lob.substr(name,4000,1) as name
|
||||
FROM talert_actions
|
||||
ORDER BY dbms_lob.substr(name,4000,1)',
|
||||
'alert_type',
|
||||
$alert_type,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
break;
|
||||
}
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, name
|
||||
FROM talert_actions
|
||||
ORDER BY name',
|
||||
'alert_type',
|
||||
$alert_type,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td class="datos">'.__('Position').'</td><td class="datos">';
|
||||
|
@ -1482,7 +1460,6 @@ function time_changed () {
|
|||
|
||||
$(document).ready (function () {
|
||||
$('#time_threshold').change (time_changed);
|
||||
|
||||
$("input[name=all_delete_box]").change (function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$("input[name='delete_ids[]']").check();
|
||||
|
@ -1491,9 +1468,9 @@ $(document).ready (function () {
|
|||
$("input[name='delete_ids[]']").uncheck();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#alert_type").change (function () {
|
||||
values = Array ();
|
||||
values = Array ();
|
||||
values.push ({
|
||||
name: "page",
|
||||
value: "godmode/alerts/alert_commands"
|
||||
|
@ -1506,7 +1483,6 @@ $(document).ready (function () {
|
|||
name: "id_action",
|
||||
value: this.value
|
||||
});
|
||||
|
||||
values.push ({
|
||||
name: "get_recovery_fields",
|
||||
value: "0"
|
||||
|
@ -1515,44 +1491,28 @@ $(document).ready (function () {
|
|||
values,
|
||||
function (data, status) {
|
||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||
|
||||
original_command = js_html_entity_decode (data["command"]);
|
||||
command_description = js_html_entity_decode (data["description"]);
|
||||
for (i = 1; i <= max_fields; i++) {
|
||||
var old_value = '';
|
||||
// Only keep the value if is provided from hidden (first time)
|
||||
|
||||
// Only keep the value if is provided from hidden (first time).
|
||||
var id_field = $("[name=field" + i + "_value]").attr('id');
|
||||
|
||||
|
||||
if (id_field == "hidden-field" + i + "_value") {
|
||||
old_value = $("[name=field" + i + "_value]").val();
|
||||
}
|
||||
|
||||
|
||||
// If the row is empty, hide de row
|
||||
if (data["fields_rows"][i] == '') {
|
||||
$('#table_macros-field' + i).hide();
|
||||
}
|
||||
else {
|
||||
$('#table_macros-field' + i).replaceWith(data["fields_rows"][i]);
|
||||
|
||||
// The row provided has a predefined class. We delete it
|
||||
|
||||
// The row provided has a predefined class. We delete it.
|
||||
$('#table_macros-field' + i)
|
||||
.removeAttr('class');
|
||||
|
||||
//Remove this to put the help message in alert commands, to do it more general
|
||||
// Add help hint only in first field
|
||||
/*if (i == 1) {
|
||||
var td_content =
|
||||
$('#table_macros-field' + i)
|
||||
.find('td').eq(0);
|
||||
|
||||
td_content
|
||||
.html(
|
||||
td_content.html() +
|
||||
$('#help_snmp_alert_hint').html()
|
||||
);
|
||||
}*/
|
||||
|
||||
$("[name=field" + i + "_value]").val(old_value);
|
||||
$('#table_macros-field').show();
|
||||
}
|
||||
|
@ -1561,17 +1521,17 @@ $(document).ready (function () {
|
|||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
// Charge the fields of the action
|
||||
|
||||
// Charge the fields of the action.
|
||||
$("#alert_type").trigger('change');
|
||||
|
||||
|
||||
$("#submit-delete_button").click (function () {
|
||||
confirmation = confirm("<?php echo __('Are you sure?'); ?>");
|
||||
if (!confirmation) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var added_config = {
|
||||
"selector": "textarea.tiny-mce-editor",
|
||||
"plugins": "preview, print, table, searchreplace, nonbreaking, xhtmlxtras, noneditable",
|
||||
|
|
|
@ -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,51 @@ 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 = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All tags information is read only. Go to %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/component_management'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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 +221,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 +263,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 +279,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 +299,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 +324,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 +347,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 +402,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 +429,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 +436,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 +451,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>
|
||||
|
|
|
@ -70,6 +70,10 @@ if (empty($license) === true) {
|
|||
}
|
||||
|
||||
$mode_str = '';
|
||||
if (isset($mode) === false) {
|
||||
$mode = null;
|
||||
}
|
||||
|
||||
if ($mode === Manager::MODE_ONLINE) {
|
||||
$mode_str = 'online';
|
||||
} else if ($mode === Manager::MODE_OFFLINE) {
|
||||
|
@ -227,6 +231,21 @@ if (is_ajax() !== true) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('800M');
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== -1) {
|
||||
$msg = __(
|
||||
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
|
||||
'memory_limit',
|
||||
'800M'
|
||||
);
|
||||
if (function_exists('ui_print_warning_message') === true) {
|
||||
ui_print_warning_message($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load styles.
|
||||
|
@ -362,21 +381,6 @@ if (is_array($config) === true) {
|
|||
}
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('800M');
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
$msg = __(
|
||||
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
|
||||
'memory_limit',
|
||||
'800M'
|
||||
);
|
||||
if (function_exists('ui_print_warning_message') === true) {
|
||||
ui_print_warning_message($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
$ui = new Manager(
|
||||
((is_array($config) === true) ? $pandora_url : 'http://'.$_SERVER['SERVER_ADDR'].'/'),
|
||||
((is_array($config) === true) ? ui_get_full_url('ajax.php') : ''),
|
||||
|
|
|
@ -941,6 +941,15 @@ class Client
|
|||
$queries = preg_split("/(;\n)|(;\n\r)/", $sql);
|
||||
foreach ($queries as $query) {
|
||||
if (empty($query) !== true) {
|
||||
if (preg_match('/^\s*SOURCE\s+(.*)$/i', $query, $matches) > 0) {
|
||||
$filepath = dirname($mr_file).'/'.$matches[1];
|
||||
if (file_exists($filepath) === true) {
|
||||
$query = file_get_contents($filepath);
|
||||
} else {
|
||||
throw new \Exception('Cannot load file: '.$filepath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($dbh->query($query) === false) {
|
||||
// 1022: Duplicate key in table.
|
||||
// 1050: Table already defined.
|
||||
|
@ -1331,18 +1340,17 @@ class Client
|
|||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
set_error_handler(
|
||||
function ($errno, $errstr) {
|
||||
if (preg_match('/Undefined index/', $errstr) > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \Exception($errstr, $errno);
|
||||
}
|
||||
},
|
||||
(E_ALL ^ E_NOTICE)
|
||||
);
|
||||
|
||||
register_shutdown_function(
|
||||
function () {
|
||||
$error = error_get_last();
|
||||
if (null !== $error) {
|
||||
if (null !== $error
|
||||
&& $error['type'] === (E_ALL ^ E_NOTICE)
|
||||
) {
|
||||
echo __('Failed to analyze package: %s', $error['message']);
|
||||
}
|
||||
}
|
||||
|
@ -1425,7 +1433,8 @@ class Client
|
|||
set_error_handler(
|
||||
function ($errno, $errstr) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
}
|
||||
},
|
||||
(E_ALL ^ E_NOTICE)
|
||||
);
|
||||
|
||||
if ($package === null) {
|
||||
|
|
|
@ -296,7 +296,7 @@ if ($new_user && $config['admin_can_add_user']) {
|
|||
// This attributes are inherited from global configuration
|
||||
$user_info['block_size'] = $config['block_size'];
|
||||
|
||||
if (enterprise_installed() && defined('METACONSOLE')) {
|
||||
if (enterprise_installed() && is_metaconsole() === true) {
|
||||
$user_info['metaconsole_agents_manager'] = 0;
|
||||
$user_info['metaconsole_assigned_server'] = '';
|
||||
$user_info['metaconsole_access_node'] = 0;
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Profiles.
|
||||
*
|
||||
* @category Profiles
|
||||
* @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();
|
||||
|
@ -36,8 +51,8 @@ enterprise_include_once('meta/include/functions_users_meta.php');
|
|||
$tab = get_parameter('tab', 'profile');
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
// Header
|
||||
if (!defined('METACONSOLE')) {
|
||||
// Header.
|
||||
if (is_metaconsole() === false) {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
|
@ -79,15 +94,27 @@ if (!defined('METACONSOLE')) {
|
|||
$sec = 'advanced';
|
||||
}
|
||||
|
||||
|
||||
$delete_profile = (bool) get_parameter('delete_profile');
|
||||
$create_profile = (bool) get_parameter('create_profile');
|
||||
$update_profile = (bool) get_parameter('update_profile');
|
||||
$id_profile = (int) get_parameter('id');
|
||||
|
||||
// Profile deletion
|
||||
if ($delete_profile) {
|
||||
// Delete profile
|
||||
$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 %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Profile deletion.
|
||||
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);
|
||||
if ($ret === false) {
|
||||
|
@ -103,44 +130,44 @@ if ($delete_profile) {
|
|||
$id_profile = 0;
|
||||
}
|
||||
|
||||
// Store the variables when create or update
|
||||
if ($create_profile || $update_profile) {
|
||||
// Store the variables when create or update.
|
||||
if ($is_management_allowed === true && ($create_profile === true || $update_profile === true)) {
|
||||
$name = get_parameter('name');
|
||||
|
||||
// Agents
|
||||
// Agents.
|
||||
$agent_view = (bool) get_parameter('agent_view');
|
||||
$agent_edit = (bool) get_parameter('agent_edit');
|
||||
$agent_disable = (bool) get_parameter('agent_disable');
|
||||
|
||||
// Alerts
|
||||
// Alerts.
|
||||
$alert_edit = (bool) get_parameter('alert_edit');
|
||||
$alert_management = (bool) get_parameter('alert_management');
|
||||
|
||||
// Users
|
||||
// Users.
|
||||
$user_management = (bool) get_parameter('user_management');
|
||||
|
||||
// DB
|
||||
// DB.
|
||||
$db_management = (bool) get_parameter('db_management');
|
||||
|
||||
// Pandora
|
||||
// Pandora.
|
||||
$pandora_management = (bool) get_parameter('pandora_management');
|
||||
|
||||
// Events
|
||||
// Events.
|
||||
$event_view = (bool) get_parameter('event_view');
|
||||
$event_edit = (bool) get_parameter('event_edit');
|
||||
$event_management = (bool) get_parameter('event_management');
|
||||
|
||||
// Reports
|
||||
// Reports.
|
||||
$report_view = (bool) get_parameter('report_view');
|
||||
$report_edit = (bool) get_parameter('report_edit');
|
||||
$report_management = (bool) get_parameter('report_management');
|
||||
|
||||
// Network maps
|
||||
// Network maps.
|
||||
$map_view = (bool) get_parameter('map_view');
|
||||
$map_edit = (bool) get_parameter('map_edit');
|
||||
$map_management = (bool) get_parameter('map_management');
|
||||
|
||||
// Visual console
|
||||
// Visual console.
|
||||
$vconsole_view = (bool) get_parameter('vconsole_view');
|
||||
$vconsole_edit = (bool) get_parameter('vconsole_edit');
|
||||
$vconsole_management = (bool) get_parameter('vconsole_management');
|
||||
|
@ -170,9 +197,9 @@ if ($create_profile || $update_profile) {
|
|||
];
|
||||
}
|
||||
|
||||
// Update profile
|
||||
if ($update_profile) {
|
||||
if ($name) {
|
||||
// Update profile.
|
||||
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) {
|
||||
$info = '{"Name":"'.$name.'",
|
||||
|
@ -216,9 +243,9 @@ if ($update_profile) {
|
|||
$id_profile = 0;
|
||||
}
|
||||
|
||||
// Create profile
|
||||
if ($create_profile) {
|
||||
if ($name) {
|
||||
// Create profile.
|
||||
if ($is_management_allowed === true && $create_profile === true) {
|
||||
if (empty($name) === false) {
|
||||
$ret = db_process_sql_insert('tperfil', $values);
|
||||
|
||||
if ($ret !== false) {
|
||||
|
@ -295,7 +322,9 @@ $table->head['VR'] = 'VR';
|
|||
$table->head['VW'] = 'VW';
|
||||
$table->head['VM'] = 'VM';
|
||||
$table->head['PM'] = 'PM';
|
||||
$table->head['operations'] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head['operations'] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
}
|
||||
|
||||
$table->align = array_fill(1, 11, 'center');
|
||||
|
||||
|
@ -320,7 +349,9 @@ $table->size['VR'] = '10px';
|
|||
$table->size['VW'] = '10px';
|
||||
$table->size['VM'] = '10px';
|
||||
$table->size['PM'] = '10px';
|
||||
$table->size['operations'] = '5%';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->size['operations'] = '5%';
|
||||
}
|
||||
|
||||
$profiles = db_get_all_rows_in_table('tperfil');
|
||||
if ($profiles === false) {
|
||||
|
@ -337,59 +368,74 @@ $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>';
|
||||
$data['AR'] = ($profile['agent_view'] ? $img : '');
|
||||
$data['AW'] = ($profile['agent_edit'] ? $img : '');
|
||||
$data['AD'] = ($profile['agent_disable'] ? $img : '');
|
||||
$data['LW'] = ($profile['alert_edit'] ? $img : '');
|
||||
$data['LM'] = ($profile['alert_management'] ? $img : '');
|
||||
$data['UM'] = ($profile['user_management'] ? $img : '');
|
||||
$data['DM'] = ($profile['db_management'] ? $img : '');
|
||||
$data['ER'] = ($profile['event_view'] ? $img : '');
|
||||
$data['EW'] = ($profile['event_edit'] ? $img : '');
|
||||
$data['EM'] = ($profile['event_management'] ? $img : '');
|
||||
$data['RR'] = ($profile['report_view'] ? $img : '');
|
||||
$data['RW'] = ($profile['report_edit'] ? $img : '');
|
||||
$data['RM'] = ($profile['report_management'] ? $img : '');
|
||||
$data['MR'] = ($profile['map_view'] ? $img : '');
|
||||
$data['MW'] = ($profile['map_edit'] ? $img : '');
|
||||
$data['MM'] = ($profile['map_management'] ? $img : '');
|
||||
$data['VR'] = ($profile['vconsole_view'] ? $img : '');
|
||||
$data['VW'] = ($profile['vconsole_edit'] ? $img : '');
|
||||
$data['VM'] = ($profile['vconsole_management'] ? $img : '');
|
||||
$data['PM'] = ($profile['pandora_management'] ? $img : '');
|
||||
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 : '';
|
||||
$data['LW'] = (empty($profile['alert_edit']) === false) ? $img : '';
|
||||
$data['LM'] = (empty($profile['alert_management']) === false) ? $img : '';
|
||||
$data['UM'] = (empty($profile['user_management']) === false) ? $img : '';
|
||||
$data['DM'] = (empty($profile['db_management']) === false) ? $img : '';
|
||||
$data['ER'] = (empty($profile['event_view']) === false) ? $img : '';
|
||||
$data['EW'] = (empty($profile['event_edit']) === false) ? $img : '';
|
||||
$data['EM'] = (empty($profile['event_management']) === false) ? $img : '';
|
||||
$data['RR'] = (empty($profile['report_view']) === false) ? $img : '';
|
||||
$data['RW'] = (empty($profile['report_edit']) === false) ? $img : '';
|
||||
$data['RM'] = (empty($profile['report_management']) === false) ? $img : '';
|
||||
$data['MR'] = (empty($profile['map_view']) === false) ? $img : '';
|
||||
$data['MW'] = (empty($profile['map_edit']) === false) ? $img : '';
|
||||
$data['MM'] = (empty($profile['map_management']) === false) ? $img : '';
|
||||
$data['VR'] = (empty($profile['vconsole_view']) === false) ? $img : '';
|
||||
$data['VW'] = (empty($profile['vconsole_edit']) === false) ? $img : '';
|
||||
$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,
|
||||
['class' => 'invert_filter']
|
||||
[
|
||||
'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',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
if (isset($data) === true) {
|
||||
html_print_table($table);
|
||||
} else {
|
||||
echo "<div class='nf'>".__('There are no defined profiles').'</div>';
|
||||
}
|
||||
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&pure='.$pure.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('new_profile', 1);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&pure='.$pure.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('new_profile', 1);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Users.
|
||||
*
|
||||
* @category Users
|
||||
* @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();
|
||||
|
@ -112,6 +127,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -132,6 +151,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -152,6 +175,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -171,8 +198,8 @@ switch ($sortField) {
|
|||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
// Header.
|
||||
if (is_metaconsole() === true) {
|
||||
user_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
|
@ -234,9 +261,9 @@ if (defined('METACONSOLE')) {
|
|||
|
||||
$disable_user = get_parameter('disable_user', false);
|
||||
if ((bool) get_parameter('user_del', false) === true) {
|
||||
// delete user
|
||||
// Delete user.
|
||||
$id_user = get_parameter('delete_user', 0);
|
||||
// Only allow delete user if is not the actual user
|
||||
// Only allow delete user if is not the actual user.
|
||||
if ($id_user != $config['id_user']) {
|
||||
$user_row = users_get_user_by_id($id_user);
|
||||
|
||||
|
@ -255,13 +282,13 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
__('There was a problem deleting the user')
|
||||
);
|
||||
|
||||
// Delete the user in all the consoles
|
||||
if (defined('METACONSOLE') && isset($_GET['delete_all'])) {
|
||||
// Delete the user in all the consoles.
|
||||
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
// Connect to the remote console.
|
||||
if (metaconsole_connect($server) === NOERR) {
|
||||
// Delete the user
|
||||
// Delete the user.
|
||||
$result = delete_user($id_user);
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
|
@ -274,7 +301,7 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// Log to the metaconsole too
|
||||
// Log to the metaconsole too.
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
|
@ -293,7 +320,7 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
ui_print_error_message(__('There was a problem deleting the user'));
|
||||
}
|
||||
} else if (isset($_GET['profile_del'])) {
|
||||
// delete profile
|
||||
// Delete profile.
|
||||
$id_profile = (int) get_parameter_post('delete_profile');
|
||||
$result = profile_delete_profile($id_profile);
|
||||
ui_print_result_message(
|
||||
|
@ -302,7 +329,7 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
__('There was a problem deleting the profile')
|
||||
);
|
||||
} else if ($disable_user !== false) {
|
||||
// disable_user
|
||||
// Disable_user.
|
||||
$id_user = get_parameter('id', 0);
|
||||
|
||||
if ($id_user !== 0) {
|
||||
|
@ -367,8 +394,21 @@ $table->data[0][4] = html_print_submit_button(
|
|||
true
|
||||
);
|
||||
|
||||
$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 %s to manage it.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$table->width = '96%';
|
||||
$form_filter = "<form class='filters_form' method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
|
@ -415,21 +455,24 @@ $table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_do
|
|||
$table->head[3] = __('Admin');
|
||||
$table->head[4] = __('Profile / Group');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
if (!defined('METACONSOLE')) {
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$table->align[2] = '';
|
||||
$table->size[2] = '150px';
|
||||
}
|
||||
|
||||
$table->align[3] = 'left';
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->size[6] = '110px';
|
||||
} else {
|
||||
$table->size[6] = '85px';
|
||||
}
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
$table->valign[2] = 'top';
|
||||
|
@ -457,7 +500,7 @@ if ($user_is_admin) {
|
|||
}
|
||||
}
|
||||
|
||||
// Filter the users
|
||||
// Filter the users.
|
||||
if ($search) {
|
||||
foreach ($info1 as $iterator => $user_info) {
|
||||
$found = false;
|
||||
|
@ -498,7 +541,7 @@ if ($search) {
|
|||
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
ui_pagination(count($info));
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
|
@ -515,18 +558,22 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
// User profiles.
|
||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $user_id);
|
||||
$user_profiles = db_get_all_rows_field_filter(
|
||||
'tusuario_perfil',
|
||||
'id_usuario',
|
||||
$user_id
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles = [];
|
||||
foreach ($group_um as $key => $value) {
|
||||
if (isset($user_profiles_aux[$key])) {
|
||||
if (isset($user_profiles_aux[$key]) === true) {
|
||||
$user_profiles[$key] = $user_profiles_aux[$key];
|
||||
unset($user_profiles_aux[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($user_profiles_aux)) {
|
||||
if (empty($user_profiles_aux) === false) {
|
||||
$user_info['not_delete'] = 1;
|
||||
}
|
||||
|
||||
|
@ -537,7 +584,7 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
$cont++;
|
||||
|
||||
// Manual pagination due the complicated process of the ACL data
|
||||
// Manual pagination due the complicated process of the ACL data.
|
||||
if ($cont <= $offset) {
|
||||
continue;
|
||||
}
|
||||
|
@ -560,7 +607,13 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
$iterator++;
|
||||
|
||||
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
if ($is_management_allowed === true
|
||||
&& ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| isset($group_um[0]) || (isset($user_info['edit'])
|
||||
&& $user_info['edit']))))
|
||||
) {
|
||||
$data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
|
@ -627,8 +680,12 @@ foreach ($info as $user_id => $user_info) {
|
|||
$total_profile++;
|
||||
}
|
||||
|
||||
if (isset($user_info['not_delete'])) {
|
||||
$data[4] .= __('Other profiles are also assigned.').ui_print_help_tip(__('Other profiles you cannot manage are also assigned. These profiles are not shown. You cannot enable/disable or delete this user.'), true);
|
||||
if (isset($user_info['not_delete']) === true) {
|
||||
$data[4] .= __('Other profiles are also assigned.');
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('Other profiles you cannot manage are also assigned. These profiles are not shown. You cannot enable/disable or delete this user.'),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[4] .= '</div>';
|
||||
|
@ -638,100 +695,83 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
$data[5] = ui_print_string_substr($user_info['comments'], 24, true);
|
||||
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '';
|
||||
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
// Disable / Enable user.
|
||||
if (isset($user_info['not_delete']) === false) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$toDoString = __('Disable');
|
||||
$toDoAction = '1';
|
||||
$toDoImage = 'images/lightbulb.png';
|
||||
} else {
|
||||
$toDoString = __('Enable');
|
||||
$toDoAction = '0';
|
||||
$toDoImage = 'images/lightbulb_off.png';
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '';
|
||||
if ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| isset($group_um[0])
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| (isset($user_info['edit']) && $user_info['edit'])))
|
||||
) {
|
||||
// Disable / Enable user.
|
||||
if (isset($user_info['not_delete']) === false) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$toDoString = __('Disable');
|
||||
$toDoAction = '1';
|
||||
$toDoImage = 'images/lightbulb.png';
|
||||
} else {
|
||||
$toDoString = __('Enable');
|
||||
$toDoAction = '0';
|
||||
$toDoImage = 'images/lightbulb_off.png';
|
||||
}
|
||||
|
||||
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'disable_user',
|
||||
$toDoAction,
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_disable_enable',
|
||||
$toDoImage,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'data-title' => $toDoString,
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
|
||||
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
// Edit user.
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id',
|
||||
'id_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'disable_user',
|
||||
$toDoAction,
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_disable_enable',
|
||||
$toDoImage,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'data-title' => $toDoString,
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
|
||||
// Edit user.
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'edit_user',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_edit_user',
|
||||
'images/config.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Edit'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && isset($user_info['not_delete']) === false) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'user_del',
|
||||
'edit_user',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_delete_user',
|
||||
'images/cross.png',
|
||||
'submit_edit_user',
|
||||
'images/config.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Delete'),
|
||||
'data-title' => __('Edit'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
if ($config['admin_can_delete_user']
|
||||
&& $user_info['id_user'] != $config['id_user']
|
||||
&& isset($user_info['not_delete']) === false
|
||||
) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
|
@ -743,28 +783,43 @@ foreach ($info as $user_id => $user_info) {
|
|||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_all',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_delete_all',
|
||||
'images/cross_double.png',
|
||||
'',
|
||||
'submit_delete_user',
|
||||
'images/cross.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Delete from all consoles'),
|
||||
'data-title' => __('Delete'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'user_del',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_all',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode.
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -776,13 +831,15 @@ ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bott
|
|||
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
unset($table);
|
||||
if ($config['admin_can_add_user'] !== false) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'">';
|
||||
html_print_input_hidden('new_user', 1);
|
||||
html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
} else {
|
||||
echo '<i>'.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).'</i>';
|
||||
if ($is_management_allowed === true) {
|
||||
if ($config['admin_can_add_user'] !== false) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'">';
|
||||
html_print_input_hidden('new_user', 1);
|
||||
html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
} else {
|
||||
echo '<i>'.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).'</i>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -1599,7 +1599,6 @@ if ($get_extended_event) {
|
|||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: '.json_encode($event).',
|
||||
filter: '.json_encode($filter).'
|
||||
},
|
||||
dataType : "html",
|
||||
success: function (data) {
|
||||
|
|
|
@ -29,18 +29,36 @@
|
|||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once 'functions_api.php';
|
||||
require '../vendor/autoload.php';
|
||||
global $config;
|
||||
|
||||
define('DEBUG', 0);
|
||||
define('VERBOSE', 0);
|
||||
|
||||
// Load extra classes.
|
||||
require_once $config['homedir'].'/vendor/autoload.php';
|
||||
|
||||
// Enterprise support.
|
||||
if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php') === true) {
|
||||
include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php';
|
||||
}
|
||||
|
||||
// TESTING THE UPDATE MANAGER.
|
||||
enterprise_include_once('load_enterprise.php');
|
||||
enterprise_include_once('include/functions_enterprise_api.php');
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Sometimes input is badly retrieved from caller...
|
||||
if (empty($_REQUEST) === true) {
|
||||
$data = explode('&', urldecode(file_get_contents('php://input')));
|
||||
foreach ($data as $d) {
|
||||
$r = explode('=', $d, 2);
|
||||
$_POST[$r[0]] = $r[1];
|
||||
$_GET[$r[0]] = $r[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Get the parameters and parse if necesary.
|
||||
$op = get_parameter('op');
|
||||
$op2 = get_parameter('op2');
|
||||
|
@ -85,8 +103,21 @@ if ($info == 'version') {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (isInACL($ipOrigin)) {
|
||||
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||
if (empty($apiPassword) === true
|
||||
|| (empty($apiPassword) === false && $api_password === $apiPassword)
|
||||
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|
||||
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
|
||||
) {
|
||||
// Allow internal direct node -> metaconsole connection
|
||||
// or node -> own console connection.
|
||||
$config['__internal_call'] = true;
|
||||
$config['id_usuario'] = 'admin';
|
||||
// Compat.
|
||||
$config['id_user'] = 'admin';
|
||||
$correctLogin = true;
|
||||
} else if ((bool) isInACL($ipOrigin) === true) {
|
||||
// External access.
|
||||
if (empty($apiPassword) === true || (empty($apiPassword) === false && $api_password === $apiPassword)) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
|
@ -262,7 +293,7 @@ if ($correctLogin) {
|
|||
break;
|
||||
|
||||
case 'event':
|
||||
// Preventive check for users if not available write events
|
||||
// Preventive check for users if not available write events.
|
||||
if (! check_acl($config['id_user'], $event['id_grupo'], 'EW')) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
defined('METACONSOLE')
|
||||
);
|
||||
|
||||
if ($return === 'error_permissions') {
|
||||
if ($result === 'error_permissions') {
|
||||
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
|
||||
return false;
|
||||
}
|
||||
|
@ -344,25 +344,12 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
&& (isset($config['ad_advanced_config'])
|
||||
&& $config['ad_advanced_config'])
|
||||
) {
|
||||
if (defined('METACONSOLE')) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('meta/include/functions_groups_meta.php');
|
||||
|
||||
$return = groups_meta_synchronizing();
|
||||
|
||||
if ($return['group_create_err'] > 0 || $return['group_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the group synchronizing');
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = meta_tags_synchronizing();
|
||||
if ($return['tag_create_err'] > 0 || $return['tag_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the tag synchronizing');
|
||||
return false;
|
||||
}
|
||||
if (is_management_allowed() === false) {
|
||||
$config['auth_error'] = __('Please, login into metaconsole first');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the user
|
||||
// Create the user.
|
||||
if (enterprise_hook(
|
||||
'prepare_permissions_groups_of_user_ad',
|
||||
[
|
||||
|
@ -377,53 +364,47 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
]
|
||||
) === false
|
||||
) {
|
||||
$config['auth_error'] = __(
|
||||
'User not found in database
|
||||
or incorrect password'
|
||||
);
|
||||
|
||||
$config['auth_error'] = __('User not found in database or incorrect password');
|
||||
return false;
|
||||
}
|
||||
} else if ($config['auth'] === 'ldap') {
|
||||
if (defined('METACONSOLE')) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('meta/include/functions_groups_meta.php');
|
||||
|
||||
$return = groups_meta_synchronizing();
|
||||
|
||||
if ($return['group_create_err'] > 0 || $return['group_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the group synchronizing');
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = meta_tags_synchronizing();
|
||||
if ($return['tag_create_err'] > 0 || $return['tag_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the tag synchronizing');
|
||||
return false;
|
||||
}
|
||||
if (is_management_allowed() === false) {
|
||||
$config['auth_error'] = __('Please, login into metaconsole first');
|
||||
return false;
|
||||
}
|
||||
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if (empty($permissions)) {
|
||||
if (empty($permissions) === true) {
|
||||
$config['auth_error'] = __('User not found in database or incorrect password');
|
||||
return false;
|
||||
} else {
|
||||
$user_info['fullname'] = $sr['cn'][0];
|
||||
$user_info['email'] = $sr['mail'][0];
|
||||
|
||||
// Create the user
|
||||
$create_user = create_user_and_permisions_ldap($login, $pass, $user_info, $permissions, defined('METACONSOLE'));
|
||||
// Create the user.
|
||||
$create_user = create_user_and_permisions_ldap(
|
||||
$login,
|
||||
$pass,
|
||||
$user_info,
|
||||
$permissions,
|
||||
is_metaconsole()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$user_info = [
|
||||
'fullname' => $login,
|
||||
'comments' => 'Imported from '.$config['auth'],
|
||||
];
|
||||
if (is_metaconsole() && $config['auth'] === 'ad') {
|
||||
if (is_metaconsole() === true && $config['auth'] === 'ad') {
|
||||
$user_info['metaconsole_access_node'] = $config['ad_adv_user_node'];
|
||||
}
|
||||
|
||||
// Create the user in the local database
|
||||
if (is_management_allowed() === false) {
|
||||
$config['auth_error'] = __('Please, login into metaconsole first');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the user in the local database.
|
||||
if (create_user($login, $pass, $user_info) === false) {
|
||||
$config['auth_error'] = __('User not found in database or incorrect password');
|
||||
return false;
|
||||
|
@ -436,61 +417,6 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
false,
|
||||
$config['default_assign_tags']
|
||||
);
|
||||
// TODO: Check the creation in the nodes
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('meta/include/functions_groups_meta.php');
|
||||
|
||||
$return = groups_meta_synchronizing();
|
||||
|
||||
if ($return['group_create_err'] > 0 || $return['group_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the group synchronizing');
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = meta_tags_synchronizing();
|
||||
if ($return['tag_create_err'] > 0 || $return['tag_update_err'] > 0) {
|
||||
$config['auth_error'] = __('Fail the tag synchronizing');
|
||||
return false;
|
||||
}
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
$perfil_maestro = db_get_row(
|
||||
'tperfil',
|
||||
'id_perfil',
|
||||
$config['default_remote_profile']
|
||||
);
|
||||
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
if (!profile_exist($perfil_maestro['name'])) {
|
||||
unset($perfil_maestro['id_perfil']);
|
||||
$id_profile = db_process_sql_insert('tperfil', $perfil_maestro);
|
||||
} else {
|
||||
$id_profile = db_get_value('id_perfil', 'tperfil', 'name', $perfil_maestro['name']);
|
||||
}
|
||||
|
||||
if ($config['auth'] === 'ad') {
|
||||
unset($user_info['metaconsole_access_node']);
|
||||
$user_info['not_login'] = (int) !$config['ad_adv_user_node'];
|
||||
}
|
||||
|
||||
if (create_user($login, $pass, $user_info) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile_create_user_profile(
|
||||
$login,
|
||||
$id_profile,
|
||||
$config['default_remote_group'],
|
||||
false,
|
||||
$config['default_assign_tags']
|
||||
);
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $login;
|
||||
|
@ -809,7 +735,14 @@ function ldap_process_user_login($login, $password)
|
|||
}
|
||||
|
||||
// Connect to the LDAP server
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
if (stripos($config['ldap_server'], 'ldap://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldaps://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldapi://') !== false
|
||||
) {
|
||||
$ds = @ldap_connect($config['ldap_server'].':'.$config['ldap_port']);
|
||||
} else {
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
}
|
||||
|
||||
if (!$ds) {
|
||||
$config['auth_error'] = 'Error connecting to LDAP server';
|
||||
|
@ -1467,7 +1400,7 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
|
|||
}
|
||||
|
||||
if (!empty($ldap_admin_pass)) {
|
||||
$ldap_admin_pass = ' -w '.$ldap_admin_pass;
|
||||
$ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass);
|
||||
}
|
||||
|
||||
$dn = " -b '".$dn."'";
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
* ============================================================================
|
||||
*/
|
||||
|
||||
use PandoraFMS\Tools\Files;
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_db.php';
|
||||
|
@ -808,7 +810,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.LICENSE.LIMITED',
|
||||
'title' => __('Limited mode.'),
|
||||
'message' => io_safe_output($config['limited_mode']),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -834,7 +836,7 @@ class ConsoleSupervisor
|
|||
$msg,
|
||||
$days_to_expiry
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
} else if ($days_to_expiry < 0) {
|
||||
|
@ -852,7 +854,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => $msg,
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
return false;
|
||||
|
@ -929,7 +931,7 @@ class ConsoleSupervisor
|
|||
'Directory %s is not writable. Please, configure corresponding permissions.',
|
||||
$config['attachment_store']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -951,7 +953,7 @@ class ConsoleSupervisor
|
|||
'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
|
||||
$config['num_files_attachment']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -985,7 +987,7 @@ class ConsoleSupervisor
|
|||
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -1004,7 +1006,7 @@ class ConsoleSupervisor
|
|||
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/conf'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1022,7 +1024,7 @@ class ConsoleSupervisor
|
|||
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/collections'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1040,7 +1042,7 @@ class ConsoleSupervisor
|
|||
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/md5'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1071,7 +1073,7 @@ class ConsoleSupervisor
|
|||
$MAX_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1094,7 +1096,7 @@ class ConsoleSupervisor
|
|||
$MAX_BADXML_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1186,7 +1188,7 @@ class ConsoleSupervisor
|
|||
$modules_queued,
|
||||
$queue['queued_modules']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1322,7 +1324,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
|
||||
'title' => $msg,
|
||||
'message' => $description,
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1634,7 +1636,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HISTORYDB',
|
||||
'title' => __('Historical database not available'),
|
||||
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1681,7 +1683,7 @@ class ConsoleSupervisor
|
|||
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
|
||||
io_safe_output(get_product_name())
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1741,7 +1743,7 @@ class ConsoleSupervisor
|
|||
'Historical database maintenance problem.'
|
||||
),
|
||||
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1780,7 +1782,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HISTORYDB.MR',
|
||||
'title' => __('Historical database MR mismatch'),
|
||||
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1821,7 +1823,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
||||
'title' => __('Log collector cannot connect to ElasticSearch'),
|
||||
'message' => __('ElasticSearch is not available using current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=log'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1891,7 +1893,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
||||
'title' => __('Metaconsole DB is not available.'),
|
||||
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1920,7 +1922,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.DOWNTIME',
|
||||
'title' => __('Scheduled downtime running.'),
|
||||
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
|
||||
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -2081,7 +2083,7 @@ class ConsoleSupervisor
|
|||
date('M j, G:i:s ', $next_downtime_begin),
|
||||
date('M j, G:i:s ', $next_downtime_end)
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
|
||||
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -2142,7 +2144,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
||||
'title' => __('Default password for "Admin" user has not been changed'),
|
||||
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'),
|
||||
'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2178,7 +2180,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.MISC.FONTPATH',
|
||||
'title' => __('Default font doesn\'t exist'),
|
||||
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2205,7 +2207,7 @@ class ConsoleSupervisor
|
|||
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file',
|
||||
get_product_name()
|
||||
),
|
||||
'url' => ui_get_full_url('index.php'),
|
||||
'url' => '__url__/index.php',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2228,7 +2230,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
|
||||
'title' => __('Event storm protection is enabled.'),
|
||||
'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2255,7 +2257,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
||||
'title' => __('Failed to retrieve updates, please configure utility'),
|
||||
'message' => $message,
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2275,7 +2277,7 @@ class ConsoleSupervisor
|
|||
get_product_name()
|
||||
),
|
||||
'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2313,7 +2315,7 @@ class ConsoleSupervisor
|
|||
'There is one or more minor releases available. <a id="aviable_updates" target="blank" href="%s">.About minor release update</a>.',
|
||||
$url
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2362,7 +2364,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||
'message' => __($message_conf_cron),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2394,6 +2396,10 @@ class ConsoleSupervisor
|
|||
return;
|
||||
}
|
||||
|
||||
// Only ask for messages once every 2 hours.
|
||||
$future = (time() + 2 * SECONDS_1HOUR);
|
||||
config_update_value('last_um_check', $future);
|
||||
|
||||
$messages = update_manager_get_messages();
|
||||
if (is_array($messages) === true) {
|
||||
$source_id = get_notification_source_id(
|
||||
|
@ -2462,7 +2468,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2507,7 +2513,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
|
||||
'title' => __('AllowOverride is disabled'),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php'),
|
||||
'url' => '__url__/index.php',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2553,7 +2559,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HAMASTER.MESSAGE',
|
||||
'title' => __('Desynchronized operation on the node '.$node['host']),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2645,13 +2651,15 @@ class ConsoleSupervisor
|
|||
{
|
||||
global $config;
|
||||
|
||||
if ((int) $config['clean_phantomjs_cache'] !== 1) {
|
||||
if (isset($config['clean_phantomjs_cache']) !== true
|
||||
|| (int) $config['clean_phantomjs_cache'] !== 1
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cache_dir = $config['homedir'].'/attachment/cache';
|
||||
if (is_dir($cache_dir) === true) {
|
||||
rrmdir($cache_dir);
|
||||
Files::rmrf($cache_dir);
|
||||
}
|
||||
|
||||
// Clean process has ended.
|
||||
|
|
|
@ -197,8 +197,11 @@ class TreeGroupEdition extends TreeGroup
|
|||
$group_stats[$group['gid']] = $this->getProcessedItem(
|
||||
$group_stats[$group['gid']]
|
||||
);
|
||||
$group_stats[$group['gid']]['delete']['messages'] = $messages;
|
||||
$group_stats[$group['gid']]['edit'] = 1;
|
||||
if (is_management_allowed() === true) {
|
||||
$group_stats[$group['gid']]['delete']['messages'] = $messages;
|
||||
$group_stats[$group['gid']]['edit'] = 1;
|
||||
}
|
||||
|
||||
$group_stats[$group['gid']]['alerts'] = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -1,38 +1,54 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; 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.
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Config
|
||||
* Configuraton sample file.
|
||||
*
|
||||
* @category Config
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Default values
|
||||
// $config["dbname"]="pandora";
|
||||
// $config["dbuser"]="pandora";
|
||||
// $config["dbpass"]="pandora";
|
||||
// $config["dbhost"]="localhost";
|
||||
// This is used for reporting, please add "/" character at the end
|
||||
// $config["homedir"]="/var/www/pandora_console/";
|
||||
// $config["homeurl"]="/pandora_console/";
|
||||
// $config["auth"]["scheme"] = "mysql";
|
||||
|
||||
/**
|
||||
* Do not display any ERROR
|
||||
/*
|
||||
* Default values
|
||||
* $config["dbname"]="pandora";
|
||||
* $config["dbuser"]="pandora";
|
||||
* $config["dbpass"]="pandora";
|
||||
* $config["dbhost"]="localhost";
|
||||
*
|
||||
*
|
||||
* This is used for reporting, please add "/" character at the end
|
||||
* $config["homedir"]="/var/www/pandora_console/";
|
||||
* $config["homeurl"]="/pandora_console/";
|
||||
* $config["auth"]["scheme"] = "mysql";
|
||||
*/
|
||||
|
||||
// By default report any error but notices.
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
/*
|
||||
* Uncomment to display only critical errors.
|
||||
* error_reporting(E_ERROR);
|
||||
* Uncomment to display none errors.
|
||||
* error_reporting(0);
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Display ALL errors
|
||||
// error_reporting(E_ERROR);
|
||||
$ownDir = dirname(__FILE__).DIRECTORY_SEPARATOR;
|
||||
require $ownDir.'config_process.php';
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210712';
|
||||
$pandora_version = 'v7.0NG.755';
|
||||
$build_version = 'PC210809';
|
||||
$pandora_version = 'v7.0NG.756';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -11,8 +11,28 @@
|
|||
// 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.
|
||||
function mysql_connect_db($host=null, $db=null, $user=null, $pass=null, $port=null, $charset=null)
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Connect db
|
||||
*
|
||||
* @param string $host Host.
|
||||
* @param string $db Db.
|
||||
* @param string $user User.
|
||||
* @param string $pass Pass.
|
||||
* @param string $port Port.
|
||||
* @param string $charset Charset.
|
||||
*
|
||||
* @return mysqli|false
|
||||
*/
|
||||
function mysql_connect_db(
|
||||
$host=null,
|
||||
$db=null,
|
||||
$user=null,
|
||||
$pass=null,
|
||||
$port=null,
|
||||
$charset=null
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if ($host === null) {
|
||||
|
@ -140,15 +160,23 @@ function mysql_db_get_all_rows_sql($sql, $search_history_db=false, $cache=true,
|
|||
/**
|
||||
* Get the first value of the first row of a table in the database.
|
||||
*
|
||||
* @param string Field name to get
|
||||
* @param string Table to retrieve the data
|
||||
* @param string Field to filter elements
|
||||
* @param string Condition the field must have
|
||||
* @param string $field Field name to get.
|
||||
* @param string $table Table to retrieve the data.
|
||||
* @param string $field_search Field to filter elements.
|
||||
* @param string $condition Condition the field must have.
|
||||
* @param boolean $search_history_db Search in historical db.
|
||||
* @param boolean $cache Enable cache or not.
|
||||
*
|
||||
* @return mixed Value of first column of the first row. False if there were no row.
|
||||
*/
|
||||
function mysql_db_get_value($field, $table, $field_search=1, $condition=1, $search_history_db=false)
|
||||
{
|
||||
function mysql_db_get_value(
|
||||
$field,
|
||||
$table,
|
||||
$field_search=1,
|
||||
$condition=1,
|
||||
$search_history_db=false,
|
||||
$cache=true
|
||||
) {
|
||||
if (is_int($condition)) {
|
||||
$sql = sprintf(
|
||||
'SELECT %s FROM %s WHERE %s = %d LIMIT 1',
|
||||
|
@ -175,7 +203,7 @@ function mysql_db_get_value($field, $table, $field_search=1, $condition=1, $sear
|
|||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -371,6 +399,10 @@ function mysql_db_process_sql($sql, $rettype='affected_rows', $dbconnection='',
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isset($config['dbcache']) === true) {
|
||||
$cache = $config['dbcache'];
|
||||
}
|
||||
|
||||
if ($cache && ! empty($sql_cache[$sql_cache['id']][$sql])) {
|
||||
$retval = $sql_cache[$sql_cache['id']][$sql];
|
||||
$sql_cache['saved'][$sql_cache['id']]++;
|
||||
|
@ -814,10 +846,10 @@ function mysql_db_get_value_sql($sql, $dbconnection=false)
|
|||
*
|
||||
* @return mixed The first row of the result or false
|
||||
*/
|
||||
function mysql_db_get_row_sql($sql, $search_history_db=false)
|
||||
function mysql_db_get_row_sql($sql, $search_history_db=false, $cache=true)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -1506,3 +1538,118 @@ function db_run_sql_file($location)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts multiples strings into database.
|
||||
*
|
||||
* @param string $table Table to insert into.
|
||||
* @param mixed $values A single value or array of values to insert
|
||||
* (can be a multiple amount of rows).
|
||||
* @param boolean $only_query Sql string.
|
||||
*
|
||||
* @return mixed False in case of error or invalid values passed.
|
||||
* Affected rows otherwise.
|
||||
*/
|
||||
function mysql_db_process_sql_insert_multiple($table, $values, $only_query)
|
||||
{
|
||||
// Empty rows or values not processed.
|
||||
if (empty($values) === true || is_array($values) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = sprintf('INSERT INTO `%s`', $table);
|
||||
|
||||
$j = 1;
|
||||
$max_total = count($values);
|
||||
foreach ($values as $key => $value) {
|
||||
$fields = [];
|
||||
$values_str = '';
|
||||
$i = 1;
|
||||
$max = count($value);
|
||||
foreach ($value as $k => $v) {
|
||||
if ($j === 1) {
|
||||
// Add the correct escaping to values.
|
||||
$field = sprintf('`%s`', $k);
|
||||
array_push($fields, $field);
|
||||
}
|
||||
|
||||
if (isset($v) === false) {
|
||||
$values_str .= 'NULL';
|
||||
} else if (is_int($v) || is_bool($v)) {
|
||||
$values_str .= sprintf('%d', $v);
|
||||
} else if (is_float($v) || is_double($v)) {
|
||||
$values_str .= sprintf('%f', $v);
|
||||
} else {
|
||||
$values_str .= sprintf("'%s'", $v);
|
||||
}
|
||||
|
||||
if ($i < $max) {
|
||||
$values_str .= ',';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($j === 1) {
|
||||
$query .= sprintf(' (%s) VALUES', implode(', ', $fields));
|
||||
}
|
||||
|
||||
$query .= ' ('.$values_str.')';
|
||||
|
||||
if ($j < $max_total) {
|
||||
$query .= ',';
|
||||
}
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
if ($only_query === true) {
|
||||
$result = $query;
|
||||
} else {
|
||||
$result = db_process_sql($query);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates multiples strings into database.
|
||||
*
|
||||
* @param string $table Table to update into.
|
||||
* @param mixed $values A single value or array of values to update
|
||||
* (can be a multiple amount of rows).
|
||||
* @param boolean $only_query Sql string.
|
||||
*
|
||||
* @return mixed False in case of error or invalid values passed.
|
||||
* Affected rows otherwise.
|
||||
*/
|
||||
function mysql_db_process_sql_update_multiple($table, $values, $only_query)
|
||||
{
|
||||
// Empty rows or values not processed.
|
||||
if (empty($values) === true || is_array($values) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$res = [];
|
||||
foreach ($values as $field => $update) {
|
||||
$query = sprintf('UPDATE `%s` SET', $table);
|
||||
$query .= sprintf(' `%s` = CASE `%s`', $field, $field);
|
||||
foreach ($update as $where => $set) {
|
||||
$query .= sprintf(' WHEN "%s" THEN "%s"', $where, $set);
|
||||
}
|
||||
|
||||
$query .= sprintf(' ELSE `%s` END', $field);
|
||||
$query .= sprintf(' WHERE `%s` IN (%s)', $field, '"'.implode('","', array_keys($update)).'"');
|
||||
|
||||
if ($only_query === true) {
|
||||
$res[] = $query;
|
||||
} else {
|
||||
$res['table'] = $table;
|
||||
$res['fields'][$field] = db_process_sql($query);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -72,15 +72,23 @@ function oracle_connect_db($host=null, $db=null, $user=null, $pass=null, $port=n
|
|||
/**
|
||||
* Get the first value of the first row of a table in the database.
|
||||
*
|
||||
* @param string Field name to get
|
||||
* @param string Table to retrieve the data
|
||||
* @param string Field to filter elements
|
||||
* @param string Condition the field must have
|
||||
* @param string $field Field name to get.
|
||||
* @param string $table Table to retrieve the data.
|
||||
* @param string $field_search Field to filter elements.
|
||||
* @param string $condition Condition the field must have.
|
||||
* @param boolean $search_history_db Search in historical db.
|
||||
* @param boolean $cache Enable cache or not.
|
||||
*
|
||||
* @return mixed Value of first column of the first row. False if there were no row.
|
||||
*/
|
||||
function oracle_db_get_value($field, $table, $field_search=1, $condition=1, $search_history_db=false)
|
||||
{
|
||||
function oracle_db_get_value(
|
||||
$field,
|
||||
$table,
|
||||
$field_search=1,
|
||||
$condition=1,
|
||||
$search_history_db=false,
|
||||
$cache=false
|
||||
) {
|
||||
if (is_int($condition)) {
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
|
@ -113,7 +121,7 @@ function oracle_db_get_value($field, $table, $field_search=1, $condition=1, $sea
|
|||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -996,10 +1004,10 @@ function oracle_db_get_value_sql($sql, $dbconnection=false)
|
|||
*
|
||||
* @return mixed The first row of the result or false
|
||||
*/
|
||||
function oracle_db_get_row_sql($sql, $search_history_db=false)
|
||||
function oracle_db_get_row_sql($sql, $search_history_db=false, $cache=true)
|
||||
{
|
||||
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
|
||||
$result = oracle_db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = oracle_db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
|
|
@ -53,15 +53,23 @@ function postgresql_connect_db($host=null, $db=null, $user=null, $pass=null, $po
|
|||
/**
|
||||
* Get the first value of the first row of a table in the database.
|
||||
*
|
||||
* @param string Field name to get
|
||||
* @param string Table to retrieve the data
|
||||
* @param string Field to filter elements
|
||||
* @param string Condition the field must have
|
||||
* @param string $field Field name to get.
|
||||
* @param string $table Table to retrieve the data.
|
||||
* @param string $field_search Field to filter elements.
|
||||
* @param string $condition Condition the field must have.
|
||||
* @param boolean $search_history_db Search in historical db.
|
||||
* @param boolean $cache Enable cache or not.
|
||||
*
|
||||
* @return mixed Value of first column of the first row. False if there were no row.
|
||||
*/
|
||||
function postgresql_db_get_value($field, $table, $field_search=1, $condition=1, $search_history_db=false)
|
||||
{
|
||||
function postgresql_db_get_value(
|
||||
$field,
|
||||
$table,
|
||||
$field_search=1,
|
||||
$condition=1,
|
||||
$search_history_db=false,
|
||||
$cache=true
|
||||
) {
|
||||
if ($field_search[0] == '`') {
|
||||
$field_search = str_replace('`', '', $field_search);
|
||||
}
|
||||
|
@ -92,7 +100,7 @@ function postgresql_db_get_value($field, $table, $field_search=1, $condition=1,
|
|||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -705,10 +713,10 @@ function postgresql_db_get_value_sql($sql, $dbconnection=false)
|
|||
*
|
||||
* @return mixed The first row of the result or false
|
||||
*/
|
||||
function postgresql_db_get_row_sql($sql, $search_history_db=false)
|
||||
function postgresql_db_get_row_sql($sql, $search_history_db=false, $cache=true)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db);
|
||||
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
|
|
@ -1745,17 +1745,34 @@ function has_metaconsole()
|
|||
|
||||
|
||||
/**
|
||||
* @brief Check if there is management operations are allowed in current context
|
||||
* (node // meta)
|
||||
* Check if there is management operations are allowed in current context
|
||||
*
|
||||
* @param string $hkey Hash ke.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_management_allowed($hkey='')
|
||||
{
|
||||
return ( (is_metaconsole() && is_centrallised())
|
||||
|| (!is_metaconsole() && !is_centrallised())
|
||||
|| (!is_metaconsole() && is_centrallised()) && $hkey == generate_hash_to_api());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if is a centrallised environment.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_centrallised()
|
||||
{
|
||||
global $config;
|
||||
return ( (is_metaconsole() && $config['centralized_management'])
|
||||
|| (!is_metaconsole() && !$config['centralized_management'])
|
||||
|| (!is_metaconsole() && $config['centralized_management']) && $hkey == generate_hash_to_api());
|
||||
|
||||
if (isset($config['centralized_management']) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $config['centralized_management'];
|
||||
}
|
||||
|
||||
|
||||
|
@ -1767,21 +1784,7 @@ function is_management_allowed($hkey='')
|
|||
*/
|
||||
function is_central_policies()
|
||||
{
|
||||
global $config;
|
||||
return is_metaconsole() && $config['centralized_management'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in node environment. Usefull
|
||||
* to reduce the policy functionallity on nodes.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_central_policies_on_node()
|
||||
{
|
||||
global $config;
|
||||
return (!is_metaconsole()) && $config['centralized_management'];
|
||||
return is_metaconsole() && is_centrallised();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2259,13 +2262,16 @@ function check_login($output=true)
|
|||
return false;
|
||||
}
|
||||
|
||||
// No exists $config. Exit inmediatly
|
||||
// No exists $config. Exit inmediatly.
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_SESSION['id_usuario'])) and ($_SESSION['id_usuario'] != '')) {
|
||||
if (is_user($_SESSION['id_usuario'])) {
|
||||
if ((isset($_SESSION['id_usuario'])) && ($_SESSION['id_usuario'] != '')) {
|
||||
if (is_user($_SESSION['id_usuario'])
|
||||
|| (isset($_SESSION['merge-request-user-trick']) === true
|
||||
&& $_SESSION['merge-request-user-trick'] === $_SESSION['id_usuario'])
|
||||
) {
|
||||
$config['id_user'] = $_SESSION['id_usuario'];
|
||||
|
||||
return true;
|
||||
|
@ -2549,7 +2555,9 @@ function get_users_acl($id_user)
|
|||
{
|
||||
static $users_acl_cache = [];
|
||||
|
||||
if (is_array($users_acl_cache[$id_user])) {
|
||||
if (isset($users_acl_cache[$id_user]) === true
|
||||
&& is_array($users_acl_cache[$id_user]) === true
|
||||
) {
|
||||
$rowdup = $users_acl_cache[$id_user];
|
||||
} else {
|
||||
$query = sprintf(
|
||||
|
@ -4353,6 +4361,8 @@ function pandora_xhprof_display_result($key='', $method='link')
|
|||
switch ($method) {
|
||||
case 'console':
|
||||
error_log("'{$new_url}'");
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
default:
|
||||
echo "<a href='{$new_url}' target='_new'>Performance</a>\n";
|
||||
|
|
|
@ -2824,19 +2824,21 @@ function alerts_ui_update_or_create_actions($update=true)
|
|||
$values['id_group'] = $group;
|
||||
$values['action_threshold'] = $action_threshold;
|
||||
$values['create_wu_integria'] = $create_wu_integria;
|
||||
if ($update) {
|
||||
$values['name'] = $name;
|
||||
$values['id_alert_command'] = $id_alert_command;
|
||||
// Only for Metaconsole, save the previous name for synchronization.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'talert_actions', 'id', $id);
|
||||
}
|
||||
|
||||
$result = (!$name) ? '' : alerts_update_alert_action($id, $values);
|
||||
// If this alert has the same name, not valid.
|
||||
$name_check = db_get_row('talert_actions', 'name', $name);
|
||||
if (empty($name_check) === false && (int) $name_check['id'] !== (int) $id) {
|
||||
$result = '';
|
||||
} else {
|
||||
$name_check = db_get_value('name', 'talert_actions', 'name', $name);
|
||||
if ($name_check) {
|
||||
$result = '';
|
||||
if ($update) {
|
||||
$values['name'] = $name;
|
||||
$values['id_alert_command'] = $id_alert_command;
|
||||
// Only for Metaconsole, save the previous name for synchronization.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'talert_actions', 'id', $id);
|
||||
}
|
||||
|
||||
$result = (!$name) ? '' : alerts_update_alert_action($id, $values);
|
||||
} else {
|
||||
$result = alerts_create_alert_action(
|
||||
$name,
|
||||
|
|
|
@ -177,6 +177,16 @@ function returnError($typeError, $returnType='string')
|
|||
);
|
||||
break;
|
||||
|
||||
case 'auth_error':
|
||||
returnData(
|
||||
$returnType,
|
||||
[
|
||||
'type' => 'string',
|
||||
'data' => __('Auth error'),
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
returnData(
|
||||
$returnType,
|
||||
|
@ -2129,6 +2139,14 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
|
||||
$values['name'] = $other['data'][0];
|
||||
|
@ -2161,6 +2179,14 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $other['data'][0];
|
||||
$values['description'] = $other['data'][1];
|
||||
|
@ -5193,7 +5219,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
function api_set_new_network_component($id, $thrash1, $other, $thrash2)
|
||||
{
|
||||
global $config;
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5202,6 +5228,14 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError('The network component could not be created. Network component name cannot be left blank.');
|
||||
return;
|
||||
|
@ -5287,7 +5321,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5296,6 +5330,14 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'The plugin component could not be created. Plugin component name cannot be left blank.'
|
||||
|
@ -5559,7 +5601,15 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5727,7 +5777,15 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5862,7 +5920,15 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6006,7 +6072,15 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7196,6 +7270,14 @@ function api_set_tag($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $id;
|
||||
$values['description'] = $other['data'][0];
|
||||
|
@ -7445,8 +7527,6 @@ function api_set_planned_downtimes_deleted($id, $thrash1, $thrash2, $returnType)
|
|||
* <type_periodicity>
|
||||
* @param $thrash3 Don't use.
|
||||
*/
|
||||
|
||||
|
||||
function api_set_planned_downtimes_created($id, $thrash1, $other, $thrash3)
|
||||
{
|
||||
global $config;
|
||||
|
@ -7900,6 +7980,14 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'The data module could not be updated in policy. Id_policy cannot be left blank.'
|
||||
|
@ -8012,6 +8100,14 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'The network module could not be added to policy. Id_policy cannot be left blank.'
|
||||
|
@ -8127,6 +8223,14 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'The network module could not be updated in policy. Id_policy cannot be left blank.'
|
||||
|
@ -8226,6 +8330,14 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError('The plugin module could not be added. Id_policy cannot be left blank.');
|
||||
return;
|
||||
|
@ -8352,6 +8464,14 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'The plugin module could not be updated in policy. Id_policy cannot be left blank.'
|
||||
|
@ -8640,6 +8760,14 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError('The SNMP module could not be added to policy. Id_policy cannot be left blank.');
|
||||
return;
|
||||
|
@ -8799,6 +8927,14 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError('The SNMP module could not be updated in policy. Id_policy cannot be left blank.');
|
||||
return;
|
||||
|
@ -8956,6 +9092,14 @@ function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == '' || !$other['data'][0]) {
|
||||
returnError('The agent could not be deleted from policy. Agent cannot be left blank.');
|
||||
return;
|
||||
|
@ -8989,6 +9133,14 @@ function api_set_remove_agent_from_policy_by_name($id, $thrash1, $other, $thrash
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == '' || !$other['data'][0]) {
|
||||
returnError('The agent could not be deleted from policy. Agent name cannot be left blank.');
|
||||
return;
|
||||
|
@ -9025,6 +9177,14 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$group_name = $id;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
|
@ -9140,6 +9300,14 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) {
|
||||
returnError('There is no group with the ID provided');
|
||||
return;
|
||||
|
@ -9209,6 +9377,14 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]);
|
||||
if (!$group) {
|
||||
returnError('The group could not be deleted. ID does not exist.');
|
||||
|
@ -9526,6 +9702,14 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['fullname'] = $other['data'][0];
|
||||
$values['firstname'] = $other['data'][1];
|
||||
|
@ -9576,6 +9760,14 @@ function api_set_update_user($id, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$fields_user = [
|
||||
'fullname',
|
||||
'firstname',
|
||||
|
@ -9655,8 +9847,6 @@ function api_set_update_user($id, $thrash2, $other, $thrash3)
|
|||
*
|
||||
* @param $thrash3 Don't use.
|
||||
*/
|
||||
|
||||
|
||||
function api_set_enable_disable_user($id, $thrash2, $other, $thrash3)
|
||||
{
|
||||
global $config;
|
||||
|
@ -9670,6 +9860,14 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id == '') {
|
||||
returnError(
|
||||
'Failed switching enable/disable user. Id_user cannot be left blank.'
|
||||
|
@ -9930,6 +10128,14 @@ function api_set_new_alert_template($id, $id2, $other, $trash1)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['type'] == 'string') {
|
||||
returnError('Parameter error.');
|
||||
return;
|
||||
|
@ -10345,6 +10551,14 @@ function api_set_alert_actions($id, $id2, $other, $trash1)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['type'] == 'string') {
|
||||
returnError('Parameter error.');
|
||||
return;
|
||||
|
@ -10493,6 +10707,14 @@ function api_set_new_module_group($id, $thrash2, $other, $trash1)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
|
@ -10521,55 +10743,6 @@ function api_set_new_module_group($id, $thrash2, $other, $trash1)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* synchronize module group
|
||||
*
|
||||
* @param $other as server_names (mandatory)
|
||||
example:
|
||||
|
||||
* api.php?op=set&op2=module_group_synch&other=server_name1|server_name2|server_name3&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
|
||||
|
||||
function api_set_module_group_synch($thrash1, $thrash2, $other, $thrash4)
|
||||
{
|
||||
global $config;
|
||||
enterprise_include_once('meta/include/functions_meta.php');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$targets = [];
|
||||
foreach ($other['data'] as $server) {
|
||||
$targets[] = $server;
|
||||
}
|
||||
|
||||
$return = meta_module_group_synchronizing($targets, true);
|
||||
|
||||
$module_group_update_err = $return['module_group_update_err'];
|
||||
$module_group_create_err = $return['module_group_create_err'];
|
||||
$module_group_update_ok = $return['module_group_update_ok'];
|
||||
$module_group_create_ok = $return['module_group_create_ok'];
|
||||
|
||||
$string_ok = __('Created/Updated %s/%s module groups', $module_group_create_ok, $module_group_update_ok);
|
||||
|
||||
// User feedback
|
||||
if ($module_group_create_err > 0 or $module_group_update_err > 0) {
|
||||
returnError(sprintf('The module groups %s/%s could not be created/updated <br>', $module_group_create_err, $module_group_update_err));
|
||||
}
|
||||
|
||||
if ($module_group_create_ok > 0 or $module_group_update_ok > 0) {
|
||||
returnData('string', ['type' => 'string', 'data' => $string_ok]);
|
||||
}
|
||||
} else {
|
||||
returnError('This function is for metaconsole only');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new alert command
|
||||
*
|
||||
|
@ -10608,6 +10781,14 @@ function api_set_alert_commands($id, $thrash2, $other, $trash1)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$name = db_get_value('id', 'talert_commands', 'name', $id);
|
||||
$group = db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group);
|
||||
|
||||
|
@ -11880,6 +12061,14 @@ function api_set_delete_user($id, $thrash1, $thrash2, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!delete_user($id)) {
|
||||
returnError('The user could not be deleted');
|
||||
} else {
|
||||
|
@ -11915,6 +12104,14 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$group = (int) $other['data'][0];
|
||||
$profile = $other['data'][1];
|
||||
|
||||
|
@ -11968,6 +12165,14 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$group = $other['data'][0];
|
||||
$profile = $other['data'][1];
|
||||
|
||||
|
@ -12075,6 +12280,14 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = [
|
||||
'name' => (string) $other['data'][0],
|
||||
'agent_view' => (bool) $other['data'][1] ? 1 : 0,
|
||||
|
@ -12128,6 +12341,14 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
|
@ -12187,6 +12408,14 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_value('id_perfil', 'tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
|
@ -12212,8 +12441,6 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
|
|||
* @param $thrash4 Don't use.
|
||||
* // http://localhost/pandora_console/include/api.php?op=set&op2=enable_module&id=garfio&id2=Status
|
||||
*/
|
||||
|
||||
|
||||
function api_set_disable_module($agent_name, $module_name, $other, $thrash4)
|
||||
{
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -13076,6 +13303,14 @@ function api_set_create_tag($id, $trash1, $other, $returnType)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($other['type'] == 'string') {
|
||||
|
@ -16285,9 +16520,6 @@ function api_get_user_info($thrash1, $thrash2, $other, $returnType)
|
|||
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function api_set_access_process($thrash1, $thrash2, $other, $returnType)
|
||||
{
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -16946,6 +17178,14 @@ function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] != '') {
|
||||
$values = [
|
||||
'id_up' => io_safe_output($other['data'][0]),
|
||||
|
@ -16999,6 +17239,14 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
|
|||
return;
|
||||
}
|
||||
|
||||
$headers = getallheaders();
|
||||
if (isset($headers['idk']) === false
|
||||
&& is_management_allowed($headers['idk']) === false
|
||||
) {
|
||||
returnError('centralized');
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = 'SELECT id_up
|
||||
FROM tusuario_perfil
|
||||
WHERE id_up = '.$other['data'][4].'';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue