Merge remote-tracking branch 'origin/master' into ent-5693-9848-actualizar-campos-personalizados-agente-mediante-cli

This commit is contained in:
marcos 2021-09-27 17:08:03 +02:00
commit 87eb16ef32
272 changed files with 35648 additions and 27361 deletions

View File

@ -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

View File

@ -151,7 +151,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
# Install percona Database
[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies
@ -429,6 +429,7 @@ sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">

View File

@ -149,6 +149,7 @@ EOF_INDEX
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
echo "- Setting Public URL: $PUBLICURL"
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, AIX version
# Version 7.0NG.757, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, FreeBSD Version
# Version 7.0NG.757, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, HP-UX Version
# Version 7.0NG.757, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, Solaris Version
# Version 7.0NG.757, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -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.757
# 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

View File

@ -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.757, AIX version
# General Parameters
# ==================

View File

@ -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.757
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -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.757, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755
# Version 7.0NG.757
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -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.757, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, AIX version
# Version 7.0NG.757, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.755-210707
Version: 7.0NG.757-210915
Architecture: all
Priority: optional
Section: admin

View File

@ -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-210707"
pandora_version="7.0NG.757-210915"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.755"
VERSION="7.0NG.757"
fi
# Path for the generated DMG file

View 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.757" 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.757" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -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.757</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.757 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.757</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, FreeBSD Version
# Version 7.0NG.757, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, HP-UX Version
# Version 7.0NG.757, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, NetBSD Version
# Version 7.0NG.757, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, Solaris Version
# Version 7.0NG.757, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -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 => '210707';
use constant AGENT_VERSION => '7.0NG.757';
use constant AGENT_BUILD => '210915';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.755
%define release 210707
%define version 7.0NG.757
%define release 210915
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.755
%define release 210707
%define version 7.0NG.757
%define release 210915
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -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="210707"
PI_VERSION="7.0NG.757"
PI_BUILD="210915"
OS_NAME=`uname -s`
FORCE=0

View File

@ -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.757
# 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

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.755}
{Pandora FMS Windows Agent v7.0NG.757}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210707}
{210915}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.755 Build 210707")
#define PANDORA_VERSION ("7.0NG.757 Build 210915")
string pandora_path;
string pandora_dir;

View File

@ -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 210707))"
VALUE "ProductVersion", "(7.0NG.757(Build 210915))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.755-210707
Version: 7.0NG.757-210915
Architecture: all
Priority: optional
Section: admin

View File

@ -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-210707"
pandora_version="7.0NG.757-210915"
package_pear=0
package_pandora=1

View File

@ -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 {

View File

@ -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');

View File

@ -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;
}

View File

@ -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) {

View File

@ -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

View File

@ -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,7 +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;
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;

View File

@ -0,0 +1,9 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
COMMIT;

View File

@ -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`
-- ---------------------------------------------------------------------
@ -1026,6 +1028,7 @@ ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_module_status_idx` (`module_status`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_criticity_idx` (`criticity`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_agent_name_idx` (`agent_name`);
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tmetaconsole_event_history`
@ -1438,13 +1441,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', 49);
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', 757);
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';
@ -2255,6 +2258,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_node_id` INT(10) NOT NULL default 0,
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
`title` TEXT default '',
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -2347,6 +2351,8 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tevent_extended`
-- ---------------------------------------------------------------------
@ -2564,7 +2570,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;
@ -2738,7 +2744,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`
-- ---------------------------------------------------------------------
@ -4042,6 +4048,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`;
@ -4058,3 +4078,5 @@ CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';

View File

@ -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>

View File

@ -23,13 +23,8 @@ ui_require_css_file('order_interpreter');
// Global errors/warnings checking.
config_check();
echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
if ($config['menu_type'] == 'classic') {
echo '<div id="header_table" class="header_table_classic">';
} else {
echo '<div id="header_table" class="header_table_collapsed">';
}
?>
<div id="header_table_inner">
<?php

View File

@ -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

View File

@ -1,17 +1,33 @@
<?php
/**
* Lateral Main Menu.
*
* @category Main Menu.
* @package Pandora FMS.
* @subpackage OpenSource.
* @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; 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.
if (! isset($config['id_user'])) {
// Begin.
if (isset($config['id_user']) === false) {
include 'general/login_page.php';
exit();
}
@ -20,9 +36,9 @@ if (! isset($config['id_user'])) {
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var menuType_value = "<?php echo $config['menu_type']; ?>";
var menuType_value = "<?php echo $_SESSION['menu_type']; ?>";
if (menuType_value == 'classic') {
if (menuType_value === '' || menuType_value === 'classic') {
$('ul.submenu').css('left', '214px');
}
else{
@ -34,26 +50,22 @@ $(document).ready(function(){
<?php
$autohidden_menu = 0;
if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
$autohidden_menu = 1;
}
// Menu container prepared to autohide menu
if ($config['menu_type'] == 'classic') {
echo '<div id="menu_full" class="menu_full_classic">';
} else {
echo '<div id="menu_full" class="menu_full_collapsed">';
}
// Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (!defined('PANDORA_ENTERPRISE')) {
if (defined('PANDORA_ENTERPRISE') === false) {
$logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
} else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
@ -61,54 +73,48 @@ if (!defined('PANDORA_ENTERPRISE')) {
}
echo '<div class="logo_green"><a href="index.php?sec=main">';
if (isset($config['custom_logo'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:block']);
} else {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
}
if (isset($config['custom_logo']) === true) {
echo html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:none']);
} else {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
}
if (isset($config['custom_logo_collapsed']) === true) {
echo html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
echo '</a></div>';
// echo '<div class="tit bg titop">:: '.__('Operation').' ::</div>';
require 'operation/menu.php';
// Check all enterprise ACL used in godmenu items to print menu headers
if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'PM')
|| check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'UM')
|| check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'DW')
) {
// echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
}
require 'godmode/menu.php';
if ($config['menu_type'] == 'classic') {
echo '<div id="button_collapse" class="button_classic button_collapse"></div>';
} else {
echo '<div id="button_collapse" class="button_collapsed button_collapse"></div>';
}
echo sprintf('<div id="button_collapse" class="button_%s button_collapse"></div>', $menuTypeClass);
// require ("links_menu.php");
echo '</div>';
// menu_container
// Menu_container.
ui_require_jquery_file('cookie');
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
if (isset($config['fixed_header']) === true) {
$config_fixed_header = $config['fixed_header'];
}
?>

View File

@ -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>

View File

@ -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>

View File

@ -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,
@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) {
}
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
$table_primary_group .= ui_print_group_icon($grupo, true);
if ($id_agente === 0) {
$hidden = 'display: none;';
} else {
$hidden = '';
}
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
@ -392,9 +399,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 +507,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.
@ -1243,6 +1253,9 @@ ui_require_jquery_file('bgiframe');
});
$("select#id_os").pandoraSelectOS ();
$('select#grupo').pandoraSelectGroupIcon ();
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {

View File

@ -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');
@ -2095,7 +2095,7 @@ if ($delete_module) {
exit;
}
// Also call base function to delete modules madafakas de los cojones.
// Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo);
// Check for errors.
@ -2368,7 +2368,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
event.preventDefault();
@ -2402,7 +2402,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault();

View File

@ -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'";

View File

@ -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) {

View File

@ -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,
@ -214,7 +215,7 @@ $table_simple->colspan[3][1] = 3;
$table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text_extended(
'name',
io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')),
$name,
'text-name',
'',
45,
@ -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);

View File

@ -443,6 +443,13 @@ $data[1] = html_print_input_text_extended(
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
__(
'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)'
),
true
);
$table_simple->colspan['row-cmd-row-1'][1] = 3;
push_table_simple($data, 'row-cmd-row-1');
@ -577,12 +584,7 @@ $(document).ready (function () {
$('#text-ip_target').keyup(function() {
$('#text-target_ip').val($(this).val());
});
$('#text-target_ip').keyup(function() {
$('#text-ip_target').val($(this).val());
});
$('#text-community').keyup(function() {
$('#text-snmp_community').val($(this).val());
});
$('#text-snmp_community').keyup(function() {
$('#text-community').val($(this).val());
});
@ -591,61 +593,25 @@ $(document).ready (function () {
// Display or collapse the SNMP browser's v3 options
checkSNMPVersion ();
});
$('#snmp_browser_version').change(function() {
$('#snmp_version').val($(this).val());
// Display or collapse the SNMP v3 options in the main window
if ($(this).val() == "3") {
$("#simple-field_snmpv3_row1").attr("style", "");
$("#simple-field_snmpv3_row2").attr("style", "");
$("#simple-field_snmpv3_row3").attr("style", "");
$("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").attr("disabled", true);
}
else {
$("#simple-field_snmpv3_row1").css("display", "none");
$("#simple-field_snmpv3_row2").css("display", "none");
$("#simple-field_snmpv3_row3").css("display", "none");
$("input[name=active_snmp_v3]").val(0);
$("input[name=snmp_community]").removeAttr('disabled');
}
});
$('#snmp3_auth_user').keyup(function() {
$('#snmp3_browser_auth_user').val($(this).val());
});
$('#snmp3_browser_auth_user').keyup(function() {
$('#snmp3_auth_user').val($(this).val());
});
$('#snmp3_security_level').change(function() {
$('#snmp3_browser_security_level').val($(this).val());
});
$('#snmp3_browser_security_level').change(function() {
$('#snmp3_security_level').val($(this).val());
});
$('#snmp3_auth_method').change(function() {
$('#snmp3_browser_auth_method').val($(this).val());
});
$('#snmp3_browser_auth_method').change(function() {
$('#snmp3_auth_method').val($(this).val());
});
$('#snmp3_auth_pass').keyup(function() {
$('#snmp3_browser_auth_pass').val($(this).val());
});
$('#snmp3_browser_auth_pass').keyup(function() {
$('#snmp3_auth_pass').val($(this).val());
});
$('#snmp3_privacy_method').change(function() {
$('#snmp3_browser_privacy_method').val($(this).val());
});
$('#snmp3_browser_privacy_method').change(function() {
$('#snmp3_privacy_method').val($(this).val());
});
$('#snmp3_privacy_pass').keyup(function() {
$('#snmp3_browser_privacy_pass').val($(this).val());
});
$('#snmp3_browser_privacy_pass').keyup(function() {
$('#snmp3_privacy_pass').val($(this).val());
});
var custom_ip_target = "<?php echo $custom_ip_target; ?>";
if(custom_ip_target == ''){
$("#text-custom_ip_target").hide();

View File

@ -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"');

View File

@ -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"');

View File

@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[3] .= '<table class="databox_color w100p">';
$data[3] .= '<table class="databox_color w100p bg_color222">';
$data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
@ -1120,6 +1120,12 @@ function show_add_action(id_alert) {
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select, #action_select").select2({
tags: true,
dropdownParent: $("#add_action-div-" + id_alert)
});
},
width: 500,
height: 300
})
@ -1150,6 +1156,12 @@ function show_display_update_action(id_module_action, alert_id, alert_id_agent_m
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select_ajax, #action_select_ajax").select2({
tags: true,
dropdownParent: $("#update_action-div")
});
},
width: 500,
height: 300
})

View File

@ -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"');

View File

@ -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 = [];

View File

@ -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);

View File

@ -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] .= '&nbsp;'.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'),

View File

@ -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');
}

View File

@ -95,6 +95,7 @@ $fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event Name');
$fields_available['id_agente'] = __('Agent ID');
$fields_available['agent_name'] = __('Agent Name');
$fields_available['direccion'] = __('Agent IP');
$fields_available['id_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status');

View File

@ -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;

View File

@ -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"');

View File

@ -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>';
}

View File

@ -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';

View File

@ -404,7 +404,8 @@ $(document).ready (function () {
"get_agent_modules_json" : 1,
"get_id_and_name" : 1,
"disabled" : 0,
"id_agent" : id_agent
"id_agent" : id_agent,
"safe_name": 1,
};
var tags_to_search = $('#tags').val();
@ -434,7 +435,7 @@ $(document).ready (function () {
jQuery.each (data, function (i, val) {
option = $("<option></option>")
.attr ("value", val["id_agente_modulo"])
.append (val["nombre"]);
.append (val["safe_name"]);
$("#target_modules").append (option);
});

View File

@ -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);
}

View File

@ -685,7 +685,8 @@ $(document).ready (function () {
"get_agent_modules_json" : 1,
"get_distinct_name" : 1,
"indexed" : 0,
"privilege" : "AW"
"privilege" : "AW",
"safe_name": 1
};
if (this.value != '0')
@ -712,7 +713,7 @@ $(document).ready (function () {
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr("value", value["nombre"])
.html(value["nombre"]);
.html(value["safe_name"]);
$("#module_name").append (option);
});
hideSpinner();

View File

@ -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';

View File

@ -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');

View File

@ -1326,12 +1326,13 @@ $(document).ready (function () {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"get_distinct_name" : 1,
"indexed" : 0
"indexed" : 0,
"safe_name" : 1
};
if (this.value != '0')
params['id_tipo_modulo'] = this.value;
var status_module = $('#status_module').val();
if (status_module != '-1')
params['status_module'] = status_module;
@ -1342,16 +1343,16 @@ $(document).ready (function () {
params['tags'] = tags_to_search;
}
}
showSpinner();
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
$("#module_name").attr ("disabled", "disabled")
$("#module_name option[value!=0]").remove ();
$("#module_name option[value!=0]").remove();
jQuery.post ("ajax.php",
params,
function (data, status) {
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr ("value", value["nombre"]).html (value["nombre"]);
option = $("<option></option>").attr("value", value["nombre"]).html(value["safe_name"]);
$("#module_name").append (option);
});
hideSpinner();

View File

@ -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 />';

View File

@ -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');
@ -522,10 +525,8 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
$menu_godmode['messages']['id'] = 'god-um_messages';
$sub = [];
if ($config['enterprise_installed']) {
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
}
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';

View File

@ -255,7 +255,7 @@ foreach ($groups as $group) {
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $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)) {

View File

@ -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');

View File

@ -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'];

View File

@ -331,9 +331,9 @@ echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
echo '<tr>';
echo "<td colspan='3'>".__('Filter group').'</td>';
echo "<td colspan='1'>".__('Filter group').'</td>';
echo '</tr><tr>';
echo "<td colspan='3'>".html_print_select_groups(
echo "<td colspan='1'>".html_print_select_groups(
$config['id_user'],
($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
true,

View File

@ -748,6 +748,7 @@ switch ($action) {
$selected_agent_group_filter = $es['agent_group_filter'];
$selected_agents_inventory_display_options = $es['agents_inventory_display_options'];
$selected_agent_os_filter = $es['agent_os_filter'];
$selected_agent_custom_fields = $es['agent_custom_fields'];
$selected_agent_custom_field_filter = $es['agent_custom_field_filter'];
$selected_agent_status_filter = $es['agent_status_filter'];
$selected_agent_module_search_filter = $es['agent_module_search_filter'];
@ -3080,14 +3081,15 @@ $class = 'databox filters';
</tr>
<?php
$server_fields = [];
if (is_metaconsole()) {
$server_fields = [];
$server_fields[0] = __('All');
$servers = metaconsole_get_servers();
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
$server_filter_markup = '
<tr id="row_agent_server_filter" class="datos">
@ -3106,10 +3108,9 @@ $class = 'databox filters';
'min-width: 180px'
).'</td></tr>';
if (is_metaconsole()) {
echo $server_filter_markup;
}
?>
echo $server_filter_markup;
}
?>
<tr id="row_agent_group_filter" class="datos">
<td class="bolder">
@ -3158,6 +3159,28 @@ $class = 'databox filters';
</tr>
<tr id="row_custom_field" class="datos">
<td class="bolder">
<?php
echo __('Agent custom field');
?>
</td>
<td >
<?php
html_print_select_from_sql(
'SELECT id_field, name FROM tagent_custom_fields',
'agent_custom_fields[]',
$selected_agent_custom_fields,
'',
__('All'),
'0',
false,
true
);
?>
</td>
</tr>
<tr id="row_custom_field_filter" class="datos">
<td class="bolder">
<?php
echo __('Agent custom field filter');
@ -5159,7 +5182,6 @@ function addSLARow() {
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_sla]").css("background","url('<?php echo $autocompleteImage; ?>') right center no-repeat")
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');
@ -5486,6 +5508,7 @@ function chooseType() {
$("#row_agent_server_filter").hide();
$("#row_agent_group_filter").hide();
$("#row_os").hide();
$("#row_custom_field_filter").hide();
$("#row_custom_field").hide();
$("#row_agent_status").hide();
$("#row_agent_version").hide();
@ -6039,11 +6062,26 @@ function chooseType() {
$("#row_group").show();
$("#row_os").show();
$("#row_custom_field").show();
$("#row_custom_field_filter").show();
$("#row_agent_status").show();
$("#row_agent_version").show();
$("#row_agent_remote_conf").show();
$("#row_module_free_search").show();
if ($('#agent_custom_fields :selected').length > 0) {
$('#text-agent_custom_field_filter').removeAttr('disabled');
} else {
$('#text-agent_custom_field_filter').prop('disabled', true);
}
$("#agent_custom_fields").change(function(e) {
if ($('#agent_custom_fields :selected').length > 0) {
$('#text-agent_custom_field_filter').removeAttr('disabled');
} else {
$('#text-agent_custom_field_filter').prop('disabled', true);
}
});
break;
case 'inventory':

View File

@ -2219,6 +2219,7 @@ switch ($action) {
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');
$es['agent_custom_fields'] = get_parameter('agent_custom_fields');
$es['agent_status_filter'] = get_parameter('agent_status_filter');
$es['agent_version_filter'] = get_parameter('agent_version_filter');
$es['agent_module_search_filter'] = get_parameter('agent_module_search_filter');
@ -2858,6 +2859,7 @@ switch ($action) {
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');
$es['agent_custom_fields'] = get_parameter('agent_custom_fields');
$es['agent_status_filter'] = get_parameter('agent_status_filter');
$es['agent_version_filter'] = get_parameter('agent_version_filter');
$es['agent_module_search_filter'] = get_parameter('agent_module_search_filter');
@ -3370,7 +3372,7 @@ $buttons['view'] = [
$buttons[$activeTab]['active'] = true;
if ($idReport != 0) {
$textReportName = $reportName;
$textReportName = (empty($reportName) === false) ? $reportName : $report['name'];
} else {
$temp = $buttons['main'];
$buttons = null;

View File

@ -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;
@ -203,34 +219,15 @@ if ($filemanager) {
$id_plugin = (int) get_parameter('id_plugin', 0);
// Add custom directories here
// Add custom directories here.
$fallback_directory = 'attachment/plugin';
$directory = (string) get_parameter('directory', $fallback_directory);
$directory = str_replace('\\', '/', $directory);
// A miminal security check to avoid directory traversal
if (preg_match('/\.\./', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^\//', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^manager/', $directory)) {
$directory = $fallback_directory;
}
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory])) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -247,12 +244,12 @@ if ($filemanager) {
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
if ($create_text_file === true) {
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(
@ -283,11 +280,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 +307,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 +616,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 +628,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 +787,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 +888,6 @@ if (($create != '') || ($view != '')) {
'class' => 'invert_filter',
]
).'</a>';
if (is_metaconsole()) {
echo "&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;';
}
echo '</td>';
}

View File

@ -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');
}

View File

@ -47,26 +47,15 @@ if (isset($config['filemanager']['message']) === true) {
$config['filemanager']['message'] = null;
}
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = 'images';
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, 'images');
}
// Add custom directories here.
$fallback_directory = 'images';
// Banned directories.
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory]) === true) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -76,14 +65,14 @@ echo '<h4>'.__('Index of %s', $directory).'</h4>';
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
$default_real_directory = realpath($config['homedir'].'/');
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file === true) {
create_text_file($default_real_directory);
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(
@ -96,5 +85,6 @@ filemanager_file_explorer(
'',
false,
'',
false,
false
);

View File

@ -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"');

View File

@ -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;
}

View File

@ -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",

View File

@ -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>

View File

@ -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.
@ -308,6 +327,12 @@ if (is_array($config) === true) {
) {
ui_print_error_message(__('Update manager online requires registration.'));
}
if ($mode === Manager::MODE_OFFLINE) {
ui_print_warning_message(
__('Applying offline patches may make your console unusable, we recommend to completely backup your files before applying any patch.')
);
}
}
$url_update_manager = $config['url_update_manager'];
@ -362,19 +387,18 @@ 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;
}
$proxy = null;
if (empty($config['update_manager_proxy_server']) === false
|| empty($config['update_manager_proxy_port']) === false
|| empty($config['update_manager_proxy_user']) === false
|| empty($config['update_manager_proxy_password']) === false
) {
$proxy = [
'host' => $config['update_manager_proxy_server'],
'port' => $config['update_manager_proxy_port'],
'user' => $config['update_manager_proxy_user'],
'password' => $config['update_manager_proxy_password'],
];
}
$ui = new Manager(
@ -396,6 +420,7 @@ $ui = new Manager(
'registration_code' => $puid,
'remote_config' => $remote_config,
'propagate_updates' => $is_metaconsole,
'proxy' => $proxy,
'set_maintenance_mode' => function () {
if (function_exists('config_update_value') === true) {
config_update_value('maintenance_mode', 1);

View File

@ -666,6 +666,7 @@ class Client
$target = __('console update %d', $request['version']);
}
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found
curl_setopt(
$ch,
CURLOPT_PROGRESSFUNCTION,
@ -941,6 +942,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 +1341,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 +1434,8 @@ class Client
set_error_handler(
function ($errno, $errstr) {
throw new \Exception($errstr, $errno);
}
},
(E_ALL ^ E_NOTICE)
);
if ($package === null) {
@ -1664,7 +1674,7 @@ class Client
);
$this->updateMR(
$this->productPath.'/extras/mr/'.$mr,
$this->extract_to.'/extras/mr/'.$mr,
$this->dbhHistory,
$historical_MR
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -34,7 +34,7 @@
<script type="text/javascript">
if (typeof $ != "function") {
// Dynamically include jquery if not added to this page.
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-3.3.1.min.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery.current.js'); ?>"></'+'script>');
}
</script>
<script src="<?php $asset('resources/javascript/umc.js'); ?>" type="text/javascript"></script>

View File

@ -34,7 +34,7 @@ $product_name = get_product_name(); ?>
<script type="text/javascript">
if (typeof $ != "function") {
// Dynamically include jquery if not added to this page.
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-3.3.1.min.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery.current.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-ui.min.js'); ?>"></'+'script>');
}
</script>

View File

@ -37,12 +37,10 @@ $buttons['setup'] = [
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'</a>',
];
if (enterprise_installed()) {
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>',
];
}
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>',
];
$buttons['online'] = [
'active' => ($tab == 'online') ? true : false,
@ -60,6 +58,7 @@ switch ($tab) {
break;
case 'online':
default:
$title = __('Update manager » Online');
break;
}

Some files were not shown because too many files have changed in this diff Show More