mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge remote-tracking branch 'origin/develop' into ent-8677-app-android-consolas-visuales
This commit is contained in:
commit
4e444a9d20
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.760-220308
|
||||
Version: 7.0NG.760-220323
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220308"
|
||||
pandora_version="7.0NG.760-220323"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.760';
|
||||
use constant AGENT_BUILD => '220308';
|
||||
use constant AGENT_BUILD => '220323';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220323
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: coreutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
Requires: perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220323
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.760"
|
||||
PI_BUILD="220308"
|
||||
PI_BUILD="220323"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{220308}
|
||||
{220323}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220308")
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220323")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220308))"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220323))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.760-220308
|
||||
Version: 7.0NG.760-220323
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220308"
|
||||
pandora_version="7.0NG.760-220323"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -11,6 +11,9 @@
|
||||
// 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\Node;
|
||||
|
||||
|
||||
function dbmanager_query($sql, &$error, $dbconnection)
|
||||
{
|
||||
global $config;
|
||||
@ -88,6 +91,10 @@ function dbmgr_extension_main()
|
||||
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
@ -98,11 +105,59 @@ function dbmgr_extension_main()
|
||||
}
|
||||
|
||||
$sql = (string) get_parameter('sql');
|
||||
$node_id = (int) get_parameter('node_id', -1);
|
||||
|
||||
ui_print_page_header(__('Database interface'), 'images/gm_db.png', false, false, true);
|
||||
|
||||
echo '<div class="notify">';
|
||||
echo __(
|
||||
if (is_metaconsole() === true) {
|
||||
$img = '../../images/warning_modern.png';
|
||||
} else {
|
||||
$img = 'images/warning_modern.png';
|
||||
}
|
||||
|
||||
$msg = '<div id="err_msg_centralised">'.html_print_image(
|
||||
$img,
|
||||
true
|
||||
);
|
||||
$msg .= '<div>'.__(
|
||||
'Warning, you are accessing the database directly. You can leave the system inoperative if you run an inappropriate SQL statement'
|
||||
).'</div></div>';
|
||||
|
||||
$warning_message = '<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
infoMessage({
|
||||
title: \''.__('Warning').'\',
|
||||
text: \''.$msg.'\' ,
|
||||
simple: true,
|
||||
})
|
||||
})
|
||||
</script>';
|
||||
|
||||
if (empty($sql) === true) {
|
||||
echo $warning_message;
|
||||
}
|
||||
|
||||
echo "<form method='post' action=''>";
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'db_interface';
|
||||
$table->class = 'databox';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->colspan = [];
|
||||
$table->rowstyle = [];
|
||||
|
||||
$table->colspan[0][0] = 2;
|
||||
$table->colspan[1][0] = 2;
|
||||
$table->rowspan[2][0] = 3;
|
||||
|
||||
$table->rowclass[0] = 'notify';
|
||||
$table->rowclass[3] = 'pdd_5px';
|
||||
$table->rowclass[3] = 'flex-content-right';
|
||||
$table->rowclass[4] = 'flex-content-right';
|
||||
|
||||
$data[0][0] = __(
|
||||
"This is an advanced extension to interface with %s database directly from WEB console
|
||||
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
||||
if you don't know </b>exactly</b> what are you are doing,
|
||||
@ -113,19 +168,59 @@ function dbmgr_extension_main()
|
||||
get_product_name(),
|
||||
get_product_name()
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '<br />';
|
||||
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||
|
||||
echo '<br /><br />';
|
||||
echo "<form method='post' action=''>";
|
||||
html_print_textarea('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES));
|
||||
echo '<br />';
|
||||
echo '<div class="action-buttons w100p">';
|
||||
echo '<br />';
|
||||
html_print_submit_button(__('Execute SQL'), '', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
$servers = \metaconsole_get_servers();
|
||||
if (is_array($servers) === true) {
|
||||
$servers = array_reduce(
|
||||
$servers,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id']] = $item['server_name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$servers = [];
|
||||
}
|
||||
|
||||
$data[2][0] = html_print_textarea(
|
||||
'sql',
|
||||
5,
|
||||
50,
|
||||
html_entity_decode($sql, ENT_QUOTES),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$data[3][2] = html_print_input(
|
||||
[
|
||||
'name' => 'node_id',
|
||||
'type' => 'select',
|
||||
'fields' => $servers,
|
||||
'selected' => $node_id,
|
||||
'nothing' => __('This metaconsole'),
|
||||
'nothing_value' => -1,
|
||||
'return' => true,
|
||||
'label' => _('Select query target'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$data[4][2] = '<div class="action-buttons w100p">';
|
||||
$data[4][2] .= html_print_submit_button(
|
||||
__('Execute SQL'),
|
||||
'',
|
||||
false,
|
||||
'class="sub next"',
|
||||
true
|
||||
);
|
||||
$data[4][2] .= '</div>';
|
||||
|
||||
$table->data = $data;
|
||||
html_print_table($table);
|
||||
echo '</form>';
|
||||
|
||||
// Processing SQL Code
|
||||
@ -137,10 +232,29 @@ function dbmgr_extension_main()
|
||||
echo '<hr />';
|
||||
echo '<br />';
|
||||
|
||||
try {
|
||||
if (\is_metaconsole() === true && $node_id !== -1) {
|
||||
$node = new Node($node_id);
|
||||
$dbconnection = @get_dbconnection(
|
||||
[
|
||||
'dbhost' => $node->dbhost(),
|
||||
'dbport' => $node->dbport(),
|
||||
'dbname' => $node->dbname(),
|
||||
'dbuser' => $node->dbuser(),
|
||||
'dbpass' => $node->dbpass(),
|
||||
]
|
||||
);
|
||||
$error = '';
|
||||
$result = dbmanager_query($sql, $error, $dbconnection);
|
||||
} else {
|
||||
$dbconnection = $config['dbconnection'];
|
||||
$error = '';
|
||||
|
||||
$result = dbmanager_query($sql, $error, $dbconnection);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = __('Error querying database node');
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
echo '<strong>An error has occured when querying the database.</strong><br />';
|
||||
@ -181,8 +295,28 @@ function dbmgr_extension_main()
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
if (is_metaconsole()) {
|
||||
close_meta_frame();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// This adds a option in the operation menu.
|
||||
extensions_add_meta_menu_option(
|
||||
'DB interface',
|
||||
'PM',
|
||||
'gextensions',
|
||||
'database.png',
|
||||
'v1r1',
|
||||
'gdbman'
|
||||
);
|
||||
|
||||
extensions_add_meta_function('dbmgr_extension_main');
|
||||
} else {
|
||||
}
|
||||
|
||||
// This adds a option in the operation menu
|
||||
extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman');
|
||||
|
@ -120,3 +120,7 @@ enterprise/extensions/backup/main.php
|
||||
enterprise/extensions/backup.php
|
||||
mobile/include/javascript/jquery.mobile-1.4.5.js
|
||||
mobile/include/style/jquery.mobile-1.4.5.css
|
||||
enterprise/extensions/backup/backup.js
|
||||
enterprise/extensions/backup/sql/backup.sql
|
||||
enterprise/extensions/backup/sql/backup.oracle.sql
|
||||
enterprise/extensions/backup/sql/backup.postgreSQL.sql
|
19
pandora_console/extras/mr/53.sql
Normal file
19
pandora_console/extras/mr/53.sql
Normal file
@ -0,0 +1,19 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tipam_vlan` ADD COLUMN `custom_id` bigint(20) unsigned DEFAULT NULL;
|
||||
|
||||
UPDATE `tuser_task` SET `parameters` = 'a:3:{i:0;a:2:{s:11:"description";s:11:"Description";s:4:"type";s:4:"text";}i:1;a:3:{s:11:"description";s:20:"Save to disk in path";s:4:"type";s:6:"string";s:13:"default_value";s:21:"_%_ATTACHMENT_PATH_%_";}i:2;a:3:{s:11:"description";s:14:"Active backups";s:4:"type";s:6:"number";s:13:"default_value";i:3;}}' WHERE `function_name` = 'cron_task_do_backup';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tbackup` (
|
||||
`id` SERIAL,
|
||||
`utimestamp` BIGINT DEFAULT 0,
|
||||
`filename` VARCHAR(512) DEFAULT '',
|
||||
`id_user` VARCHAR(60) DEFAULT '',
|
||||
`description` MEDIUMTEXT,
|
||||
`pid` INT UNSIGNED DEFAULT 0,
|
||||
`filepath` VARCHAR(512) DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
||||
COMMIT;
|
@ -36,6 +36,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
).'</div>';
|
||||
|
||||
// ======= Servers List ===============================================
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
||||
$servers_list = '<div id="servers_list">';
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
@ -60,6 +61,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
$servers_check_img_link .= '</a>';
|
||||
};
|
||||
$servers_list .= $servers_check_img_link.'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -107,7 +107,12 @@ echo '</a></div>';
|
||||
require 'operation/menu.php';
|
||||
require 'godmode/menu.php';
|
||||
|
||||
echo sprintf('<div id="button_collapse" class="button_%s button_collapse"></div>', $menuTypeClass);
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'button_collapse',
|
||||
'class' => sprintf('button_collapse button_%s', $menuTypeClass),
|
||||
]
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
// Menu_container.
|
||||
|
@ -191,7 +191,7 @@ if ($disk_conf_delete) {
|
||||
@unlink($filename['conf']);
|
||||
}
|
||||
|
||||
echo '<form autocomplete="new-password" name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
echo '<form autocomplete="new-password" name="conf_agent" id="form_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
|
||||
// Custom ID.
|
||||
$custom_id_div = '<div class="label_select">';
|
||||
@ -452,123 +452,14 @@ if (!$new_agent && $alias != '') {
|
||||
echo '</div>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').'</p></div>';
|
||||
$adv_secondary_groups_left = html_print_select_groups(
|
||||
// Id_user.
|
||||
// Use the current user to select the groups.
|
||||
false,
|
||||
// Privilege.
|
||||
// ACL permission.
|
||||
'AR',
|
||||
// ReturnAllGroup.
|
||||
// Not all group.
|
||||
false,
|
||||
// Name.
|
||||
// HTML id.
|
||||
'secondary_groups',
|
||||
// Selected.
|
||||
// No select any by default.
|
||||
'',
|
||||
// Script.
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing.
|
||||
// Do not user no selected value.
|
||||
false,
|
||||
// Nothing_value.
|
||||
// Do not use no selected value.
|
||||
0,
|
||||
// Return.
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple.
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
// Sorting by default.
|
||||
true,
|
||||
// Class.
|
||||
// CSS classnames (default).
|
||||
'',
|
||||
// Disabled.
|
||||
// Not disabled (default).
|
||||
false,
|
||||
// Style.
|
||||
// Inline styles (default).
|
||||
'min-width:170px;',
|
||||
// Option_style.
|
||||
// Option style select (default).
|
||||
false,
|
||||
// Id_group.
|
||||
// Do not truncate the users tree (default).
|
||||
false,
|
||||
// Keys_field.
|
||||
// Key to get as value (default).
|
||||
'id_grupo',
|
||||
// Strict_user.
|
||||
// Not strict user (default).
|
||||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge(
|
||||
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
|
||||
[$agent['id_grupo']]
|
||||
)
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
);
|
||||
|
||||
$adv_secondary_groups_arrows = html_print_input_image(
|
||||
'add_secondary',
|
||||
'images/darrowright_green.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'id' => 'right_autorefreshlist',
|
||||
'title' => __('Add secondary groups'),
|
||||
'onclick' => 'agent_manager_add_secondary_groups(event, '.$id_agente.');',
|
||||
]
|
||||
).html_print_input_image(
|
||||
'remove_secondary',
|
||||
'images/darrowleft_green.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'id' => 'left_autorefreshlist',
|
||||
'title' => __('Remove secondary groups'),
|
||||
'onclick' => 'agent_manager_remove_secondary_groups(event, '.$id_agente.');',
|
||||
]
|
||||
);
|
||||
|
||||
$adv_secondary_groups_right .= html_print_select(
|
||||
// Values.
|
||||
$secondary_groups_selected['for_select'],
|
||||
// HTML id.
|
||||
'secondary_groups_selected',
|
||||
// Selected.
|
||||
'',
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing selected.
|
||||
false,
|
||||
// Nothing selected.
|
||||
0,
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
true,
|
||||
// Class.
|
||||
'',
|
||||
// Disabled.
|
||||
false,
|
||||
// Style.
|
||||
'min-width:170px;'
|
||||
$adv_secondary_groups_label = '<div class="label_select">';
|
||||
$adv_secondary_groups_label .= '<p class="input_label">';
|
||||
$adv_secondary_groups_label .= __('Secondary groups');
|
||||
$adv_secondary_groups_label .= '</p>';
|
||||
$adv_secondary_groups_label .= '</div>';
|
||||
$select_agent_secondary = html_print_select_agent_secondary(
|
||||
$agent,
|
||||
$id_agente
|
||||
);
|
||||
|
||||
// Safe operation mode.
|
||||
@ -824,19 +715,15 @@ if (enterprise_installed()) {
|
||||
}
|
||||
|
||||
// General display distribution.
|
||||
$table_adv_options = $advanced_div.$adv_secondary_groups_label.'
|
||||
<div class="sg_source">
|
||||
'.$adv_secondary_groups_left.'
|
||||
</div>
|
||||
<div class="secondary_group_arrows">
|
||||
'.$adv_secondary_groups_arrows.'
|
||||
</div>
|
||||
<div class="sg_target">
|
||||
'.$adv_secondary_groups_right.'
|
||||
</div>
|
||||
</div>
|
||||
<div class="agent_av_opt_right" >
|
||||
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
|
||||
$table_adv_options = $advanced_div;
|
||||
$table_adv_options .= $adv_secondary_groups_label;
|
||||
$table_adv_options .= $select_agent_secondary;
|
||||
$table_adv_options .= '</div>';
|
||||
|
||||
$table_adv_options .= '<div class="agent_av_opt_right" >';
|
||||
$table_adv_options .= $table_adv_parent;
|
||||
$table_adv_options .= $table_adv_module_mode;
|
||||
$table_adv_options .= $table_adv_cascade;
|
||||
|
||||
if ($new_agent) {
|
||||
// If agent is new, show custom id as old style format.
|
||||
@ -1113,133 +1000,6 @@ ui_require_jquery_file('bgiframe');
|
||||
}
|
||||
}
|
||||
|
||||
function agent_manager_add_secondary_groups (event, id_agent) {
|
||||
event.preventDefault();
|
||||
var primary_value = $("#grupo").val()
|
||||
// The selected primary value cannot be selected like secondary
|
||||
if ($("#secondary_groups option:selected[value=" + primary_value + "]").length > 0) {
|
||||
alert("<?php echo __('Primary group cannot be secondary too.'); ?>")
|
||||
return
|
||||
}
|
||||
|
||||
// On agent creation PHP will update the secondary groups table (not via AJAX)
|
||||
if (id_agent == 0) {
|
||||
agent_manager_add_secondary_groups_ui();
|
||||
agent_manager_update_hidden_input_secondary();
|
||||
return;
|
||||
}
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups option:selected").each(function(){
|
||||
selected_items.push($(this).val())
|
||||
})
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
add_secondary_groups: 1,
|
||||
}
|
||||
|
||||
// Make the AJAX call to update the secondary groups
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
agent_manager_add_secondary_groups_ui();
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups")
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to add secondary groups")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function agent_manager_remove_secondary_groups (event, id_agent) {
|
||||
event.preventDefault();
|
||||
|
||||
// On agent creation PHP will update the secondary groups table (not via AJAX)
|
||||
if (id_agent == 0) {
|
||||
agent_manager_remove_secondary_groups_ui();
|
||||
agent_manager_update_hidden_input_secondary();
|
||||
return;
|
||||
}
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups_selected option:selected").each(function(){
|
||||
selected_items.push($(this).val())
|
||||
})
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
remove_secondary_groups: 1,
|
||||
}
|
||||
|
||||
// Make the AJAX call to update the secondary groups
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
agent_manager_remove_secondary_groups_ui();
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups")
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to add secondary groups")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Move from left input to right input
|
||||
function agent_manager_add_secondary_groups_ui () {
|
||||
$("#secondary_groups_selected option[value=0]").remove()
|
||||
$("#secondary_groups option:selected").each(function() {
|
||||
$(this).remove().appendTo("#secondary_groups_selected")
|
||||
})
|
||||
}
|
||||
|
||||
// Move from right input to left input
|
||||
function agent_manager_remove_secondary_groups_ui () {
|
||||
// Remove the groups selected if success
|
||||
$("#secondary_groups_selected option:selected").each(function(){
|
||||
$(this).remove().appendTo("#secondary_groups")
|
||||
})
|
||||
|
||||
// Add none if empty select
|
||||
if ($("#secondary_groups_selected option").length == 0) {
|
||||
$("#secondary_groups_selected").append($('<option>',{
|
||||
value: 0,
|
||||
text: "<?php echo __('None'); ?>"
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
function agent_manager_update_hidden_input_secondary () {
|
||||
var groups = [];
|
||||
if(!$('form[name="conf_agent"] #secondary_hidden').length) {
|
||||
$('form[name="conf_agent"]').append(
|
||||
'<input name="secondary_hidden" type="hidden" id="secondary_hidden">'
|
||||
);
|
||||
}
|
||||
|
||||
var groups = new Array();
|
||||
$("#secondary_groups_selected option").each(function() {
|
||||
groups.push($(this).val())
|
||||
})
|
||||
|
||||
$("#secondary_hidden").val(groups.join(','));
|
||||
}
|
||||
|
||||
$(document).ready (function() {
|
||||
|
||||
|
@ -31,6 +31,8 @@ global $config;
|
||||
|
||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||
enterprise_include_once('include/functions_modules.php');
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
enterprise_include('include/functions_policies.php');
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
ui_require_javascript_file('encode_decode_base64');
|
||||
@ -984,7 +986,6 @@ if ($update_agent) {
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
}
|
||||
@ -2001,6 +2002,7 @@ if ($disable_module) {
|
||||
io_safe_output($module_name),
|
||||
]
|
||||
);
|
||||
|
||||
// Force disable.
|
||||
$disabled = 1;
|
||||
|
||||
|
@ -1,27 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Planned downtimes list.
|
||||
*
|
||||
* @category Planned downtimes
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
$read_permisson = check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($read_permisson == true) ? 'AR' : (($write_permisson == true) ? 'AD' : (($manage_permisson == true) ? 'AW' : 'AR'));
|
||||
$read_permisson = (bool) check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = (bool) check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||
$access = null;
|
||||
if ($read_permisson === true) {
|
||||
$access = 'AR';
|
||||
}
|
||||
|
||||
if (! $read_permisson && !$manage_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
$access = 'AD';
|
||||
}
|
||||
|
||||
if ($manage_permisson === true) {
|
||||
$access = 'AW';
|
||||
}
|
||||
|
||||
if ($read_permisson === false && $manage_permisson === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
@ -35,16 +61,109 @@ require_once 'include/functions_events.php';
|
||||
require_once 'include/functions_planned_downtimes.php';
|
||||
require_once 'include/functions_reporting.php';
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = !empty($malformed_downtimes) ? true : false;
|
||||
if (is_ajax() === true) {
|
||||
$show_info_agents_modules_affected = (bool) get_parameter(
|
||||
'show_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
$get_info_agents_modules_affected = (bool) get_parameter(
|
||||
'get_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
if ($show_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
$columns = [
|
||||
'agent_name',
|
||||
'module_name',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Agents'),
|
||||
__('Modules'),
|
||||
];
|
||||
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'agent_modules_affected_planned_downtime',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/agentes/planned_downtime.list',
|
||||
'ajax_data' => [
|
||||
'get_info_agents_modules_affected' => 1,
|
||||
'id' => $id,
|
||||
],
|
||||
'order' => [
|
||||
'field' => 'agent_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_agents',
|
||||
'name' => 'filter_agents',
|
||||
],
|
||||
[
|
||||
'label' => __('Modules'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_modules',
|
||||
'name' => 'filter_modules',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
// Catch post parameters.
|
||||
$options = [
|
||||
'limit' => get_parameter('start', 0),
|
||||
'offset' => get_parameter('length', $config['block_size']),
|
||||
'order' => get_datatable_order(),
|
||||
'filters' => get_parameter('filter', []),
|
||||
];
|
||||
|
||||
$modules = get_agents_modules_planned_dowtime($id, $options);
|
||||
$count = get_agents_modules_planned_dowtime($id, $options, $count);
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $modules,
|
||||
'recordsTotal' => $count[0]['total'],
|
||||
'recordsFiltered' => $count[0]['total'],
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = (empty($malformed_downtimes) === false) ? true : false;
|
||||
$migrate_malformed = (bool) get_parameter('migrate_malformed');
|
||||
if ($migrate_malformed) {
|
||||
if ($migrate_malformed === true) {
|
||||
$migration_result = planned_downtimes_migrate_malformed_downtimes();
|
||||
|
||||
if ($migration_result['status'] == false) {
|
||||
$str = 'An error occurred while migrating the malformed scheduled downtimes';
|
||||
$str2 = 'Please run the migration again or contact with the administrator';
|
||||
if ((bool) $migration_result['status'] === false) {
|
||||
ui_print_error_message(
|
||||
__('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
|
||||
__($str).'. '.__($str2)
|
||||
);
|
||||
echo '<br>';
|
||||
}
|
||||
@ -63,12 +182,15 @@ ui_print_page_header(
|
||||
$id_downtime = (int) get_parameter('id_downtime', 0);
|
||||
|
||||
$stop_downtime = (bool) get_parameter('stop_downtime');
|
||||
// STOP DOWNTIME
|
||||
if ($stop_downtime) {
|
||||
// STOP DOWNTIME.
|
||||
if ($stop_downtime === true) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
@ -80,7 +202,9 @@ if ($stop_downtime) {
|
||||
$result = planned_downtimes_stop($downtime);
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
|
||||
ui_print_error_message(
|
||||
__('An error occurred stopping the scheduled downtime')
|
||||
);
|
||||
} else {
|
||||
echo $result['message'];
|
||||
}
|
||||
@ -88,11 +212,14 @@ if ($stop_downtime) {
|
||||
|
||||
$delete_downtime = (int) get_parameter('delete_downtime');
|
||||
// DELETE WHOLE DOWNTIME!
|
||||
if ($delete_downtime) {
|
||||
if (empty($delete_downtime) === false) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
@ -102,10 +229,13 @@ if ($delete_downtime) {
|
||||
}
|
||||
|
||||
// The downtime shouldn't be running!!
|
||||
if ($downtime['executed']) {
|
||||
if ((bool) $downtime['executed'] === true) {
|
||||
ui_print_error_message(__('This scheduled downtime is running'));
|
||||
} else {
|
||||
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
|
||||
$result = db_process_sql_delete(
|
||||
'tplanned_downtime',
|
||||
['id' => $id_downtime]
|
||||
);
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
@ -119,15 +249,25 @@ if ($delete_downtime) {
|
||||
$offset = (int) get_parameter('offset');
|
||||
$filter_params = [];
|
||||
|
||||
$search_text = $filter_params['search_text'] = (string) get_parameter('search_text');
|
||||
$date_from = $filter_params['date_from'] = (string) get_parameter('date_from');
|
||||
$date_to = $filter_params['date_to'] = (string) get_parameter('date_to');
|
||||
$execution_type = $filter_params['execution_type'] = (string) get_parameter('execution_type');
|
||||
$show_archived = $filter_params['archived'] = (bool) get_parameter('archived');
|
||||
$agent_id = $filter_params['agent_id'] = (int) get_parameter('agent_id');
|
||||
$agent_name = $filter_params['agent_name'] = (string) (!empty($agent_id) ? get_parameter('agent_name') : '');
|
||||
$module_id = $filter_params['module_id'] = (int) get_parameter('module_name_hidden');
|
||||
$module_name = $filter_params['module_name'] = (string) (!empty($module_id) ? get_parameter('module_name') : '');
|
||||
$search_text = (string) get_parameter('search_text');
|
||||
$date_from = (string) get_parameter('date_from');
|
||||
$date_to = (string) get_parameter('date_to');
|
||||
$execution_type = (string) get_parameter('execution_type');
|
||||
$show_archived = (bool) get_parameter('archived');
|
||||
$agent_id = (int) get_parameter('agent_id');
|
||||
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
||||
$module_id = (int) get_parameter('module_name_hidden');
|
||||
$module_name = (string) ((empty($module_id) === false) ? get_parameter('module_name') : '');
|
||||
|
||||
$filter_params['search_text'] = $search_text;
|
||||
$filter_params['date_from'] = $date_from;
|
||||
$filter_params['date_to'] = $date_to;
|
||||
$filter_params['execution_type'] = $execution_type;
|
||||
$filter_params['archived'] = $show_archived;
|
||||
$filter_params['agent_id'] = $agent_id;
|
||||
$filter_params['agent_name'] = $agent_name;
|
||||
$filter_params['module_id'] = $module_id;
|
||||
$filter_params['module_name'] = $module_name;
|
||||
|
||||
$filter_params_str = http_build_query($filter_params);
|
||||
|
||||
@ -141,11 +281,32 @@ $table_form->data = [];
|
||||
$row = [];
|
||||
|
||||
// Search text.
|
||||
$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true);
|
||||
$row[] = __('Search').' '.html_print_input_text(
|
||||
'search_text',
|
||||
$search_text,
|
||||
'',
|
||||
50,
|
||||
250,
|
||||
true
|
||||
);
|
||||
// Dates.
|
||||
$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true);
|
||||
$date_inputs = __('From').' '.html_print_input_text(
|
||||
'date_from',
|
||||
$date_from,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$date_inputs .= ' ';
|
||||
$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true);
|
||||
$date_inputs .= __('To').' '.html_print_input_text(
|
||||
'date_to',
|
||||
$date_to,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$row[] = $date_inputs;
|
||||
|
||||
$table_form->data[] = $row;
|
||||
@ -157,9 +318,24 @@ $execution_type_fields = [
|
||||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
];
|
||||
$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
|
||||
$row[] = __('Execution type').' '.html_print_select(
|
||||
$execution_type_fields,
|
||||
'execution_type',
|
||||
$execution_type,
|
||||
'',
|
||||
__('Any'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
// Show past downtimes.
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true);
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox(
|
||||
'archived',
|
||||
1,
|
||||
$show_archived,
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
||||
@ -178,48 +354,84 @@ $agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
||||
$row[] = $agent_input;
|
||||
|
||||
// Module.
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||
'module_name',
|
||||
$module_name,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
[],
|
||||
true
|
||||
);
|
||||
|
||||
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
|
||||
$row[] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
// End of table filter.
|
||||
// Useful to know if the user has done a form filtering.
|
||||
$filter_performed = false;
|
||||
|
||||
$downtimes = [];
|
||||
$groups = users_get_groups(false, $access);
|
||||
if (!empty($groups)) {
|
||||
if (empty($groups) === false) {
|
||||
$where_values = '1=1';
|
||||
|
||||
$groups_string = implode(',', array_keys($groups));
|
||||
$where_values .= " AND id_group IN ($groups_string)";
|
||||
$where_values .= sprintf(' AND id_group IN (%s)', $groups_string);
|
||||
|
||||
// WARNING: add $filter_performed = true; to any future filter.
|
||||
if (!empty($search_text)) {
|
||||
if (empty($search_text) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')";
|
||||
$where_values .= sprintf(
|
||||
' AND (name LIKE "%%%s%%" OR description LIKE "%%%s%%")',
|
||||
$search_text,
|
||||
$search_text
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($execution_type)) {
|
||||
if (empty($execution_type) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND type_execution = '$execution_type'";
|
||||
$where_values .= sprintf(' AND type_execution = "%s"', $execution_type);
|
||||
}
|
||||
|
||||
if (!empty($date_from)) {
|
||||
if (empty($date_from) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_from >= "%s")
|
||||
)',
|
||||
strtotime($date_from.' 00:00:00')
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($date_to)) {
|
||||
if (empty($date_to) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$periodically_monthly_w = "type_periodicity = 'monthly'
|
||||
AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."')
|
||||
OR (periodically_day_from > periodically_day_to
|
||||
AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))";
|
||||
$periodically_monthly_w = sprintf(
|
||||
'type_periodicity = "monthly" AND (
|
||||
(
|
||||
periodically_day_from <= "%s"
|
||||
AND periodically_day_to >= "%s"
|
||||
)
|
||||
OR (
|
||||
periodically_day_from > periodically_day_to
|
||||
AND (
|
||||
periodically_day_from <= "%s"
|
||||
OR periodically_day_to >= "%s"
|
||||
)
|
||||
)
|
||||
)',
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to)),
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to))
|
||||
);
|
||||
|
||||
$periodically_weekly_days = [];
|
||||
$date_from_aux = strtotime($date_from);
|
||||
@ -229,7 +441,7 @@ if (!empty($groups)) {
|
||||
while ($date_from_aux <= $date_end && $days_number < 7) {
|
||||
$weekday_actual = strtolower(date('l', $date_from_aux));
|
||||
|
||||
$periodically_weekly_days[] = "$weekday_actual = 1";
|
||||
$periodically_weekly_days[] = $weekday_actual.' = 1';
|
||||
|
||||
$date_from_aux = ($date_from_aux + SECONDS_1DAY);
|
||||
$days_number++;
|
||||
@ -237,36 +449,60 @@ if (!empty($groups)) {
|
||||
|
||||
$periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(' OR ', $periodically_weekly_days).')';
|
||||
|
||||
$periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))";
|
||||
$periodically_w = sprintf(
|
||||
'type_execution = "periodically" AND ((%s) OR (%s))',
|
||||
$periodically_monthly_w,
|
||||
$periodically_weekly_w
|
||||
);
|
||||
|
||||
$once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'";
|
||||
$once_w = sprintf(
|
||||
'type_execution = "once" AND date_to <= "%s"',
|
||||
strtotime($date_to.' 23:59:59')
|
||||
);
|
||||
|
||||
$where_values .= " AND (($periodically_w) OR ($once_w))";
|
||||
$where_values .= sprintf(
|
||||
' AND ((%s) OR (%s))',
|
||||
$periodically_w,
|
||||
$once_w
|
||||
);
|
||||
}
|
||||
|
||||
if (!$show_archived) {
|
||||
if ($show_archived === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_to >= "%s"))',
|
||||
time()
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($agent_id)) {
|
||||
if (empty($agent_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)";
|
||||
$where_values .= sprintf(
|
||||
' AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = %d)',
|
||||
$agent_id
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($module_id)) {
|
||||
if (empty($module_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (id IN (SELECT id_downtime
|
||||
$where_values .= sprintf(
|
||||
' AND (id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_modules
|
||||
WHERE id_agent_module = $module_id)
|
||||
OR id IN (SELECT id_downtime
|
||||
WHERE id_agent_module = %d)
|
||||
OR id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_agents tpda, tagente_modulo tam
|
||||
WHERE tpda.id_agent = tam.id_agente
|
||||
AND tam.id_agente_modulo = $module_id
|
||||
AND tpda.all_modules = 1))";
|
||||
AND tam.id_agente_modulo = %d
|
||||
AND tpda.all_modules = 1
|
||||
)
|
||||
)',
|
||||
$module_id,
|
||||
$module_id
|
||||
);
|
||||
}
|
||||
|
||||
// Columns of the table tplanned_downtime.
|
||||
@ -296,68 +532,41 @@ if (!empty($groups)) {
|
||||
'id_user',
|
||||
];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = "SELECT $columns_str
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
WHERE %s
|
||||
ORDER BY type_execution DESC, date_from DESC
|
||||
LIMIT ".$config['block_size']."
|
||||
OFFSET $offset";
|
||||
break;
|
||||
LIMIT %d
|
||||
OFFSET %d',
|
||||
$columns_str,
|
||||
$where_values,
|
||||
$config['block_size'],
|
||||
$offset
|
||||
);
|
||||
|
||||
case 'oracle':
|
||||
// Oracle doesn't have TIME type, so we should transform the DATE value
|
||||
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
|
||||
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
|
||||
|
||||
$time_from_key = array_search('periodically_time_from', $columns);
|
||||
$time_to_key = array_search('periodically_time_to', $columns);
|
||||
|
||||
if ($time_from_key !== false) {
|
||||
$columns[$time_from_key] = $new_time_from;
|
||||
}
|
||||
|
||||
if ($time_to_key !== false) {
|
||||
$columns[$time_to_key] = $new_time_to;
|
||||
}
|
||||
|
||||
$columns_str = implode(',', $columns);
|
||||
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = "SELECT $columns_str
|
||||
$sql_count = sprintf(
|
||||
'SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
ORDER BY type_execution DESC, date_from DESC";
|
||||
|
||||
$sql = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_count = "SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values";
|
||||
WHERE %s',
|
||||
$where_values
|
||||
);
|
||||
|
||||
$downtimes = db_get_all_rows_sql($sql);
|
||||
$downtimes_number_res = db_get_all_rows_sql($sql_count);
|
||||
$downtimes_number = $downtimes_number_res != false ? $downtimes_number_res[0]['num'] : 0;
|
||||
} else {
|
||||
$downtimes = [];
|
||||
$downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0;
|
||||
}
|
||||
|
||||
$url_list = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list';
|
||||
$url_editor = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor';
|
||||
// No downtimes cause the user has not anyone.
|
||||
if (!$downtimes && !$filter_performed) {
|
||||
if ($downtimes === false && $filter_performed === false) {
|
||||
include_once $config['homedir'].'/general/first_task/planned_downtime.php';
|
||||
}
|
||||
} else if ($downtimes === false) {
|
||||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
@ -367,22 +576,25 @@ else if (!$downtimes) {
|
||||
echo '<div class="action-buttons w100p" >';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" class="display_in" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="post" class="display_in" action="'.$url_editor.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
} else {
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset
|
||||
);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
@ -402,8 +614,11 @@ else {
|
||||
$table->head['execution'] = __('Execution');
|
||||
$table->head['configuration'] = __('Configuration');
|
||||
$table->head['running'] = __('Running');
|
||||
$table->head['agents_modules'] = __('Affected');
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->head['stop'] = __('Stop downtime');
|
||||
$table->head['copy'] = __('Copy');
|
||||
$table->head['edit'] = __('Edit');
|
||||
@ -414,7 +629,9 @@ else {
|
||||
$table->align['group'] = 'center';
|
||||
$table->align['running'] = 'center';
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->align['stop'] = 'center';
|
||||
$table->align['edit'] = 'center';
|
||||
$table->align['delete'] = 'center';
|
||||
@ -430,7 +647,7 @@ else {
|
||||
WHERE id_downtime = '.$downtime['id']
|
||||
);
|
||||
|
||||
$data['name'] = $downtime['name']." ($total)";
|
||||
$data['name'] = $downtime['name'].' ('.$total.')';
|
||||
$data['description'] = $downtime['description'];
|
||||
$data['group'] = ui_print_group_icon($downtime['id_group'], true);
|
||||
|
||||
@ -451,7 +668,7 @@ else {
|
||||
|
||||
$data['configuration'] = reporting_format_planned_downtime_dates($downtime);
|
||||
|
||||
if ($downtime['executed'] == 0) {
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
$data['running'] = html_print_image(
|
||||
'images/pixel_red.png',
|
||||
true,
|
||||
@ -473,44 +690,124 @@ else {
|
||||
);
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'url' => ui_get_full_url('ajax.php', false, false, false),
|
||||
'loadingText' => __('Loading, this operation might take several minutes...'),
|
||||
'title' => __('Agents / Modules affected'),
|
||||
'id' => $downtime['id'],
|
||||
];
|
||||
|
||||
$data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
|
||||
$data['agents_modules'] .= html_print_image(
|
||||
'images/search_big.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Agents and modules affected'),
|
||||
'style' => 'width:22px; height: 22px;',
|
||||
]
|
||||
);
|
||||
$data['agents_modules'] .= '</a>';
|
||||
|
||||
// If user have writting permissions.
|
||||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if (in_array($downtime['id_group'], $groupsAD) === true) {
|
||||
// Stop button.
|
||||
if ($downtime['type_execution'] === 'once'
|
||||
&& (int) $downtime['executed'] === 1
|
||||
) {
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
$url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['stop'] = '<a href="'.$url_list_params.'">';
|
||||
$data['stop'] .= html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
} else {
|
||||
$data['stop'] = html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
|
||||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']);
|
||||
$url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">';
|
||||
$data['delete'] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['delete'] .= '</a>';
|
||||
} else {
|
||||
$data['edit'] = '';
|
||||
$data['delete'] = '';
|
||||
}
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
} else if ((int) $downtime['executed'] === 1
|
||||
&& $downtime['type_execution'] === 'once'
|
||||
) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
@ -529,7 +826,9 @@ else {
|
||||
$data['delete'] = '';
|
||||
}
|
||||
|
||||
if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) {
|
||||
if (empty($malformed_downtimes_exist) === false
|
||||
&& isset($malformed_downtimes[$downtime['id']]) === true
|
||||
) {
|
||||
$next_row_num = count($table->data);
|
||||
$table->cellstyle[$next_row_num][0] = 'color: red';
|
||||
$table->cellstyle[$next_row_num][1] = 'color: red';
|
||||
@ -542,7 +841,17 @@ else {
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
@ -551,32 +860,44 @@ else {
|
||||
__('Export to CSV'),
|
||||
'csv_export',
|
||||
false,
|
||||
"location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'",
|
||||
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" class="display_in" >';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '<form method="post" action="'.$url_editor.'" class="display_in" >';
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
ui_require_jquery_file(
|
||||
'ui.datepicker-'.get_user_language(),
|
||||
'include/javascript/i18n/'
|
||||
);
|
||||
|
||||
ui_require_javascript_file('pandora_planned_downtimes');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
$("input[name=module_name_hidden]").val(<?php echo (int) $module_id; ?>);
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
$("#text-date_from, #text-date_to")
|
||||
.datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
$.datepicker
|
||||
.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
|
||||
$("a#delete_downtime").click(function (e) {
|
||||
if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
|
||||
|
@ -90,6 +90,8 @@ $data[1] = html_print_input_text(
|
||||
'',
|
||||
50,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('id_response', $event_response['id'], true);
|
||||
|
@ -64,6 +64,40 @@ require_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
$create_profiles = (int) get_parameter('create_profiles');
|
||||
|
||||
// Get users and groups user can manage to check and for selectors.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
|
||||
$users_profiles = '';
|
||||
$users_order = [
|
||||
'field' => 'id_user',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
|
||||
$info_users = [];
|
||||
// Is admin.
|
||||
if (users_is_admin()) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
// has PM permission.
|
||||
} else if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
foreach ($info_users as $id_user => $value) {
|
||||
if (users_is_admin($id_user)) {
|
||||
unset($info_users[$value]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$info = [];
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info = array_merge($info, users_get_users_by_group($group, $value));
|
||||
}
|
||||
|
||||
foreach ($info as $key => $value) {
|
||||
if (!$value['is_admin']) {
|
||||
$info_users[$key] = $value['id_user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_profiles) {
|
||||
$profiles_id = get_parameter('profiles_id', -1);
|
||||
$groups_id = get_parameter('groups_id', -1);
|
||||
@ -74,8 +108,42 @@ if ($create_profiles) {
|
||||
$result = false;
|
||||
} else {
|
||||
foreach ($profiles_id as $profile) {
|
||||
// Check profiles permissions for non admin user.
|
||||
if (is_user_admin($config['user_id']) === false) {
|
||||
$user_profiles = profile_get_profiles(
|
||||
[
|
||||
'pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1',
|
||||
]
|
||||
);
|
||||
|
||||
if (array_search((int) $profile, array_keys($user_profiles)) === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add administrator profile whith standar user for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($groups_id as $group) {
|
||||
if (check_acl($config['id_user'], $group, 'UM') === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add profile group without permission for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($users_id as $user) {
|
||||
if (array_search($user, $info_users) === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to edit user without permission for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
$profile_data = db_get_row_filter('tusuario_perfil', ['id_usuario' => $user, 'id_perfil' => $profile, 'id_grupo' => $group]);
|
||||
// If the profile doesnt exist, we create it
|
||||
if ($profile_data === false) {
|
||||
@ -142,7 +210,6 @@ $table->size[2] = '33%';
|
||||
$data = [];
|
||||
$data[0] = '<form method="post" id="form_profiles" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_users&option=add_profiles">';
|
||||
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
|
||||
$display_all_group = true;
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
@ -205,36 +272,6 @@ $data[1] = html_print_select_groups(
|
||||
$data[2] = '<span id="alerts_loading" class="invisible">';
|
||||
$data[2] .= html_print_image('images/spinner.png', true);
|
||||
$data[2] .= '</span>';
|
||||
$users_profiles = '';
|
||||
$users_order = [
|
||||
'field' => 'id_user',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
|
||||
$info_users = [];
|
||||
// Is admin.
|
||||
if (users_is_admin()) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
// has PM permission.
|
||||
} else if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
foreach ($info_users as $id_user => $value) {
|
||||
if (users_is_admin($id_user)) {
|
||||
unset($info_users[$value]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$info = [];
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info = array_merge($info, users_get_users_by_group($group, $value));
|
||||
}
|
||||
|
||||
foreach ($info as $key => $value) {
|
||||
if (!$value['is_admin']) {
|
||||
$info_users[$key] = $value['id_user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data[2] .= html_print_select(
|
||||
$info_users,
|
||||
|
@ -14,7 +14,7 @@
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -47,15 +47,17 @@ require_once $config['homedir'].'/include/functions_gis.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
|
||||
if (is_ajax()) {
|
||||
$get_n_conf_files = (bool) get_parameter('get_n_conf_files');
|
||||
if ($get_n_conf_files) {
|
||||
if (is_ajax() === true) {
|
||||
$get_n_conf_files = (bool) get_parameter('get_n_conf_files', false);
|
||||
$groups_secondary_selected = (bool) get_parameter('groups_secondary_selected', false);
|
||||
|
||||
if ($get_n_conf_files === true) {
|
||||
$id_agents = get_parameter('id_agents');
|
||||
$cont = 0;
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$name = agents_get_name($id_agent);
|
||||
$agent_md5 = md5($name);
|
||||
if (file_exists($config['remote_config'].'/md5/'.$agent_md5.'.md5')) {
|
||||
if (file_exists($config['remote_config'].'/md5/'.$agent_md5.'.md5') === true) {
|
||||
$cont++;
|
||||
}
|
||||
}
|
||||
@ -63,6 +65,22 @@ if (is_ajax()) {
|
||||
echo $cont;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($groups_secondary_selected === true) {
|
||||
$groups = get_parameter('groups', []);
|
||||
$groups_selected = get_parameter('groups_selected', []);
|
||||
|
||||
$user_groups = users_get_groups($config['user'], 'AR', false);
|
||||
$ret = [];
|
||||
foreach ($user_groups as $id_gr => $name_group) {
|
||||
if (in_array($id_gr, $groups) === false) {
|
||||
$ret[$id_gr] = $name_group;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$update_agents = get_parameter('update_agents', 0);
|
||||
@ -140,6 +158,9 @@ if ($update_agents) {
|
||||
$values['safe_mode_module'] = '0';
|
||||
}
|
||||
|
||||
$secondary_groups_added = (array) get_parameter('secondary_groups_added', []);
|
||||
$secondary_groups_removed = (array) get_parameter('secondary_groups_removed', []);
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if ($fields === false) {
|
||||
@ -213,7 +234,7 @@ if ($update_agents) {
|
||||
}
|
||||
|
||||
$n_edited = 0;
|
||||
$result = false;
|
||||
$result = [];
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
|
||||
|
||||
@ -231,20 +252,20 @@ if ($update_agents) {
|
||||
$values['safe_mode_module'] = $id_module_safe[$id_agent];
|
||||
}
|
||||
|
||||
$result = db_process_sql_update(
|
||||
$result[$id_agent]['db'] = db_process_sql_update(
|
||||
'tagente',
|
||||
$values,
|
||||
['id_agente' => $id_agent]
|
||||
);
|
||||
|
||||
if ($result && $config['metaconsole_agent_cache'] == 1) {
|
||||
if ($result[$id_agent]['db'] && $config['metaconsole_agent_cache'] == 1) {
|
||||
$server_name['server_name'] = db_get_sql('SELECT server_name FROM tagente WHERE id_agente ='.$id_agent);
|
||||
// Force an update of the agent cache.
|
||||
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
|
||||
}
|
||||
|
||||
// Update the configuration files.
|
||||
if ($result && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
|
||||
if ($result[$id_agent]['db'] && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
[
|
||||
@ -288,7 +309,7 @@ if ($update_agents) {
|
||||
|
||||
if ($old_value === false) {
|
||||
// Create custom field if not exist.
|
||||
$result = db_process_sql_insert(
|
||||
$result[$id_agent]['fields'][$field['id_field']] = db_process_sql_insert(
|
||||
'tagent_custom_data',
|
||||
[
|
||||
'id_field' => $key,
|
||||
@ -298,7 +319,7 @@ if ($update_agents) {
|
||||
);
|
||||
} else {
|
||||
if ($old_value[0]['description'] !== $value) {
|
||||
$result = db_process_sql_update(
|
||||
$result[$id_agent]['fields'][$field['id_field']] = db_process_sql_update(
|
||||
'tagent_custom_data',
|
||||
['description' => $value],
|
||||
[
|
||||
@ -311,11 +332,22 @@ if ($update_agents) {
|
||||
}
|
||||
}
|
||||
|
||||
$n_edited += (int) $result;
|
||||
// Create or Remove the secondary groups.
|
||||
if (empty($secondary_groups_added) === false
|
||||
|| empty($secondary_groups_removed) === false
|
||||
) {
|
||||
$result[$id_agent]['secondary'] = enterprise_hook(
|
||||
'agents_update_secondary_groups',
|
||||
[
|
||||
$id_agent,
|
||||
$secondary_groups_added,
|
||||
$secondary_groups_removed,
|
||||
true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($result !== false) {
|
||||
if ($result['db'] !== false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||
'Update agent '.$id_agent,
|
||||
@ -324,7 +356,7 @@ if ($update_agents) {
|
||||
json_encode($info)
|
||||
);
|
||||
} else {
|
||||
if (isset($id_agent)) {
|
||||
if (isset($id_agent) === true) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||
'Try to update agent '.$id_agent,
|
||||
@ -334,15 +366,128 @@ if ($update_agents) {
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
foreach ($result as $id_agent => $item) {
|
||||
if ($item['db'] !== false) {
|
||||
$ret['db']['edited'] += 1;
|
||||
$ret['db']['edited_agent'][] = $id_agent;
|
||||
} else {
|
||||
$ret['db']['failed'] += 1;
|
||||
$ret['db']['failed_agent'][] = $id_agent;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result !== false,
|
||||
__('Agents updated successfully (%d)', $n_edited),
|
||||
__('Agents cannot be updated (maybe there was no field to update)')
|
||||
if (isset($item['fields']) === true
|
||||
&& empty($item['fields']) === false
|
||||
) {
|
||||
foreach ($item['fields'] as $kfield => $vfield) {
|
||||
if ($vfield !== false) {
|
||||
$ret['fields'][$id_agent]['edited'] += 1;
|
||||
$ret['fields'][$id_agent]['edited_field'][] = $kfield;
|
||||
} else {
|
||||
$ret['fields'][$id_agent]['failed'] += 1;
|
||||
$ret['fields'][$id_agent]['failed_field'][] = $kfield;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($item['secondary']) === true
|
||||
&& empty($item['secondary']) === false
|
||||
) {
|
||||
foreach ($item['secondary'] as $type_action => $values_secondary) {
|
||||
foreach ($values_secondary as $kgr => $vgr) {
|
||||
if ($vgr !== false) {
|
||||
$ret['secondary'][$type_action][$id_agent]['edited'] += 1;
|
||||
$ret['secondary'][$type_action][$id_agent]['edited_gr'][] = $kgr;
|
||||
} else {
|
||||
$ret['secondary'][$type_action][$id_agent]['failed'] += 1;
|
||||
$ret['secondary'][$type_action][$id_agent]['failed_gr'][] = $kgr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($ret as $type => $ret_val) {
|
||||
switch ($type) {
|
||||
case 'db':
|
||||
if (isset($ret_val['edited']) === true
|
||||
&& $ret_val['edited'] > 0
|
||||
) {
|
||||
ui_print_success_message(
|
||||
__(
|
||||
'Agents updated successfully (%d)',
|
||||
$ret_val['edited'],
|
||||
implode(
|
||||
',',
|
||||
$ret_val['edited_agent']
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($ret_val['failed']) === true
|
||||
&& $ret_val['failed'] > 0
|
||||
) {
|
||||
ui_print_error_message(
|
||||
__(
|
||||
'Agents cannot be updated (%d), ids (%s)',
|
||||
$ret_val['failed'],
|
||||
implode(',', $ret_val['failed_agent'])
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'fields':
|
||||
$str = '';
|
||||
foreach ($ret_val as $kag => $vag) {
|
||||
if (isset($vag['failed']) === true
|
||||
&& $vag['failed'] > 0
|
||||
) {
|
||||
$str .= __(
|
||||
'Agent ID: %s cannot be updated custom fields (%s)',
|
||||
$kag,
|
||||
implode(',', $vag['failed_field'])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($str) === false) {
|
||||
ui_print_error_message($str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'secondary':
|
||||
$str = '';
|
||||
foreach ($ret_val as $type => $values_secondary) {
|
||||
foreach ($values_secondary as $kag => $vag) {
|
||||
if (isset($vag['failed']) === true
|
||||
&& $vag['failed'] > 0
|
||||
) {
|
||||
$str .= __(
|
||||
'Agent ID: %s cannot be updated %s secondary groups (%s)',
|
||||
$kag,
|
||||
$type,
|
||||
implode(',', $vag['failed_gr'])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($str) === false) {
|
||||
ui_print_error_message($str);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$id_group = 0;
|
||||
|
||||
$table = new StdClass();
|
||||
@ -526,7 +671,16 @@ $table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][1] .= ' '.__('Module').' '.html_print_select($modules, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true);
|
||||
$table->data[0][1] .= ' '.__('Module').' ';
|
||||
$table->data[0][1] .= html_print_select(
|
||||
$modules,
|
||||
'cascade_protection_module',
|
||||
$cascade_protection_module,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = '<div class="w290px inline">';
|
||||
@ -550,7 +704,17 @@ $table->data[1][1] .= '</div>';
|
||||
|
||||
$table->data[2][0] = __('Interval');
|
||||
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false);
|
||||
$table->data[2][1] = html_print_extended_select_for_time(
|
||||
'interval',
|
||||
0,
|
||||
'',
|
||||
__('No change'),
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width: 150px',
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('OS');
|
||||
$table->data[3][1] = html_print_select_from_sql(
|
||||
@ -594,7 +758,14 @@ $table->data[4][1] = html_print_select(
|
||||
|
||||
// Description.
|
||||
$table->data[5][0] = __('Description');
|
||||
$table->data[5][1] = html_print_input_text('description', $description, '', 45, 255, true);
|
||||
$table->data[5][1] = html_print_input_text(
|
||||
'description',
|
||||
$description,
|
||||
'',
|
||||
45,
|
||||
255,
|
||||
true
|
||||
);
|
||||
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
@ -627,18 +798,148 @@ $table->data = [];
|
||||
$table->data[0][0] = __('Custom ID');
|
||||
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
|
||||
|
||||
// Secondary Groups.
|
||||
if (enterprise_installed() === true) {
|
||||
$groups = users_get_groups($config['id_user'], 'AW', false);
|
||||
$table->data['secondary_groups_added'][0] = __('Add secondary groups');
|
||||
$table->data['secondary_groups_added'][1] = html_print_select(
|
||||
$groups,
|
||||
'secondary_groups_added[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data['secondary_groups_removed'][0] = __('Remove secondary groups');
|
||||
$table->data['secondary_groups_removed'][1] = html_print_select(
|
||||
$groups,
|
||||
'secondary_groups_removed[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Learn mode / Normal mode.
|
||||
$table->data[1][0] = __('Module definition');
|
||||
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extended('mode', 2, '', $mode, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[1][1] = __('No change').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'mode',
|
||||
-1,
|
||||
'',
|
||||
$mode,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
$table->data[1][1] .= __('Learning mode').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'mode',
|
||||
1,
|
||||
'',
|
||||
$mode,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
$table->data[1][1] .= __('Normal mode').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'mode',
|
||||
0,
|
||||
'',
|
||||
$mode,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
$table->data[1][1] .= __('Autodisable mode').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'mode',
|
||||
2,
|
||||
'',
|
||||
$mode,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
|
||||
// Status (Disabled / Enabled).
|
||||
$table->data[2][0] = __('Status');
|
||||
$table->data[2][1] = __('No change').' '.html_print_radio_button_extended('disabled', -1, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[2][1] .= __('Disabled').' '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).' '.html_print_radio_button_extended('disabled', 1, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended('disabled', 0, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
|
||||
$table->data[2][1] = __('No change').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'disabled',
|
||||
-1,
|
||||
'',
|
||||
$disabled,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
$table->data[2][1] .= __('Disabled').' ';
|
||||
$table->data[1][1] .= ui_print_help_tip(
|
||||
__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'),
|
||||
true
|
||||
).' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'disabled',
|
||||
1,
|
||||
'',
|
||||
$disabled,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
$table->data[2][1] .= __('Active').' ';
|
||||
$table->data[1][1] .= html_print_radio_button_extended(
|
||||
'disabled',
|
||||
0,
|
||||
'',
|
||||
$disabled,
|
||||
false,
|
||||
'',
|
||||
'class="mrgn_right_40px"',
|
||||
true
|
||||
);
|
||||
|
||||
// Remote configuration.
|
||||
$table->data[3][0] = __('Remote configuration');
|
||||
@ -813,7 +1114,6 @@ attachActionButton('update_agents', 'update', $table->width);
|
||||
echo '</div></form>';
|
||||
|
||||
ui_require_jquery_file('form');
|
||||
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('ajaxqueue');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
@ -912,8 +1212,10 @@ $(document).ready (function () {
|
||||
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
||||
idAgents.push($(val).val());
|
||||
});
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/massive/massive_edit_agents",
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page" : "godmode/massive/massive_edit_agents",
|
||||
"get_n_conf_files" : 1,
|
||||
"id_agents[]" : idAgents
|
||||
},
|
||||
@ -930,7 +1232,6 @@ $(document).ready (function () {
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
$("#form_agents").attr("style", "");
|
||||
|
||||
if($("#safe_mode_change").val() == 1) {
|
||||
@ -970,8 +1271,41 @@ $(document).ready (function () {
|
||||
|
||||
disabled = 2;
|
||||
|
||||
//$("#id_group").trigger("change");
|
||||
$("#status_agents").change(function() {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#secondary_groups_added").change(
|
||||
function() {
|
||||
var groups = $("#secondary_groups_added").val();
|
||||
var groups_selected = $("#secondary_groups_removed").val();
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page" : "godmode/massive/massive_edit_agents",
|
||||
"groups_secondary_selected" : 1,
|
||||
"groups" : groups
|
||||
},
|
||||
function (data, status) {
|
||||
$('#secondary_groups_removed').empty();
|
||||
$('#secondary_groups_removed').val(null).trigger("change");
|
||||
if($.type(data) === "object"){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>").attr("value", id).html(value);
|
||||
if (inArray(id, groups_selected) === true) {
|
||||
option.attr("selected", true);
|
||||
}
|
||||
$("#secondary_groups_removed").append(option).trigger("change");
|
||||
});
|
||||
} else {
|
||||
option = $("<option></option>").attr("value", '').html('None');
|
||||
$("#secondary_groups_removed").append(option).trigger("change");
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function changeIcons() {
|
||||
|
@ -27,6 +27,8 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
@ -743,6 +745,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
||||
@ -867,6 +870,7 @@ switch ($action) {
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
case 'netflow_top_N':
|
||||
$netflow_filter = $item['text'];
|
||||
// Filter.
|
||||
$period = $item['period'];
|
||||
@ -3837,7 +3841,12 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
[$item['id_agent_module']]
|
||||
);
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo printSmallFont($nameService);
|
||||
if ($meta && $server_name != '') {
|
||||
echo $server_name.' » '.$nameService;
|
||||
} else {
|
||||
echo $nameService;
|
||||
}
|
||||
|
||||
echo '</th>';
|
||||
}
|
||||
|
||||
@ -3984,8 +3993,8 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
<?php
|
||||
}
|
||||
|
||||
if (enterprise_installed()
|
||||
&& $report_item_type == 'SLA_services'
|
||||
if (enterprise_installed() === true
|
||||
&& $report_item_type === 'SLA_services'
|
||||
) {
|
||||
enterprise_include_once(
|
||||
'include/functions_services.php'
|
||||
@ -4004,8 +4013,9 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
|
||||
if (empty($services_tmp) === false
|
||||
&& $services_tmp !== ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
@ -4014,14 +4024,89 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
|
||||
if ($check_module_sla === true
|
||||
&& $check_module_sla_value === true
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$sc = new Synchronizer();
|
||||
$node_services = $sc->apply(
|
||||
function ($node) {
|
||||
try {
|
||||
$node->connect();
|
||||
|
||||
$services_tmp = enterprise_hook(
|
||||
'services_get_services',
|
||||
[
|
||||
false,
|
||||
[
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'sla_id_module',
|
||||
'sla_value_id_module',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$all_services = [];
|
||||
if (empty($services_tmp) === false
|
||||
&& $services_tmp !== ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
|
||||
if ($check_module_sla === true
|
||||
&& $check_module_sla_value === true
|
||||
) {
|
||||
$all_services[$service['id']] = $service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$node->disconnect();
|
||||
} catch (\Exception $e) {
|
||||
$all_services = false;
|
||||
}
|
||||
|
||||
if ($all_services !== false) {
|
||||
return array_reduce(
|
||||
$all_services,
|
||||
function ($carry, $item) use ($node) {
|
||||
$carry[] = [
|
||||
'id' => $node->id().'|'.$item['id'],
|
||||
'name' => io_safe_output(
|
||||
$node->server_name().' » '.$item['name']
|
||||
),
|
||||
];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
foreach ($node_services as $ns) {
|
||||
foreach ($ns as $k => $ser) {
|
||||
$services[$ser['id']] = $ser['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
$services,
|
||||
@ -4744,6 +4829,7 @@ $(document).ready (function () {
|
||||
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
var modules_multiple = $('#module').val();
|
||||
@ -4878,6 +4964,7 @@ $(document).ready (function () {
|
||||
}
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
var modules_multiple = $('#module').val();
|
||||
@ -5330,6 +5417,11 @@ function addSLARow() {
|
||||
var slaMax = $("input[name=sla_max]").val();
|
||||
var slaLimit = $("input[name=sla_limit]").val();
|
||||
var serviceId = $("select#id_service>option:selected").val();
|
||||
if(serviceId != '' && serviceId.split('|').length > 1 ) {
|
||||
var ids = serviceId.split('|');
|
||||
serverId = ids[0];
|
||||
serviceId = ids[1];
|
||||
}
|
||||
var serviceName = $("select#id_service>option:selected").text();
|
||||
|
||||
if ((((idAgent != '') && (idAgent > 0))
|
||||
@ -6345,9 +6437,10 @@ function chooseType() {
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
$("#row_module_group").show();
|
||||
case 'agent_module_status':
|
||||
$("#row_description").show();
|
||||
$("#row_group").show();
|
||||
$("#row_module_group").show();
|
||||
$("#select_agent_modules").show();
|
||||
$("#agents_modules_row").show();
|
||||
$("#modules_row").show();
|
||||
@ -6579,6 +6672,16 @@ function chooseType() {
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_top_N':
|
||||
$("#row_netflow_filter").show();
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$("#row_network_filter").show();
|
||||
$("#row_alive_ip").show();
|
||||
|
@ -938,7 +938,7 @@ switch ($action) {
|
||||
$table->head[$next] = __('Private');
|
||||
$table->headstyle[$next] = 'min-width: 40px;text-align: left;';
|
||||
$table->size[$next] = '2%';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->align[$next] = '';
|
||||
} else {
|
||||
$table->align[$next] = 'left';
|
||||
@ -952,7 +952,7 @@ switch ($action) {
|
||||
|
||||
$next++;
|
||||
$op_column = false;
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
$op_column = true;
|
||||
$table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox(
|
||||
'all_delete',
|
||||
@ -967,6 +967,8 @@ switch ($action) {
|
||||
// $table->size = array ();
|
||||
$table->size[$next] = '10%';
|
||||
$table->align[$next] = 'right';
|
||||
} else {
|
||||
$table->size[1] = '40%';
|
||||
}
|
||||
|
||||
$columnview = false;
|
||||
@ -1266,7 +1268,7 @@ switch ($action) {
|
||||
|| check_acl($config['id_user'], 0, 'RM')
|
||||
) {
|
||||
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new&pure='.$pure.'">';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
echo '<div class="action-buttons w100p">';
|
||||
} else {
|
||||
echo '<div class="action-buttons w100p">';
|
||||
@ -1653,6 +1655,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
|
||||
@ -1750,6 +1753,7 @@ switch ($action) {
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
case 'netflow_top_N':
|
||||
$values['text'] = get_parameter(
|
||||
'netflow_filter'
|
||||
);
|
||||
@ -2454,6 +2458,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text');
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
|
||||
@ -2549,6 +2554,7 @@ switch ($action) {
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
case 'netflow_top_N':
|
||||
$values['text'] = get_parameter(
|
||||
'netflow_filter'
|
||||
);
|
||||
@ -3552,25 +3558,6 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
|
||||
}
|
||||
|
||||
if ($resultOperationDB !== null) {
|
||||
$err = '';
|
||||
switch ($_POST['type']) {
|
||||
case 'custom_graph':
|
||||
$err .= 'You must enter custom graph';
|
||||
break;
|
||||
|
||||
case 'SLA':
|
||||
$err .= 'You must enter some character in SLA limit field';
|
||||
default:
|
||||
$err .= '';
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$resultOperationDB,
|
||||
__('Successfull action'),
|
||||
__('Unsuccessful action<br><br>'.$err)
|
||||
);
|
||||
|
||||
if ($action == 'update') {
|
||||
$buttons[$activeTab]['active'] = false;
|
||||
$activeTab = 'list_items';
|
||||
@ -3598,6 +3585,25 @@ if ($resultOperationDB !== null) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$err = '';
|
||||
switch ($_POST['type']) {
|
||||
case 'custom_graph':
|
||||
$err .= 'You must enter custom graph';
|
||||
break;
|
||||
|
||||
case 'SLA':
|
||||
$err .= 'You must enter some character in SLA limit field';
|
||||
default:
|
||||
$err .= '';
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$resultOperationDB,
|
||||
__('Successfull action'),
|
||||
__('Unsuccessful action<br><br>'.$err)
|
||||
);
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
|
@ -170,7 +170,7 @@ $table->data[2][0] = __('Background');
|
||||
$table->data[2][1] = html_print_select(
|
||||
$backgrounds_list,
|
||||
'background',
|
||||
$background,
|
||||
io_safe_output($background),
|
||||
'',
|
||||
'None',
|
||||
'None.png',
|
||||
|
@ -47,6 +47,8 @@ if (isset($_GET['server'])) {
|
||||
$exec_server_enable = __('Yes');
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = '100%';
|
||||
|
@ -262,7 +262,8 @@ if ($filemanager) {
|
||||
'index.php?sec=gservers&sec2=godmode/servers/plugin'.$chunck_url.'&plugin_command=[FILE_FULLPATH]&id_plugin='.$id_plugin,
|
||||
true,
|
||||
0775,
|
||||
false
|
||||
false,
|
||||
['all' => true]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -65,13 +65,22 @@ $real_directory = realpath($config['homedir'].'/'.$directory);
|
||||
|
||||
echo '<h4>'.__('Index of %s', $directory).'</h4>';
|
||||
|
||||
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
|
||||
$upload_file = (bool) get_parameter('upload_file');
|
||||
$create_text_file = (bool) get_parameter('create_text_file');
|
||||
|
||||
$default_real_directory = realpath($config['homedir'].'/');
|
||||
|
||||
if ($upload_file_or_zip === true) {
|
||||
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
|
||||
if ($upload_file === true) {
|
||||
upload_file(
|
||||
$upload_file,
|
||||
$default_real_directory,
|
||||
$real_directory,
|
||||
[
|
||||
MIME_TYPES['jpg'],
|
||||
MIME_TYPES['png'],
|
||||
MIME_TYPES['gif'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($create_text_file === true) {
|
||||
@ -89,5 +98,6 @@ filemanager_file_explorer(
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false
|
||||
false,
|
||||
[]
|
||||
);
|
||||
|
@ -504,9 +504,9 @@ $table_other->style[0] = 'font-weight: bold';
|
||||
|
||||
$table_other->size[0] = '70%';
|
||||
$table_other->size[1] = '30%';
|
||||
|
||||
$table_other->data[1][0] = __('Item limit for realtime reports');
|
||||
$table_other->data[1][1] = html_print_input_text(
|
||||
$i = 0;
|
||||
$table_other->data[$i][0] = __('Item limit for realtime reports');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'report_limit',
|
||||
$config['report_limit'],
|
||||
'',
|
||||
@ -515,8 +515,8 @@ $table_other->data[1][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
$table_other->data[2][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'step_compact',
|
||||
$config['step_compact'],
|
||||
'',
|
||||
@ -535,8 +535,8 @@ $intervals[SECONDS_1WEEK] = __('Last week');
|
||||
$intervals[SECONDS_2WEEK] = __('2 weeks');
|
||||
$intervals[SECONDS_1MONTH] = __('Last month');
|
||||
|
||||
$table_other->data[3][0] = __('Default hours for event view');
|
||||
$table_other->data[3][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Default hours for event view');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'event_view_hr',
|
||||
$config['event_view_hr'],
|
||||
'',
|
||||
@ -545,16 +545,16 @@ $table_other->data[3][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[5][0] = __('Use realtime statistics');
|
||||
$table_other->data[5][1] = html_print_checkbox_switch(
|
||||
$table_other->data[$i][0] = __('Use realtime statistics');
|
||||
$table_other->data[$i++][1] = html_print_checkbox_switch(
|
||||
'realtimestats',
|
||||
1,
|
||||
$config['realtimestats'],
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[6][0] = __('Batch statistics period (secs)');
|
||||
$table_other->data[6][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Batch statistics period (secs)');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'stats_interval',
|
||||
$config['stats_interval'],
|
||||
'',
|
||||
@ -563,11 +563,11 @@ $table_other->data[6][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[7][0] = __('Use agent access graph');
|
||||
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
$table_other->data[$i][0] = __('Use agent access graph');
|
||||
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
|
||||
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
|
||||
$table_other->data[8][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'num_files_attachment',
|
||||
$config['num_files_attachment'],
|
||||
'',
|
||||
@ -576,11 +576,11 @@ $table_other->data[8][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[9][0] = __('Delete not init modules');
|
||||
$table_other->data[9][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
$table_other->data[$i][0] = __('Delete not init modules');
|
||||
$table_other->data[$i++][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
|
||||
$table_other->data[10][0] = __('Big Operation Step to purge old data');
|
||||
$table_other->data[10][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Big Operation Step to purge old data');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'big_operation_step_datos_purge',
|
||||
$config['big_operation_step_datos_purge'],
|
||||
'',
|
||||
@ -589,8 +589,8 @@ $table_other->data[10][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[11][0] = __('Small Operation Step to purge old data');
|
||||
$table_other->data[11][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Small Operation Step to purge old data');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'small_operation_step_datos_purge',
|
||||
$config['small_operation_step_datos_purge'],
|
||||
'',
|
||||
@ -599,8 +599,8 @@ $table_other->data[11][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[12][0] = __('Graph container - Max. Items');
|
||||
$table_other->data[12][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Graph container - Max. Items');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'max_graph_container',
|
||||
$config['max_graph_container'],
|
||||
'',
|
||||
@ -609,8 +609,8 @@ $table_other->data[12][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[13][0] = __('Events response max. execution');
|
||||
$table_other->data[13][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Events response max. execution');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'max_execution_event_response',
|
||||
$config['max_execution_event_response'],
|
||||
'',
|
||||
@ -619,8 +619,8 @@ $table_other->data[13][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[14][0] = __('Row limit in csv log');
|
||||
$table_other->data[14][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('Row limit in csv log');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'row_limit_csv',
|
||||
$config['row_limit_csv'],
|
||||
'',
|
||||
@ -629,8 +629,8 @@ $table_other->data[14][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[15][0] = __('SNMP walk binary');
|
||||
$table_other->data[15][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('SNMP walk binary');
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'snmpwalk',
|
||||
$config['snmpwalk'],
|
||||
'',
|
||||
@ -643,8 +643,8 @@ $tip = ui_print_help_tip(
|
||||
__('SNMP bulk walk is not able to request V1 SNMP, this option will be used instead (by default snmpwalk, slower).'),
|
||||
true
|
||||
);
|
||||
$table_other->data[16][0] = __('SNMP walk binary (fallback)').$tip;
|
||||
$table_other->data[16][1] = html_print_input_text(
|
||||
$table_other->data[$i][0] = __('SNMP walk binary (fallback)').$tip;
|
||||
$table_other->data[$i++][1] = html_print_input_text(
|
||||
'snmpwalk_fallback',
|
||||
$config['snmpwalk_fallback'],
|
||||
'',
|
||||
@ -653,6 +653,31 @@ $table_other->data[16][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$tip = ui_print_help_tip(
|
||||
__(
|
||||
'%s web2image cache system cleanup. It is always cleaned up after perform an upgrade',
|
||||
get_product_name()
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
|
||||
$table_other->data[$i++][1] = html_print_input(
|
||||
[
|
||||
'type' => 'select',
|
||||
'name' => 'phantomjs_cache_interval',
|
||||
'return' => true,
|
||||
'fields' => [
|
||||
PHANTOM_CACHE_CLEANUP_ONCE => __('No scheduled'),
|
||||
PHANTOM_CACHE_CLEANUP_WEEKLY => __('Each week'),
|
||||
PHANTOM_CACHE_CLEANUP_DAILY => __('Each day'),
|
||||
],
|
||||
'selected' => ($config['phantomjs_cache_interval'] ?? PHANTOM_CACHE_CLEANUP_ONCE),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
|
||||
echo '<fieldset class="full-column">';
|
||||
|
@ -324,6 +324,16 @@ if ($create_user) {
|
||||
|
||||
$user_is_admin = (int) get_parameter('is_admin', 0);
|
||||
|
||||
if (users_is_admin() === false && $user_is_admin !== 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to create with administrator privileges to user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['id_user'] = (string) get_parameter('id_user');
|
||||
$values['fullname'] = (string) get_parameter('fullname');
|
||||
@ -538,6 +548,16 @@ if ($update_user) {
|
||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
|
||||
|
||||
if (users_is_admin() === false && (bool) $values['is_admin'] !== false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add administrator privileges to user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// eHorus user level conf.
|
||||
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
|
||||
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
|
||||
@ -1247,10 +1267,15 @@ $session_time .= html_print_input_text(
|
||||
|
||||
$user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group))));
|
||||
|
||||
if (empty($user_groups) === false) {
|
||||
$event_filter_data = db_get_all_rows_sql('SELECT id_name, id_filter FROM tevent_filter WHERE id_group_filter IN ('.$user_groups.')');
|
||||
if ($event_filter_data === false) {
|
||||
$event_filter_data = [];
|
||||
}
|
||||
} else {
|
||||
$event_filter_data = [];
|
||||
}
|
||||
|
||||
|
||||
$event_filter = [];
|
||||
$event_filter[0] = __('None');
|
||||
|
@ -260,9 +260,21 @@ if (is_metaconsole() === true) {
|
||||
|
||||
|
||||
$disable_user = get_parameter('disable_user', false);
|
||||
if ((bool) get_parameter('user_del', false) === true) {
|
||||
$delete_user = (bool) get_parameter('user_del', false);
|
||||
|
||||
if ($delete_user === true) {
|
||||
// Delete user.
|
||||
$id_user = get_parameter('delete_user', 0);
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to delete admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Only allow delete user if is not the actual user.
|
||||
if ($id_user != $config['id_user']) {
|
||||
$user_row = users_get_user_by_id($id_user);
|
||||
@ -332,6 +344,16 @@ if ((bool) get_parameter('user_del', false) === true) {
|
||||
// Disable_user.
|
||||
$id_user = get_parameter('id', 0);
|
||||
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to disable admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($id_user !== 0) {
|
||||
$result = users_disable($id_user, $disable_user);
|
||||
} else {
|
||||
@ -545,6 +567,13 @@ if ($search) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($info1 as $user_id => $user_info) {
|
||||
// If user is not admin then don't display admin users.
|
||||
if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) {
|
||||
unset($info1[$user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination.
|
||||
@ -557,11 +586,6 @@ $rowPair = true;
|
||||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!$user_is_admin && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter(
|
||||
@ -853,6 +877,7 @@ if ($is_management_allowed === true) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
@ -37,6 +37,7 @@ $ajax = true;
|
||||
$render_map = (bool) get_parameter('render_map', false);
|
||||
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
||||
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
||||
$load_css_cv = (bool) get_parameter('load_css_cv', false);
|
||||
|
||||
if ($render_map) {
|
||||
$width = (int) get_parameter('width', '400');
|
||||
@ -89,3 +90,12 @@ if ($force_remote_check) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_css_cv === true) {
|
||||
$uniq = get_parameter('uniq', 0);
|
||||
$ratio = get_parameter('ratio', 0);
|
||||
|
||||
$output = css_label_styles_visual_console($uniq, $ratio);
|
||||
echo $output;
|
||||
return;
|
||||
}
|
||||
|
@ -544,11 +544,6 @@ class AgentWizard extends HTML
|
||||
// Get the servers.
|
||||
$rows = get_proxy_servers();
|
||||
|
||||
// Check if satellite server has remote configuration enabled.
|
||||
$satellite_remote = config_agents_has_remote_configuration(
|
||||
$this->idAgent
|
||||
);
|
||||
|
||||
// Generate a list with allowed servers.
|
||||
if (isset($rows) === true && is_array($rows) === true) {
|
||||
foreach ($rows as $row) {
|
||||
|
@ -158,7 +158,9 @@ class CredentialStore extends Wizard
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === false
|
||||
|| (bool) check_acl($config['id_user'], 0, 'UM') === false
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access credential store'
|
||||
|
@ -167,8 +167,10 @@ class Tree
|
||||
*/
|
||||
protected function getDisabledFilter()
|
||||
{
|
||||
$only_disabled = (is_metaconsole() === true) ? (int) $this->filter['show_disabled'] : 0;
|
||||
|
||||
if (empty($this->filter['showDisabled'])) {
|
||||
return ' tam.disabled = 0 AND ta.disabled = 0';
|
||||
return ' tam.disabled = 0 AND ta.disabled = '.$only_disabled;
|
||||
}
|
||||
|
||||
return ' 1 = 1';
|
||||
|
@ -311,13 +311,14 @@ class TreeGroup extends Tree
|
||||
|
||||
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
|
||||
$table_sec = is_metaconsole() ? 'tmetaconsole_agent_secondary_group' : 'tagent_secondary_group';
|
||||
$only_disabled = (is_metaconsole() === true) ? (int) $this->filter['show_disabled'] : 0;
|
||||
|
||||
$sql_model = "SELECT %s FROM
|
||||
(
|
||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
||||
FROM $table ta
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
WHERE ta.disabled = $only_disabled
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
@ -330,7 +331,7 @@ class TreeGroup extends Tree
|
||||
FROM $table ta INNER JOIN $table_sec tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
$module_search_inner
|
||||
WHERE ta.disabled = 0
|
||||
WHERE ta.disabled = $only_disabled
|
||||
%s
|
||||
$agent_search_filter
|
||||
$agent_status_filter
|
||||
@ -390,37 +391,29 @@ class TreeGroup extends Tree
|
||||
$groups[$group['id']] = $group;
|
||||
}
|
||||
|
||||
// Build the module hierarchy
|
||||
// Build the module hierarchy.
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
if (isset($groups[$id]['parent']) === true && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
// Parent exists.
|
||||
if (isset($groups[$parent]['children']) === true) {
|
||||
$groups[$parent]['children'] = [];
|
||||
}
|
||||
|
||||
// Store a reference to the group into the parent
|
||||
// Store a reference to the group into the parent.
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
// This group was introduced into a parent.
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the children groups
|
||||
// Sort the children groups.
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
if (isset($groups[$id]['children']) === true) {
|
||||
usort($groups[$id]['children'], ['Tree', 'cmpSortNames']);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter(
|
||||
$groups,
|
||||
function ($group) {
|
||||
return !($group['have_parent'] ?? false);
|
||||
}
|
||||
);
|
||||
|
||||
return array_values($groups);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220308';
|
||||
$build_version = 'PC220323';
|
||||
$pandora_version = 'v7.0NG.760';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -108,6 +108,11 @@ define('SECONDS_1YEAR', 31536000);
|
||||
define('SECONDS_2YEARS', 63072000);
|
||||
define('SECONDS_3YEARS', 94608000);
|
||||
|
||||
// PhantomJS Cache cleanup intervals.
|
||||
define('PHANTOM_CACHE_CLEANUP_ONCE', 0);
|
||||
define('PHANTOM_CACHE_CLEANUP_WEEKLY', SECONDS_1WEEK);
|
||||
define('PHANTOM_CACHE_CLEANUP_DAILY', SECONDS_1DAY);
|
||||
|
||||
|
||||
|
||||
// Separator constats.
|
||||
@ -788,6 +793,7 @@ define('AUDIT_LOG_MASSIVE_MANAGEMENT', 'Massive operation management');
|
||||
define('AUDIT_LOG_POLICY_MANAGEMENT', 'Policy management');
|
||||
define('AUDIT_LOG_AGENT_REMOTE_MANAGEMENT', 'Agent remote configuration');
|
||||
define('AUDIT_LOG_FILE_COLLECTION', 'File collection');
|
||||
define('AUDIT_LOG_FILE_MANAGER', 'File manager');
|
||||
define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management');
|
||||
define('AUDIT_LOG_ALERT_CORRELATION_MANAGEMENT', 'Alert correlation management');
|
||||
define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management');
|
||||
@ -796,3 +802,58 @@ define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
|
||||
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
|
||||
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
|
||||
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
|
||||
|
||||
// MIMEs.
|
||||
define(
|
||||
'MIME_TYPES',
|
||||
[
|
||||
'txt' => 'text/plain',
|
||||
'htm' => 'text/html',
|
||||
'html' => 'text/html',
|
||||
'php' => 'text/html',
|
||||
'css' => 'text/css',
|
||||
'js' => 'application/javascript',
|
||||
'json' => 'application/json',
|
||||
'xml' => 'application/xml',
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'flv' => 'video/x-flv',
|
||||
// Images.
|
||||
'png' => 'image/png',
|
||||
'jpe' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'jpg' => 'image/jpeg',
|
||||
'gif' => 'image/gif',
|
||||
'bmp' => 'image/bmp',
|
||||
'ico' => 'image/vnd.microsoft.icon',
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'svg' => 'image/svg+xml',
|
||||
'svgz' => 'image/svg+xml',
|
||||
// Archives.
|
||||
'zip' => 'application/zip',
|
||||
'rar' => 'application/x-rar-compressed',
|
||||
'exe' => 'application/x-msdownload',
|
||||
'msi' => 'application/x-msdownload',
|
||||
'cab' => 'application/vnd.ms-cab-compressed',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gz' => 'application/x-bzip2',
|
||||
// Audio/Video.
|
||||
'mp3' => 'audio/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
// Adobe.
|
||||
'pdf' => 'application/pdf',
|
||||
'psd' => 'image/vnd.adobe.photoshop',
|
||||
'ai' => 'application/postscript',
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
// MS Office.
|
||||
'doc' => 'application/msword',
|
||||
'rtf' => 'application/rtf',
|
||||
'xls' => 'application/vnd.ms-excel',
|
||||
'ppt' => 'application/vnd.ms-powerpoint',
|
||||
// Open Source Office files.
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
]
|
||||
);
|
||||
|
@ -750,6 +750,7 @@ function agents_get_agents_selected($group)
|
||||
'id_tmetaconsole_setup',
|
||||
'id_agente',
|
||||
'alias',
|
||||
'server_name',
|
||||
],
|
||||
'AR',
|
||||
[
|
||||
@ -764,7 +765,7 @@ function agents_get_agents_selected($group)
|
||||
$all = array_reduce(
|
||||
$all,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_tmetaconsole_setup'].'|'.$item['id_tagente']] = $item['alias'];
|
||||
$carry[$item['id_tmetaconsole_setup'].'|'.$item['id_tagente']] = $item['server_name'].' » '.$item['alias'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
@ -1243,6 +1244,11 @@ function agents_get_group_agents(
|
||||
unset($search['string']);
|
||||
}
|
||||
|
||||
if (isset($search['matchIds']) === true && is_array($search['matchIds']) === true) {
|
||||
$filter[] = sprintf('id_agente IN (%s)', implode(', ', $search['matchIds']));
|
||||
unset($search['matchIds']);
|
||||
}
|
||||
|
||||
if (isset($search['name']) === true) {
|
||||
$name = io_safe_input($search['name']);
|
||||
$filter[] = "nombre LIKE '$name'";
|
||||
@ -3223,8 +3229,8 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
|
||||
$ni_by_agents = [];
|
||||
foreach ($agents as $agent) {
|
||||
$agent_id = (isset($agent['id_agente'])) ? $agent['id_agente'] : $agent;
|
||||
$agent_group_id = $agent['id_grupo'];
|
||||
$agent_name = $agent['alias'];
|
||||
$agent_group_id = (isset($agent['id_grupo']) === true) ? $agent['id_grupo'] : '';
|
||||
$agent_name = (isset($agent['alias']) === true) ? $agent['alias'] : '';
|
||||
$agent_interfaces = [];
|
||||
|
||||
$accepted_module_types = [];
|
||||
@ -4180,3 +4186,78 @@ function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups
|
||||
|
||||
return $agents;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Agent Module status and data
|
||||
*
|
||||
* @param integer $id_group Group
|
||||
* @param array $agents Agents filter.
|
||||
* @param array $modules Modules filter.
|
||||
*
|
||||
* @return array Result.
|
||||
*/
|
||||
function get_status_data_agent_modules($id_group, $agents=[], $modules=[])
|
||||
{
|
||||
$slq_filter_group = '';
|
||||
if (empty($id_group) === false) {
|
||||
$slq_filter_group = sprintf(
|
||||
' AND tagente.id_grupo = %d',
|
||||
$id_group
|
||||
);
|
||||
}
|
||||
|
||||
$slq_filter_agent = '';
|
||||
if (empty($agents) === false) {
|
||||
$slq_filter_agent = sprintf(
|
||||
' AND tagente_modulo.id_agente IN (%s)',
|
||||
implode(',', $agents)
|
||||
);
|
||||
}
|
||||
|
||||
$slq_filter_module = '';
|
||||
if (empty($modules) === false) {
|
||||
$slq_filter_module = sprintf(
|
||||
' AND tagente_modulo.id_agente_modulo IN (%s)',
|
||||
implode(',', $modules)
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT tagente_modulo.id_agente_modulo as id_agent_module,
|
||||
tagente_modulo.nombre as name_module,
|
||||
tagente_modulo.unit as unit_module,
|
||||
tagente_modulo.id_agente as id_agent,
|
||||
tagente_estado.datos as data_module,
|
||||
tagente_estado.timestamp as data_time_module,
|
||||
tagente_estado.estado as status_module,
|
||||
tagente.alias as name_agent,
|
||||
tagente.id_grupo as id_group,
|
||||
tgrupo.nombre as name_group
|
||||
FROM tagente_modulo
|
||||
INNER JOIN tagente_estado
|
||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
INNER JOIN tagente
|
||||
ON tagente_modulo.id_agente = tagente.id_agente
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||
INNER JOIN tgrupo
|
||||
ON tagente.id_grupo = tgrupo.id_grupo
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
',
|
||||
$slq_filter_group,
|
||||
$slq_filter_agent,
|
||||
$slq_filter_module
|
||||
);
|
||||
|
||||
$res = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($res === false) {
|
||||
$res = [];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
@ -13630,7 +13630,7 @@ function api_get_netflow_get_stats($discard_1, $discard_2, $params)
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse function parameters
|
||||
// Parse function parameters.
|
||||
$start_date = $params['data'][0];
|
||||
$end_date = $params['data'][1];
|
||||
$filter = json_decode(base64_decode($params['data'][2]), true);
|
||||
@ -13647,10 +13647,38 @@ function api_get_netflow_get_stats($discard_1, $discard_2, $params)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $trash1 Don't use.
|
||||
* @param $trash2 Don't use.
|
||||
* @param array $params Call parameters.
|
||||
* @return void
|
||||
*/
|
||||
function api_get_netflow_get_top_N($trash1, $trash2, $params)
|
||||
{
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse function parameters.
|
||||
$start_date = $params['data'][0];
|
||||
$end_date = $params['data'][1];
|
||||
$filter = json_decode(base64_decode($params['data'][2]), true);
|
||||
$max = $params['data'][3];
|
||||
|
||||
// Get netflow data.
|
||||
$data = netflow_get_top_N($start_date, $end_date, $filter, $max, '');
|
||||
|
||||
returnData('json', $data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// http://localhost/pandora_console/include/api.php?op=get&op2=netflow_get_summary&other=1348562410|1348648810|_base64_encode(json_encode($filter))&other_mode=url_encode_separator_|&apipass=pandora&user=pandora&pass=pandora'
|
||||
function api_get_netflow_get_summary($discard_1, $discard_2, $params)
|
||||
{
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -891,6 +891,25 @@ function config_update_config()
|
||||
if (config_update_value('snmpwalk_fallback', get_parameter('snmpwalk_fallback'), true) === false) {
|
||||
$error_update[] = __('SNMP walk binary path (fallback for v1)');
|
||||
}
|
||||
|
||||
$pjs = get_parameter('phantomjs_cache_interval');
|
||||
switch ($pjs) {
|
||||
case $config['phantomjs_cache_interval']:
|
||||
default;
|
||||
// No changes.
|
||||
break;
|
||||
|
||||
case PHANTOM_CACHE_CLEANUP_ONCE:
|
||||
case PHANTOM_CACHE_CLEANUP_DAILY:
|
||||
case PHANTOM_CACHE_CLEANUP_WEEKLY:
|
||||
enterprise_hook('phantomjs_cache_interval_schedule', [$pjs]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (config_update_value('phantomjs_cache_interval', get_parameter('phantomjs_cache_interval'), true) === false
|
||||
) {
|
||||
$error_update[] = __('PhantomJS cache interval');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vis':
|
||||
|
@ -4166,11 +4166,24 @@ function events_get_response_target(
|
||||
}
|
||||
|
||||
// Parse the event custom data.
|
||||
if (!empty($event['custom_data'])) {
|
||||
if (empty($event['custom_data']) === false) {
|
||||
$custom_data = json_decode(base64_decode($event['custom_data']));
|
||||
foreach ($custom_data as $key => $value) {
|
||||
$target = str_replace('_customdata_'.$key.'_', $value, $target);
|
||||
}
|
||||
|
||||
if (strpos($target, '_customdata_json_') !== false) {
|
||||
$target = str_replace('_customdata_json_', json_encode($custom_data), $target);
|
||||
}
|
||||
|
||||
if (strpos($target, '_customdata_text_') !== false) {
|
||||
$text = '';
|
||||
foreach ($custom_data as $key => $value) {
|
||||
$text .= $key.': '.$value.PHP_EOL;
|
||||
}
|
||||
|
||||
$target = str_replace('_customdata_text_', $text, $target);
|
||||
}
|
||||
}
|
||||
|
||||
// This will replace the macro with the current logged user.
|
||||
@ -4187,6 +4200,28 @@ function events_get_response_target(
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($target, '_owner_username_') !== false) {
|
||||
if (empty($event['owner_user']) === false) {
|
||||
$fullname = users_get_user_by_id($event['owner_user']);
|
||||
$target = str_replace(
|
||||
'_owner_username_',
|
||||
io_safe_output($fullname['fullname']),
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$target = str_replace('_owner_username_', __('N/A'), $target);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($target, '_current_username_') !== false) {
|
||||
$fullname = users_get_user_by_id($config['id_user']);
|
||||
$target = str_replace(
|
||||
'_current_username_',
|
||||
io_safe_output($fullname['fullname']),
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
||||
@ -7588,6 +7623,28 @@ function events_get_field_value_by_event_id(
|
||||
$value = str_replace('_current_user_', $config['id_user'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_owner_username_') !== false) {
|
||||
if (empty($event['owner_user']) === false) {
|
||||
$fullname = users_get_user_by_id($event['owner_user']);
|
||||
$value = str_replace(
|
||||
'_owner_username_',
|
||||
io_safe_output($fullname['fullname']),
|
||||
$value
|
||||
);
|
||||
} else {
|
||||
$value = str_replace('_owner_username_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_current_username_') !== false) {
|
||||
$fullname = users_get_user_by_id($config['id_user']);
|
||||
$value = str_replace(
|
||||
'_current_username_',
|
||||
io_safe_output($fullname['fullname']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -48,69 +48,22 @@ if (function_exists('mime_content_type') === false) {
|
||||
*/
|
||||
function mime_content_type(string $filename)
|
||||
{
|
||||
$mime_types = [
|
||||
'txt' => 'text/plain',
|
||||
'htm' => 'text/html',
|
||||
'html' => 'text/html',
|
||||
'php' => 'text/html',
|
||||
'css' => 'text/css',
|
||||
'js' => 'application/javascript',
|
||||
'json' => 'application/json',
|
||||
'xml' => 'application/xml',
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'flv' => 'video/x-flv',
|
||||
// Images.
|
||||
'png' => 'image/png',
|
||||
'jpe' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'jpg' => 'image/jpeg',
|
||||
'gif' => 'image/gif',
|
||||
'bmp' => 'image/bmp',
|
||||
'ico' => 'image/vnd.microsoft.icon',
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'svg' => 'image/svg+xml',
|
||||
'svgz' => 'image/svg+xml',
|
||||
// Archives.
|
||||
'zip' => 'application/zip',
|
||||
'rar' => 'application/x-rar-compressed',
|
||||
'exe' => 'application/x-msdownload',
|
||||
'msi' => 'application/x-msdownload',
|
||||
'cab' => 'application/vnd.ms-cab-compressed',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gz' => 'application/x-bzip2',
|
||||
// Audio/Video.
|
||||
'mp3' => 'audio/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
// Adobe.
|
||||
'pdf' => 'application/pdf',
|
||||
'psd' => 'image/vnd.adobe.photoshop',
|
||||
'ai' => 'application/postscript',
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
// MS Office.
|
||||
'doc' => 'application/msword',
|
||||
'rtf' => 'application/rtf',
|
||||
'xls' => 'application/vnd.ms-excel',
|
||||
'ppt' => 'application/vnd.ms-powerpoint',
|
||||
// Open Source Office files.
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
];
|
||||
|
||||
$ext_fields = explode('.', $filename);
|
||||
$ext = array_pop($ext_fields);
|
||||
$ext = strtolower($ext);
|
||||
if (array_key_exists($ext, $mime_types) === true) {
|
||||
return $mime_types[$ext];
|
||||
if (array_key_exists($ext, MIME_TYPES) === true) {
|
||||
return MIME_TYPES[$ext];
|
||||
} else if (function_exists('finfo_open') === true) {
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$mimetype = finfo_file($finfo, $filename);
|
||||
finfo_close($finfo);
|
||||
return $mimetype;
|
||||
} else {
|
||||
error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini');
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_FILE_MANAGER,
|
||||
'Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini'
|
||||
);
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
@ -129,10 +82,12 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
||||
* @param boolean $upload_file_or_zip Upload file or zip.
|
||||
* @param string $default_real_directory String with default directory.
|
||||
* @param string $destination_directory String with destination directory.
|
||||
* @param array $filterFilesType If come filled, filter uploaded files with this extensions.
|
||||
*
|
||||
* @throws Exception Exception.
|
||||
* @return void
|
||||
*/
|
||||
function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory)
|
||||
function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory, $filterFilesType=[])
|
||||
{
|
||||
global $config;
|
||||
$config['filemanager'] = [];
|
||||
@ -179,13 +134,24 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
||||
// controlled by corresponding .htaccess).
|
||||
$config['filemanager']['message'] = ui_print_error_message(__('Security error'));
|
||||
} else {
|
||||
$result = false;
|
||||
// Copy file to directory and change name.
|
||||
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
|
||||
|
||||
try {
|
||||
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
|
||||
|
||||
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
|
||||
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
|
||||
} else {
|
||||
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
|
||||
throw new Exception(__($error_message));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
$result = false;
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_FILE_MANAGER,
|
||||
'Error Uploading files: '.$ex->getMessage()
|
||||
);
|
||||
$config['filemanager']['message'] = ui_print_error_message(__('Upload error').': '.$ex->getMessage());
|
||||
}
|
||||
|
||||
if ($result === true) {
|
||||
@ -203,8 +169,6 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
||||
$config['filemanager']['correct_upload_file'] = 1;
|
||||
// Delete temporal file.
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
} else {
|
||||
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -496,7 +460,7 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
|
||||
* @param boolean $download_button The flag to show download button, by default false.
|
||||
* @param string $umask The umask as hex values to set the new files or updload.
|
||||
* @param boolean $homedir_filemanager Homedir filemanager.
|
||||
* @param boolean $allowCreateText If true, 'Create Text' button will be shown.
|
||||
* @param array $options Associative array. ['all' => true] will show all options. Check function for valid options.
|
||||
*/
|
||||
function filemanager_file_explorer(
|
||||
$real_directory,
|
||||
@ -509,7 +473,7 @@ function filemanager_file_explorer(
|
||||
$download_button=false,
|
||||
$umask='',
|
||||
$homedir_filemanager=false,
|
||||
$allowCreateText=true
|
||||
$options=[]
|
||||
) {
|
||||
global $config;
|
||||
|
||||
@ -517,6 +481,9 @@ function filemanager_file_explorer(
|
||||
$real_directory = str_replace('\\', '/', $real_directory);
|
||||
$relative_directory = str_replace('\\', '/', $relative_directory);
|
||||
$father = str_replace('\\', '/', $father);
|
||||
// Options.
|
||||
$allowZipFiles = (isset($options['all']) === true) || ((isset($options['allowZipFiles']) === true) && ($options['allowZipFiles'] === true));
|
||||
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
|
||||
|
||||
if ($homedir_filemanager === false) {
|
||||
$homedir_filemanager = $config['homedir'];
|
||||
@ -839,15 +806,86 @@ function filemanager_file_explorer(
|
||||
|
||||
$tabs_dialog .= '</ul>';
|
||||
|
||||
echo '<div id="create_folder" class="invisible">'.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).'</form></div>';
|
||||
// Create folder section.
|
||||
$createFolderElements = $tabs_dialog;
|
||||
$createFolderElements .= sprintf('<form method="POST" action="%s">', $url);
|
||||
$createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true);
|
||||
$createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true);
|
||||
$createFolderElements .= html_print_input_hidden('directory', $relative_directory, true);
|
||||
$createFolderElements .= html_print_input_hidden('create_dir', 1, true);
|
||||
$createFolderElements .= html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true);
|
||||
$createFolderElements .= html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true);
|
||||
$createFolderElements .= '</form>';
|
||||
|
||||
echo '<div id="upload_file" class="invisible"> '.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'create_folder',
|
||||
'class' => 'invisible',
|
||||
'content' => $createFolderElements,
|
||||
]
|
||||
);
|
||||
|
||||
// Upload file section.
|
||||
$uploadFileElements = $tabs_dialog;
|
||||
$uploadFileElements .= sprintf('<form method="POST" action="%s" enctype="multipart/form-data">', $url);
|
||||
$uploadFileElements .= html_print_input_hidden('umask', $umask, true);
|
||||
|
||||
if ($allowZipFiles === true) {
|
||||
$uploadFileElements .= ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true);
|
||||
$uploadFileElements .= html_print_input_file('file', true, false);
|
||||
$uploadFileElements .= html_print_checkbox('decompress', 1, false, true).__('Decompress');
|
||||
$uploadFileElements .= html_print_input_hidden('upload_file_or_zip', 1, true);
|
||||
} else {
|
||||
$uploadFileElements .= html_print_div(
|
||||
[
|
||||
'id' => 'upload_file_input_full',
|
||||
'content' => html_print_input_file(
|
||||
'file',
|
||||
true,
|
||||
[ 'style' => 'border:0; padding:0; width:100%' ]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$uploadFileElements .= html_print_input_hidden('upload_file', 1, true);
|
||||
}
|
||||
|
||||
$uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true);
|
||||
$uploadFileElements .= html_print_input_hidden('real_directory', $real_directory, true);
|
||||
$uploadFileElements .= html_print_input_hidden('directory', $relative_directory, true);
|
||||
$uploadFileElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true);
|
||||
$uploadFileElements .= html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true);
|
||||
|
||||
$uploadFileElements .= '</form>';
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'upload_file',
|
||||
'class' => 'invisible',
|
||||
'content' => $uploadFileElements,
|
||||
]
|
||||
);
|
||||
|
||||
// Create text section.
|
||||
if ($allowCreateText === true) {
|
||||
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
|
||||
$createTextElements = $tabs_dialog;
|
||||
$createTextElements .= '<form method="post" action="'.$url.'">';
|
||||
$createTextElements .= html_print_input_text('name_file', '', '', 30, 50, true);
|
||||
$createTextElements .= html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true);
|
||||
$createTextElements .= html_print_input_hidden('real_directory', $real_directory, true);
|
||||
$createTextElements .= html_print_input_hidden('directory', $relative_directory, true);
|
||||
$createTextElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true);
|
||||
$createTextElements .= html_print_input_hidden('umask', $umask, true);
|
||||
$createTextElements .= html_print_input_hidden('create_text_file', 1, true);
|
||||
$createTextElements .= '</form>';
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'create_text_file',
|
||||
'class' => 'invisible',
|
||||
'content' => $createTextElements,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
|
||||
|
@ -4267,6 +4267,10 @@ function html_print_input_file($name, $return=false, $options=false)
|
||||
if (isset($options['onchange'])) {
|
||||
$output .= ' onchange="'.$options['onchange'].'"';
|
||||
}
|
||||
|
||||
if (isset($options['style']) === true) {
|
||||
$output .= ' style="'.$options['style'].'"';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= ' />';
|
||||
@ -4936,7 +4940,13 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : ''),
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false)
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false),
|
||||
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['truncate_size']) === true) ? $data['truncate_size'] : false),
|
||||
((isset($data['select2_enable']) === true) ? $data['select2_enable'] : true),
|
||||
((isset($data['select2_multiple_enable']) === true) ? $data['select2_multiple_enable'] : false),
|
||||
((isset($data['select2_multiple_enable_all']) === true) ? $data['select2_multiple_enable_all'] : false)
|
||||
);
|
||||
break;
|
||||
|
||||
@ -5728,3 +5738,198 @@ function html_print_select_search(
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print html select for agents secondary.
|
||||
*
|
||||
* @param integer $agent Agent.
|
||||
* @param integer $id_agente Id Agent.
|
||||
* @param array $options Array options.
|
||||
*
|
||||
* @return string Html output.
|
||||
*/
|
||||
function html_print_select_agent_secondary($agent, $id_agente, $options=[])
|
||||
{
|
||||
ui_require_css_file('agent_manager');
|
||||
ui_require_javascript_file('pandora_agents');
|
||||
|
||||
if (empty($options) === '' || isset($options['id_form']) === false) {
|
||||
$options['id_form'] = 'form_agent';
|
||||
}
|
||||
|
||||
if (empty($options) === '' || isset($options['extra_id']) === false) {
|
||||
$options['extra_id'] = '';
|
||||
}
|
||||
|
||||
if (empty($options) === '' || isset($options['only_select']) === false) {
|
||||
$options['only_select'] = false;
|
||||
}
|
||||
|
||||
$secondary_groups_selected = enterprise_hook(
|
||||
'agents_get_secondary_groups',
|
||||
[$id_agente]
|
||||
);
|
||||
|
||||
$name = 'secondary_groups'.$options['extra_id'];
|
||||
if ($options['only_select'] === true) {
|
||||
$name = 'secondary_groups'.$options['extra_id'].'[]';
|
||||
}
|
||||
|
||||
$adv_secondary_groups_left = html_print_select_groups(
|
||||
// Id_user.
|
||||
// Use the current user to select the groups.
|
||||
false,
|
||||
// Privilege.
|
||||
// ACL permission.
|
||||
'AR',
|
||||
// ReturnAllGroup.
|
||||
// Not all group.
|
||||
false,
|
||||
// Name.
|
||||
// HTML id.
|
||||
$name,
|
||||
// Selected.
|
||||
// No select any by default.
|
||||
'',
|
||||
// Script.
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing.
|
||||
// Do not user no selected value.
|
||||
false,
|
||||
// Nothing_value.
|
||||
// Do not use no selected value.
|
||||
0,
|
||||
// Return.
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple.
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
// Sorting by default.
|
||||
true,
|
||||
// Class.
|
||||
// CSS classnames (default).
|
||||
'',
|
||||
// Disabled.
|
||||
// Not disabled (default).
|
||||
false,
|
||||
// Style.
|
||||
// Inline styles (default).
|
||||
'min-width:170px;',
|
||||
// Option_style.
|
||||
// Option style select (default).
|
||||
false,
|
||||
// Id_group.
|
||||
// Do not truncate the users tree (default).
|
||||
false,
|
||||
// Keys_field.
|
||||
// Key to get as value (default).
|
||||
'id_grupo',
|
||||
// Strict_user.
|
||||
// Not strict user (default).
|
||||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge(
|
||||
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
|
||||
[$agent['id_grupo']]
|
||||
)
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
);
|
||||
|
||||
if ($options['only_select'] === false) {
|
||||
$dictionary = base64_encode(
|
||||
json_encode(
|
||||
[
|
||||
'primary_group' => __('Primary group cannot be secondary too.'),
|
||||
'strNone' => __('None'),
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$adv_secondary_groups_arrows = html_print_input_image(
|
||||
'add_secondary',
|
||||
'images/darrowright_green.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'id' => 'right_autorefreshlist'.$options['extra_id'],
|
||||
'title' => __('Add secondary groups'),
|
||||
'onclick' => 'agent_manager_add_secondary_groups(event, '.$id_agente.',\''.$options['extra_id'].'\', \''.$options['id_form'].'\', \''.$dictionary.'\');',
|
||||
]
|
||||
);
|
||||
|
||||
$adv_secondary_groups_arrows .= html_print_input_image(
|
||||
'remove_secondary',
|
||||
'images/darrowleft_green.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'id' => 'left_autorefreshlist'.$options['extra_id'],
|
||||
'title' => __('Remove secondary groups'),
|
||||
'onclick' => 'agent_manager_remove_secondary_groups(event, '.$id_agente.',\''.$options['extra_id'].'\', \''.$options['id_form'].'\', \''.$dictionary.'\');',
|
||||
]
|
||||
);
|
||||
|
||||
$adv_secondary_groups_right .= html_print_select(
|
||||
// Values.
|
||||
$secondary_groups_selected['for_select'],
|
||||
// HTML id.
|
||||
'secondary_groups_selected'.$options['extra_id'],
|
||||
// Selected.
|
||||
'',
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing selected.
|
||||
false,
|
||||
// Nothing selected.
|
||||
0,
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
true,
|
||||
// Class.
|
||||
'',
|
||||
// Disabled.
|
||||
false,
|
||||
// Style.
|
||||
'min-width:170px;'
|
||||
);
|
||||
|
||||
$output = '';
|
||||
if (isset($options['container']) === true
|
||||
&& $options['container'] === true
|
||||
) {
|
||||
$output = '<div class="secondary_groups_list">';
|
||||
}
|
||||
|
||||
$output .= '<div class="sg_source">';
|
||||
$output .= $adv_secondary_groups_left;
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="secondary_group_arrows">';
|
||||
$output .= $adv_secondary_groups_arrows;
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="sg_target">';
|
||||
$output .= $adv_secondary_groups_right;
|
||||
$output .= '</div>';
|
||||
|
||||
if (isset($options['container']) === true
|
||||
&& $options['container'] === true
|
||||
) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
} else {
|
||||
$output .= $adv_secondary_groups_left;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -321,6 +321,72 @@ function netflow_data_table($data, $start_date, $end_date, $aggregate)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a table with netflow top N data.
|
||||
*
|
||||
* @param array $data Netflow data.
|
||||
* @param integer $total_bytes Total bytes count to calculate percent data.
|
||||
*
|
||||
* @return string HTML data table.
|
||||
*/
|
||||
function netflow_top_n_table(array $data, int $total_bytes)
|
||||
{
|
||||
global $nfdump_date_format;
|
||||
|
||||
$values = [];
|
||||
$table = new stdClass();
|
||||
$table->class = 'w100p';
|
||||
$table->cellspacing = 0;
|
||||
$table->data = [];
|
||||
|
||||
$table->head = [];
|
||||
$table->head[0] = '<b>'.__('Source IP').'</b>';
|
||||
$table->head[1] = '<b>'.__('Destination IP').'</b>';
|
||||
$table->head[2] = '<b>'.__('Bytes').'</b>';
|
||||
$table->head[3] = '<b>'.__('% Traffic').'</b>';
|
||||
$table->head[4] = '<b>'.__('Avg. Throughput').'</b>';
|
||||
$table->style[0] = 'padding: 4px';
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($data as $value) {
|
||||
$table->data[$i][0] = $value['ip_src'];
|
||||
$table->data[$i][1] = $value['ip_dst'];
|
||||
$table->data[$i][2] = network_format_bytes($value['bytes']);
|
||||
|
||||
$traffic = '-';
|
||||
|
||||
if ($total_bytes > 0) {
|
||||
$traffic = sprintf(
|
||||
'%.2f',
|
||||
(($value['bytes'] / $total_bytes) * 100)
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[$i][3] = $traffic.' %';
|
||||
|
||||
$units = [
|
||||
'bps',
|
||||
'Kbps',
|
||||
'Mbps',
|
||||
'Gbps',
|
||||
'Tbps',
|
||||
];
|
||||
|
||||
$pow = floor((($value['bps'] > 0) ? log($value['bps']) : 0) / log(1024));
|
||||
$pow = min($pow, (count($units) - 1));
|
||||
|
||||
$value['bps'] /= pow(1024, $pow);
|
||||
|
||||
$table->data[$i][4] = round($value['bps'], 2).' '.$units[$pow];
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a table with a traffic summary.
|
||||
*
|
||||
@ -395,6 +461,67 @@ function netflow_is_net($address)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns netflow top N connections for the given period in an array (based on total traffic).
|
||||
*
|
||||
* @param string $start_date Period start date.
|
||||
* @param string $end_date Period end date.
|
||||
* @param array $filter Netflow filter.
|
||||
* @param integer $max Maximum number of aggregates.
|
||||
* @param string $connection_name Node name when data is get in meta.
|
||||
*
|
||||
* @return array An array with netflow stats.
|
||||
*/
|
||||
function netflow_get_top_N(
|
||||
string $start_date,
|
||||
string $end_date,
|
||||
array $filter,
|
||||
int $max,
|
||||
string $connection_name=''
|
||||
) {
|
||||
global $nfdump_date_format;
|
||||
|
||||
// Requesting remote data.
|
||||
if (is_metaconsole() === true && empty($connection_name) === false) {
|
||||
$data = metaconsole_call_remote_api(
|
||||
$connection_name,
|
||||
'netflow_get_top_N',
|
||||
$start_date.'|'.$end_date.'|'.base64_encode(json_encode($filter)).'|'.$max
|
||||
);
|
||||
|
||||
return json_decode($data, true);
|
||||
}
|
||||
|
||||
$options = '-o "fmt:%sap,%dap,%ibyt,%bps" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
|
||||
$command = netflow_get_command($options, $filter);
|
||||
|
||||
// Execute nfdump.
|
||||
exec($command, $lines);
|
||||
|
||||
if (is_array($lines) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$i = 0;
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$parsed_line = explode(',', $line);
|
||||
$parsed_line = array_map('trim', $parsed_line);
|
||||
|
||||
$values[$i]['ip_src'] = $parsed_line[0];
|
||||
$values[$i]['ip_dst'] = $parsed_line[1];
|
||||
$values[$i]['bytes'] = $parsed_line[2];
|
||||
$values[$i]['bps'] = $parsed_line[3];
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns netflow data for the given period in an array.
|
||||
*
|
||||
@ -707,7 +834,7 @@ function netflow_get_summary($start_date, $end_date, $filter, $connection_name='
|
||||
global $config;
|
||||
|
||||
// Requesting remote data.
|
||||
if (defined('METACONSOLE') && $connection_name != '') {
|
||||
if (is_metaconsole() === true && $connection_name != '') {
|
||||
$data = metaconsole_call_remote_api($connection_name, 'netflow_get_summary', "$start_date|$end_date|".base64_encode(json_encode($filter)));
|
||||
return json_decode($data, true);
|
||||
}
|
||||
@ -1051,6 +1178,7 @@ function netflow_get_chart_types()
|
||||
'netflow_area' => __('Area graph'),
|
||||
'netflow_summary' => __('Summary'),
|
||||
'netflow_data' => __('Data table'),
|
||||
'netflow_top_N' => __('Top-N connections'),
|
||||
'netflow_mesh' => __('Circular mesh'),
|
||||
'netflow_host_treemap' => __('Host detailed traffic'),
|
||||
];
|
||||
@ -1218,6 +1346,54 @@ function netflow_draw_item(
|
||||
}
|
||||
break;
|
||||
|
||||
case 'netflow_top_N':
|
||||
$data_summary = netflow_get_summary(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$filter,
|
||||
$connection_name
|
||||
);
|
||||
|
||||
if (empty($data_summary) === true) {
|
||||
break;
|
||||
}
|
||||
|
||||
$data_top_n = netflow_get_top_N(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$filter,
|
||||
$max_aggregates,
|
||||
$connection_name
|
||||
);
|
||||
|
||||
if (empty($data_top_n) === true) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($output === 'HTML' || $output === 'PDF') {
|
||||
$html = '<table class="w100p">';
|
||||
$html .= '<tr>';
|
||||
$html .= "<td class='w50p'>";
|
||||
$html .= netflow_summary_table($data_summary);
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '<tr>';
|
||||
$html .= "<td class='w100p'>";
|
||||
$html .= netflow_top_n_table($data_top_n, $data_summary['totalbytes']);
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '</table>';
|
||||
|
||||
return $html;
|
||||
} else if ($output === 'XML') {
|
||||
$xml = '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
$xml .= '<resolution>'.$interval_length."</resolution>\n";
|
||||
// Same as netflow_aggregate_area_xml.
|
||||
$xml .= netflow_aggregate_area_xml($data_top_n);
|
||||
return $xml;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'netflow_mesh':
|
||||
$data = netflow_get_relationships_raw_data(
|
||||
$start_date,
|
||||
@ -1304,6 +1480,46 @@ function netflow_draw_item(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get data of a netflow report item.
|
||||
*
|
||||
* @param string $start_date Period start date.
|
||||
* @param string $end_date Period end date.
|
||||
* @param array $filter Netflow filter.
|
||||
* @param integer $max_aggregates Maximum number of aggregates.
|
||||
* @param string $connection_name Node name when data is get in meta.
|
||||
*
|
||||
* @return array Netflow item data (summary and top N data).
|
||||
*/
|
||||
function netflow_get_item_data(
|
||||
string $start_date,
|
||||
string $end_date,
|
||||
array $filter,
|
||||
int $max_aggregates,
|
||||
string $connection_name
|
||||
) {
|
||||
$data_summary = netflow_get_summary(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$filter,
|
||||
$connection_name
|
||||
);
|
||||
|
||||
$data_top_n = netflow_get_top_N(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$filter,
|
||||
$max_aggregates,
|
||||
$connection_name
|
||||
);
|
||||
|
||||
return [
|
||||
'summary' => $data_summary,
|
||||
'top_n' => $data_top_n,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an aggregated area chart as an XML.
|
||||
*
|
||||
|
@ -989,7 +989,7 @@ function planned_downtimes_copy($id_downtime)
|
||||
foreach ($planned_modules as $planned_module) {
|
||||
// Unset id.
|
||||
unset($planned_module['id']);
|
||||
// Set id_planned downtime
|
||||
// Set id_planned downtime.
|
||||
$planned_module['id_downtime'] = $result['id_downtime'];
|
||||
$result['id_modules'][] = db_process_sql_insert(
|
||||
'tplanned_downtime_moduless',
|
||||
@ -1004,3 +1004,82 @@ function planned_downtimes_copy($id_downtime)
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agentts and modules for planned_downtime.
|
||||
*
|
||||
* @param [type] $id Id planned.
|
||||
*
|
||||
* @return array Result array data.
|
||||
*/
|
||||
function get_agents_modules_planned_dowtime($id, $options, $count=false)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$filters_agent = '';
|
||||
if (isset($options['filters']['filter_agents']) === true
|
||||
&& empty($options['filters']['filter_agents']) === false
|
||||
) {
|
||||
$filters_agent = sprintf(
|
||||
' AND (tagente.alias LIKE "%%%s%%")',
|
||||
$options['filters']['filter_agents']
|
||||
);
|
||||
}
|
||||
|
||||
$filters_module = '';
|
||||
if (isset($options['filters']['filter_modules']) === true
|
||||
&& empty($options['filters']['filter_modules']) === false
|
||||
) {
|
||||
$filters_module = sprintf(
|
||||
' AND (tagente_modulo.nombre LIKE "%%%s%%")',
|
||||
$options['filters']['filter_modules']
|
||||
);
|
||||
}
|
||||
|
||||
if ($count === false) {
|
||||
$query = sprintf(
|
||||
'SELECT tplanned_downtime_modules.*,
|
||||
tagente.alias as agent_name,
|
||||
tagente_modulo.nombre as module_name
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s
|
||||
ORDER BY %s
|
||||
LIMIT %d, %d',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module,
|
||||
$options['order'],
|
||||
$options['limit'],
|
||||
$options['offset']
|
||||
);
|
||||
} else {
|
||||
$query = sprintf(
|
||||
'SELECT count(tplanned_downtime_modules.id) as total
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module
|
||||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($query);
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -606,6 +606,18 @@ function reporting_make_reporting_data(
|
||||
);
|
||||
break;
|
||||
|
||||
case 'netflow_top_N':
|
||||
$report['contents'][] = reporting_netflow(
|
||||
$report,
|
||||
$content,
|
||||
$type,
|
||||
$force_width_chart,
|
||||
$force_height_chart,
|
||||
'netflow_top_N',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'monitor_report':
|
||||
$report['contents'][] = reporting_monitor_report(
|
||||
$report,
|
||||
@ -730,6 +742,13 @@ function reporting_make_reporting_data(
|
||||
);
|
||||
break;
|
||||
|
||||
case 'agent_module_status':
|
||||
$report['contents'][] = reporting_agent_module_status(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
$report['contents'][] = reporting_alert_report_actions(
|
||||
$report,
|
||||
@ -2854,6 +2873,136 @@ function reporting_agent_module($report, $content)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Agents module status
|
||||
*
|
||||
* @param array $report Info Report.
|
||||
* @param array $content Info content.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_agent_module_status($report, $content)
|
||||
{
|
||||
global $config;
|
||||
$return['type'] = 'agent_module_status';
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Agent/Modules Status');
|
||||
}
|
||||
|
||||
$return['title'] = io_safe_output($content['name']);
|
||||
$return['landscape'] = $content['landscape'];
|
||||
$return['pagebreak'] = $content['pagebreak'];
|
||||
$group_name = groups_get_name($content['id_group'], true);
|
||||
if ($content['id_module_group'] == 0) {
|
||||
$module_group_name = __('All');
|
||||
} else {
|
||||
$module_group_name = db_get_value(
|
||||
'name',
|
||||
'tmodule_group',
|
||||
'id_mg',
|
||||
$content['id_module_group']
|
||||
);
|
||||
}
|
||||
|
||||
$return['subtitle'] = $group_name.' - '.$module_group_name;
|
||||
$return['description'] = io_safe_output($content['description']);
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$return['data'] = [];
|
||||
|
||||
$external_source = json_decode(
|
||||
$content['external_source'],
|
||||
true
|
||||
);
|
||||
|
||||
$agents = json_decode(
|
||||
io_safe_output(
|
||||
base64_decode($external_source['id_agents'])
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$modules = json_decode(
|
||||
io_safe_output(
|
||||
base64_decode($external_source['module'])
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$agents_per_node = [];
|
||||
$modules_per_node = [];
|
||||
|
||||
if (empty($agents) === false) {
|
||||
foreach ($agents as $value) {
|
||||
$agent_array = explode('|', $value);
|
||||
$agents_per_node[$agent_array[0]][] = $agent_array[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($modules) === false) {
|
||||
foreach ($modules as $value) {
|
||||
$module_array = explode('|', $value);
|
||||
$modules_per_node[$module_array[0]][] = $module_array[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($agents_per_node) === false) {
|
||||
foreach ($agents_per_node as $server => $agents) {
|
||||
$connection = metaconsole_get_connection_by_id($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res[$connection['server_name']] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules_per_node[$server]
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$metaconsole_connections = metaconsole_get_connection_names();
|
||||
// For all nodes.
|
||||
if (isset($metaconsole_connections) === true
|
||||
&& is_array($metaconsole_connections) === true
|
||||
) {
|
||||
foreach ($metaconsole_connections as $metaconsole) {
|
||||
// Get server connection data.
|
||||
$server_data = metaconsole_get_connection($metaconsole);
|
||||
|
||||
// Establishes connection.
|
||||
if (metaconsole_load_external_db($server_data) !== NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res[$server_data['server_name']] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$res['node'] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules
|
||||
);
|
||||
}
|
||||
|
||||
$return['data'] = $res;
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
||||
function reporting_exception(
|
||||
$report,
|
||||
$content,
|
||||
@ -5432,6 +5581,10 @@ function reporting_netflow(
|
||||
$return['type'] = 'netflow_summary';
|
||||
break;
|
||||
|
||||
case 'netflow_top_N':
|
||||
$return['type'] = 'netflow_top_N';
|
||||
break;
|
||||
|
||||
default:
|
||||
$return['type'] = 'unknown';
|
||||
break;
|
||||
@ -5451,6 +5604,10 @@ function reporting_netflow(
|
||||
$content['name'] = __('Netflow Data');
|
||||
break;
|
||||
|
||||
case 'netflow_top_N':
|
||||
$content['name'] = __('Netflow top-N connections');
|
||||
break;
|
||||
|
||||
default:
|
||||
$content['name'] = __('Unknown report');
|
||||
break;
|
||||
@ -5490,6 +5647,40 @@ function reporting_netflow(
|
||||
true
|
||||
);
|
||||
|
||||
if ($type_netflow === 'netflow_top_N') {
|
||||
// Always aggregate by destination port.
|
||||
$filter['aggregate'] = 'dstport';
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
$return['chart'] = netflow_draw_item(
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$content['top_n'],
|
||||
$type_netflow,
|
||||
$filter,
|
||||
$content['top_n_value'],
|
||||
$content['server_name'],
|
||||
(($pdf === true) ? 'PDF' : 'HTML')
|
||||
);
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$return['data'] = netflow_get_item_data(
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$filter,
|
||||
$content['top_n_value'],
|
||||
$content['server_name']
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
@ -5511,6 +5702,7 @@ function reporting_netflow(
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$return['subtitle'] = netflow_generate_subtitle_report(
|
||||
$filter['aggregate'],
|
||||
@ -11049,11 +11241,29 @@ function reporting_get_stats_users($data)
|
||||
|
||||
$tdata = [];
|
||||
$tdata[0] = html_print_image('images/user.png', true, ['title' => __('Defined users'), 'class' => 'invert_filter']);
|
||||
$user_groups = users_get_strict_mode_groups($config['id_user'], false);
|
||||
if (array_key_exists(0, $user_groups)) {
|
||||
$users = users_get_user_users($config['id_user'], 'AR', true);
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
$users = [];
|
||||
|
||||
if ($user_is_admin) {
|
||||
$users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']);
|
||||
} else {
|
||||
$users = users_get_user_users($config['id_user'], 'AR', false);
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// 0 is the group 'all'.
|
||||
if (isset($group_um[0])) {
|
||||
$users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$users = array_merge($users, users_get_users_by_group($group, $value, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($users as $user_id => $user_info) {
|
||||
// If user is not admin then don't display admin users.
|
||||
if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) {
|
||||
unset($users[$user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
$tdata[1] = count($users);
|
||||
|
@ -326,6 +326,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
case 'netflow_top_N':
|
||||
reporting_html_graph($table, $item);
|
||||
break;
|
||||
|
||||
@ -377,6 +378,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||
reporting_html_agent_module($table, $item);
|
||||
break;
|
||||
|
||||
case 'agent_module_status':
|
||||
reporting_html_agent_module_status($table, $item);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
reporting_html_alert_report_actions($table, $item);
|
||||
break;
|
||||
@ -1999,6 +2004,125 @@ function reporting_html_agent_module($table, $item)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Html report agent modules status.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Pdf output.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_agent_module_status($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return_pdf = '';
|
||||
|
||||
if (empty($item['data']) === true) {
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= __('No items');
|
||||
} else {
|
||||
$table->colspan['group_report']['cell'] = 3;
|
||||
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
|
||||
$table->data['group_report']['cell'] = __('No items');
|
||||
}
|
||||
} else {
|
||||
$table_info = new stdClass();
|
||||
$table_info->width = '99%';
|
||||
|
||||
$table_info->align = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->align['server'] = 'left';
|
||||
}
|
||||
|
||||
$table_info->align['name_group'] = 'left';
|
||||
$table_info->align['name_agent'] = 'left';
|
||||
$table_info->align['name_module'] = 'left';
|
||||
$table_info->align['status_module'] = 'left';
|
||||
$table_info->align['data_module'] = 'left';
|
||||
$table_info->align['data_time_module'] = 'left';
|
||||
|
||||
$table_info->headstyle = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->headstyle['server'] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table_info->headstyle['name_group'] = 'text-align: left';
|
||||
$table_info->headstyle['name_agent'] = 'text-align: left';
|
||||
$table_info->headstyle['name_module'] = 'text-align: left';
|
||||
$table_info->headstyle['status_module'] = 'text-align: left';
|
||||
$table_info->headstyle['data_module'] = 'text-align: left';
|
||||
$table_info->headstyle['data_time_module'] = 'text-align: left';
|
||||
|
||||
$table_info->head = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->head['server'] = __('Server');
|
||||
}
|
||||
|
||||
$table_info->head['name_agent'] = __('Agent');
|
||||
$table_info->head['name_module'] = __('Module');
|
||||
$table_info->head['name_group'] = __('Group');
|
||||
$table_info->head['status_module'] = __('Status');
|
||||
$table_info->head['data_module'] = __('Data');
|
||||
$table_info->head['data_time_module'] = __('Last time');
|
||||
|
||||
$table_info->data = [];
|
||||
|
||||
foreach ($item['data'] as $server => $info) {
|
||||
foreach ($info as $data) {
|
||||
$row = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$row['server'] = $server;
|
||||
}
|
||||
|
||||
$row['name_agent'] = $data['name_agent'];
|
||||
$row['name_module'] = $data['name_module'];
|
||||
$row['name_group'] = $data['name_group'];
|
||||
$row['status_module'] = ui_print_module_status(
|
||||
$data['status_module'],
|
||||
true,
|
||||
'status_rounded_rectangles',
|
||||
null,
|
||||
($pdf === 1) ? ' ' : ''
|
||||
);
|
||||
|
||||
if (is_numeric($data['data_module']) === true) {
|
||||
$row['data_module'] = remove_right_zeros(
|
||||
number_format(
|
||||
$data['data_module'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$row['data_module'] = (empty($data['data_module']) === true) ? '--' : $data['data_module'];
|
||||
}
|
||||
|
||||
$row['data_module'] .= $data['unit_module'];
|
||||
$row['data_time_module'] = $data['data_time_module'];
|
||||
|
||||
$table_info->data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$table_info->title = $item['title'];
|
||||
$table_info->titleclass = 'title_table_pdf';
|
||||
$table_info->titlestyle = 'text-align:left;';
|
||||
$return_pdf .= html_print_table($table_info, true);
|
||||
} else {
|
||||
$table->colspan['data']['cell'] = 3;
|
||||
$table->cellstyle['data']['cell'] = 'text-align: center;';
|
||||
$table->data['data']['cell'] = html_print_table($table_info, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
return $return_pdf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print to HTML Exception report.
|
||||
*
|
||||
|
@ -653,7 +653,8 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
'optgroup' => __('Graphs'),
|
||||
'name' => __('Custom graph'),
|
||||
];
|
||||
// Only pandora managers have access to the whole database
|
||||
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql_graph_vbar'] = [
|
||||
'optgroup' => __('Graphs'),
|
||||
@ -711,7 +712,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
'name' => __('Hourly S.L.A.'),
|
||||
];
|
||||
|
||||
if (!$config['metaconsole'] && !$template) {
|
||||
if ($template === false) {
|
||||
$types['SLA_services'] = [
|
||||
'optgroup' => __('SLA'),
|
||||
'name' => __('Services S.L.A.'),
|
||||
@ -796,6 +797,11 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
}
|
||||
}
|
||||
|
||||
$types['agent_module_status'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules status'),
|
||||
];
|
||||
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql'] = [
|
||||
@ -901,6 +907,10 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
'optgroup' => __('Netflow'),
|
||||
'name' => __('Netflow summary table'),
|
||||
];
|
||||
$types['netflow_top_N'] = [
|
||||
'optgroup' => __('Netflow'),
|
||||
'name' => __('Netflow top-N connections'),
|
||||
];
|
||||
}
|
||||
|
||||
if ($config['enterprise_installed'] && $template === false && !is_metaconsole()) {
|
||||
|
@ -2713,16 +2713,15 @@ function ui_print_status_image(
|
||||
$imagepath = $path;
|
||||
}
|
||||
|
||||
if ($imagepath == 'images/status_sets/default') {
|
||||
if ($imagepath === 'images/status_sets/default') {
|
||||
$image_with_css = true;
|
||||
}
|
||||
|
||||
$imagepath .= '/'.$type;
|
||||
|
||||
if ($image_with_css === true) {
|
||||
$shape_status = get_shape_status_set($type);
|
||||
return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info);
|
||||
} else {
|
||||
$imagepath .= '/'.$type;
|
||||
if ($options === false) {
|
||||
$options = [];
|
||||
}
|
||||
@ -2741,6 +2740,7 @@ function ui_print_status_image(
|
||||
* @param boolean $return True or false.
|
||||
* @param string $class Custom class or use defined.
|
||||
* @param string $title Custom title or inherit from module status.
|
||||
* @param string $div_content Content.
|
||||
*
|
||||
* @return string HTML code for shape.
|
||||
*/
|
||||
@ -2748,7 +2748,8 @@ function ui_print_module_status(
|
||||
$status,
|
||||
$return=false,
|
||||
$class='status_rounded_rectangles',
|
||||
$title=null
|
||||
$title=null,
|
||||
$div_content=''
|
||||
) {
|
||||
$color = modules_get_color_status($status, true);
|
||||
if ($title === null) {
|
||||
@ -2758,7 +2759,7 @@ function ui_print_module_status(
|
||||
$output = '<div style="background: '.$color;
|
||||
$output .= '" class="'.$class;
|
||||
$output .= ' forced_title" data-title="'.$title.'" title="';
|
||||
$output .= $title.'" data-use_title_for_force_title="1"></div>';
|
||||
$output .= $title.'" data-use_title_for_force_title="1">'.$div_content.'</div>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
@ -2869,7 +2870,7 @@ function ui_print_status_sets(
|
||||
$options = [];
|
||||
}
|
||||
|
||||
if (isset($options['style'])) {
|
||||
if (isset($options['style']) === true) {
|
||||
$options['style'] .= ' display: inline-block;';
|
||||
} else {
|
||||
$options['style'] = 'display: inline-block;';
|
||||
@ -2879,15 +2880,15 @@ function ui_print_status_sets(
|
||||
$options['style'] .= ' background: '.modules_get_color_status($status).';';
|
||||
}
|
||||
|
||||
if (isset($options['class'])) {
|
||||
if (isset($options['class']) === true) {
|
||||
$options['class'] = $options['class'];
|
||||
}
|
||||
|
||||
if ($title != '') {
|
||||
$options['title'] = empty($extra_info) ? $title : $title.'
'.$extra_info;
|
||||
$options['data-title'] = empty($extra_info) ? $title : $title.'<br>'.$extra_info;
|
||||
if (empty($title) === false) {
|
||||
$options['title'] = (empty($extra_info) === true) ? $title : $title.'
'.$extra_info;
|
||||
$options['data-title'] = (empty($extra_info) === true) ? $title : $title.'<br>'.$extra_info;
|
||||
$options['data-use_title_for_force_title'] = 1;
|
||||
if (isset($options['class'])) {
|
||||
if (isset($options['class']) === true) {
|
||||
$options['class'] .= ' forced_title';
|
||||
} else {
|
||||
$options['class'] = 'forced_title';
|
||||
@ -2899,15 +2900,13 @@ function ui_print_status_sets(
|
||||
$output .= $k.'="'.$v.'"';
|
||||
}
|
||||
|
||||
$output .= '>';
|
||||
$output .= '</div>';
|
||||
$output .= '> </div>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
} else {
|
||||
return $output;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3618,6 +3617,15 @@ function ui_print_datatable(array $parameters)
|
||||
ui_require_javascript_file('buttons.html5.min');
|
||||
ui_require_javascript_file('buttons.print.min');
|
||||
} else {
|
||||
// Load datatable.min.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/styles/js/datatables.min.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '"/>';
|
||||
// Load tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
@ -4632,12 +4640,15 @@ function ui_print_page_header(
|
||||
}
|
||||
|
||||
$buffer .= '<span>';
|
||||
$buffer .= '<span class="breadcrumbs-title">';
|
||||
if (empty($alias)) {
|
||||
$buffer .= ui_print_truncate_text($title, $numChars);
|
||||
} else {
|
||||
$buffer .= ui_print_truncate_text($alias, $numChars);
|
||||
}
|
||||
|
||||
$buffer .= '</span>';
|
||||
|
||||
if ($modal && !enterprise_installed()) {
|
||||
$buffer .= "
|
||||
<div id='".$message."' class='publienterprise right mrgn_top-2px' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
|
||||
|
@ -777,10 +777,13 @@ function users_get_groups_UM($id_user)
|
||||
/**
|
||||
* Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor)
|
||||
*
|
||||
* @param string User id
|
||||
* @param string $id_group User id.
|
||||
* @param boolean $um Um.
|
||||
* @param boolean $disabled Reurn also disabled users.
|
||||
*
|
||||
* @return array Return .
|
||||
*/
|
||||
function users_get_users_by_group($id_group, $um=false)
|
||||
function users_get_users_by_group($id_group, $um=false, $disabled=true)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.* FROM tusuario
|
||||
@ -789,6 +792,10 @@ function users_get_users_by_group($id_group, $um=false)
|
||||
$id_group
|
||||
);
|
||||
|
||||
if ($disabled === false) {
|
||||
$sql .= 'WHERE tusuario.disabled = 0';
|
||||
}
|
||||
|
||||
$users = db_get_all_rows_sql($sql);
|
||||
$return = [];
|
||||
foreach ($users as $key => $user) {
|
||||
|
@ -4139,7 +4139,7 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
|
||||
|
||||
if ($critical_percentage >= $status_data['linked_layout_status_as_service_critical'] && $critical_percentage !== 0) {
|
||||
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||
} else if ($critical_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
|
||||
} else if ($warning_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
|
||||
return VISUAL_MAP_STATUS_WARNING;
|
||||
} else {
|
||||
return VISUAL_MAP_STATUS_NORMAL;
|
||||
@ -4538,3 +4538,53 @@ function visual_map_load_client_resources()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Labels styles visual console.
|
||||
*
|
||||
* @param string $uniq Uniq str.
|
||||
* @param integer $ratio Ratio.
|
||||
*
|
||||
* @return string Css output.
|
||||
*/
|
||||
function css_label_styles_visual_console($uniq, $ratio=1)
|
||||
{
|
||||
global $config;
|
||||
$output = '';
|
||||
// Horrible trick! due to the use of tinyMCE
|
||||
// it is necessary to modify specific classes of each
|
||||
// of the visual consoles.
|
||||
$output .= '.c-'.$uniq.' a {color: #3f3f3f } ';
|
||||
$output .= '.c-'.$uniq.' .label p strong span {display: inline-block !important; line-height: normal !important} ';
|
||||
$output .= '.c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio).'pt; line-height:'.(8 * ($ratio)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td { padding: 0; margin: 0; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio).'pt !important; line-height:'.(4 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio).'pt !important; line-height:'.(6 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio).'pt !important; line-height:'.(8 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio).'pt !important; line-height:'.(10 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio).'pt !important; line-height:'.(12 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio).'pt !important; line-height:'.(14 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio).'pt !important; line-height:'.(18 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio).'pt !important; line-height:'.(24 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio).'pt !important; line-height:'.(28 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio).'pt !important; line-height:'.(36 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio).'pt !important; line-height:'.(48 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio).'pt !important; line-height:'.(60 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio).'pt !important; line-height:'.(72 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio).'pt !important; line-height:'.(84 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio).'pt !important; line-height:'.(96 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio).'pt !important; line-height:'.(116 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio).'pt !important; line-height:'.(128 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio).'pt !important; line-height:'.(140 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio).'pt !important; line-height:'.(154 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio).'pt !important; line-height:'.(196 * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(($config['font_size'] - 2) * $ratio).'pt !important; line-height:'.(($config['font_size'] - 2) * ($ratio)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio).'px !important; line-height: '.(50 * $ratio).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio).'px !important; line-height: '.(8 * $ratio).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio).' !important; height: '.(15 * $ratio).' !important;}';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -1040,6 +1040,7 @@ function adjustTextUnits(name) {
|
||||
"selected",
|
||||
true
|
||||
);
|
||||
$("#" + name + "_units").trigger("change");
|
||||
$("#text-" + name + "_text").val(restPrev);
|
||||
unitsSelected = true;
|
||||
}
|
||||
@ -1048,7 +1049,9 @@ function adjustTextUnits(name) {
|
||||
});
|
||||
|
||||
if (unitsSelected == false) {
|
||||
//$("#" + name + "_units option:last").prop("selected", true);
|
||||
$("#" + name + "_units option:last").prop("selected", true);
|
||||
$("#" + name + "_units").trigger("change");
|
||||
$("#text-" + name + "_text").val(restPrev);
|
||||
}
|
||||
|
||||
@ -2017,3 +2020,11 @@ function progressBarSvg(option) {
|
||||
|
||||
return svg;
|
||||
}
|
||||
|
||||
function inArray(needle, haystack) {
|
||||
var length = haystack.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (haystack[i] == needle) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
169
pandora_console/include/javascript/pandora_agents.js
Normal file
169
pandora_console/include/javascript/pandora_agents.js
Normal file
@ -0,0 +1,169 @@
|
||||
/* globals $ */
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function agent_manager_add_secondary_groups(
|
||||
event,
|
||||
id_agent,
|
||||
extra_id,
|
||||
id_form,
|
||||
dictionary
|
||||
) {
|
||||
event.preventDefault();
|
||||
var primary_value = $("#grupo").val();
|
||||
dictionary = JSON.parse(atob(dictionary));
|
||||
// The selected primary value cannot be selected like secondary.
|
||||
if (
|
||||
$(
|
||||
"#secondary_groups" +
|
||||
extra_id +
|
||||
" option:selected[value=" +
|
||||
primary_value +
|
||||
"]"
|
||||
).length > 0
|
||||
) {
|
||||
alert(dictionary.primary_group);
|
||||
return;
|
||||
}
|
||||
|
||||
// On agent creation PHP will update the secondary groups table (not via AJAX).
|
||||
if (id_agent == 0) {
|
||||
agent_manager_add_secondary_groups_ui(extra_id);
|
||||
agent_manager_update_hidden_input_secondary(id_form, extra_id);
|
||||
return;
|
||||
}
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups" + extra_id + " option:selected").each(function() {
|
||||
selected_items.push($(this).val());
|
||||
});
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
add_secondary_groups: 1
|
||||
};
|
||||
|
||||
// Make the AJAX call to update the secondary groups.
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function(data) {
|
||||
if (data == 1) {
|
||||
agent_manager_add_secondary_groups_ui(extra_id);
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups");
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
console.error(
|
||||
"Fatal error in AJAX call to add secondary groups: " + data
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function agent_manager_remove_secondary_groups(
|
||||
event,
|
||||
id_agent,
|
||||
extra_id,
|
||||
id_form,
|
||||
dictionary
|
||||
) {
|
||||
event.preventDefault();
|
||||
|
||||
dictionary = JSON.parse(atob(dictionary));
|
||||
// On agent creation PHP will update the secondary groups table (not via AJAX).
|
||||
if (id_agent == 0) {
|
||||
agent_manager_remove_secondary_groups_ui(dictionary.strNone, extra_id);
|
||||
agent_manager_update_hidden_input_secondary(id_form, extra_id);
|
||||
return;
|
||||
}
|
||||
|
||||
var selected_items = new Array();
|
||||
$("#secondary_groups_selected" + extra_id + " option:selected").each(
|
||||
function() {
|
||||
selected_items.push($(this).val());
|
||||
}
|
||||
);
|
||||
|
||||
var data = {
|
||||
page: "godmode/agentes/agent_manager",
|
||||
id_agent: id_agent,
|
||||
groups: selected_items,
|
||||
remove_secondary_groups: 1
|
||||
};
|
||||
|
||||
// Make the AJAX call to update the secondary groups.
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: data,
|
||||
success: function(data) {
|
||||
if (data == 1) {
|
||||
agent_manager_remove_secondary_groups_ui(dictionary.strNone, extra_id);
|
||||
} else {
|
||||
console.error("Error in AJAX call to add secondary groups");
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
console.error(
|
||||
"Fatal error in AJAX call to add secondary groups: " + data
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Move from left input to right input.
|
||||
function agent_manager_add_secondary_groups_ui(extra_id) {
|
||||
$("#secondary_groups_selected" + extra_id + " option[value=0]").remove();
|
||||
$("#secondary_groups" + extra_id + " option:selected").each(function() {
|
||||
$(this)
|
||||
.remove()
|
||||
.appendTo("#secondary_groups_selected" + extra_id);
|
||||
});
|
||||
}
|
||||
|
||||
// Move from right input to left input.
|
||||
function agent_manager_remove_secondary_groups_ui(strNone, extra_id) {
|
||||
// Remove the groups selected if success.
|
||||
$("#secondary_groups_selected" + extra_id + " option:selected").each(
|
||||
function() {
|
||||
$(this)
|
||||
.remove()
|
||||
.appendTo("#secondary_groups" + extra_id);
|
||||
}
|
||||
);
|
||||
|
||||
// Add none if empty select.
|
||||
if ($("#secondary_groups_selected" + extra_id + " option").length == 0) {
|
||||
$("#secondary_groups_selected" + extra_id).append(
|
||||
$("<option>", {
|
||||
value: 0,
|
||||
text: strNone
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function agent_manager_update_hidden_input_secondary(id_form, extra_id) {
|
||||
var groups = [];
|
||||
if (!$("#" + id_form + " #secondary_hidden" + extra_id).length) {
|
||||
$("#" + id_form).append(
|
||||
'<input name="secondary_hidden' +
|
||||
extra_id +
|
||||
'" type="hidden" id="secondary_hidden' +
|
||||
extra_id +
|
||||
'">'
|
||||
);
|
||||
}
|
||||
|
||||
$("#secondary_groups_selected" + extra_id + " option").each(function() {
|
||||
groups.push($(this).val());
|
||||
});
|
||||
|
||||
$("#secondary_hidden" + extra_id).val(groups.join(","));
|
||||
}
|
@ -1208,47 +1208,72 @@ function refresh_pagination_callback(
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function dashboardLoadVC(settings) {
|
||||
var headerMobileFix = 40;
|
||||
|
||||
var container = document.getElementById(
|
||||
"visual-console-container-" + settings.cellId
|
||||
);
|
||||
|
||||
var interval = 300 * 1000;
|
||||
|
||||
// Add the datetime when the item was received.
|
||||
var receivedAt = new Date();
|
||||
|
||||
var beforeUpdate = function(items, visualConsole, props) {
|
||||
var beforeUpdate = function(items, visualConsole, props, size) {
|
||||
var ratio_visualconsole = props.height / props.width;
|
||||
var ratio_w = size.width / props.width;
|
||||
var ratio_h = size.height / props.height;
|
||||
|
||||
props.width = size.width;
|
||||
props.height = size.width * ratio_visualconsole;
|
||||
|
||||
var ratio = ratio_w;
|
||||
if (settings.mobile != undefined && settings.mobile === true) {
|
||||
if (props.height < props.width) {
|
||||
if (props.height > size.height) {
|
||||
ratio = ratio_h;
|
||||
props.height = size.height;
|
||||
props.width = size.height / ratio_visualconsole;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (props.height > size.height) {
|
||||
ratio = ratio_h;
|
||||
props.height = size.height;
|
||||
props.width = size.height / ratio_visualconsole;
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.baseUrl + "ajax.php",
|
||||
data: {
|
||||
page: settings.page,
|
||||
load_css_cv: 1,
|
||||
uniq: settings.uniq,
|
||||
ratio: ratio
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(css) {
|
||||
$("#css_cv_" + settings.uniq)
|
||||
.empty()
|
||||
.append(css);
|
||||
|
||||
// Add the datetime when the item was received.
|
||||
items.map(function(item) {
|
||||
item["receivedAt"] = receivedAt;
|
||||
return item;
|
||||
});
|
||||
|
||||
var ratio_visualconsole = props.height / props.width;
|
||||
|
||||
props.width = settings.size.width;
|
||||
props.height = settings.size.width * ratio_visualconsole;
|
||||
|
||||
if (props.height > settings.size.height) {
|
||||
props.height = settings.size.height;
|
||||
props.width = settings.size.height / ratio_visualconsole;
|
||||
}
|
||||
|
||||
// Update the data structure.
|
||||
visualConsole.props = props;
|
||||
|
||||
// Update the items.
|
||||
visualConsole.updateElements(items);
|
||||
};
|
||||
|
||||
var handleUpdate = function(prevProps, newProps) {
|
||||
if (!newProps) return;
|
||||
|
||||
//Remove spinner change VC.
|
||||
document
|
||||
.getElementById("visual-console-container" + settings.cellId)
|
||||
.classList.remove("is-updating");
|
||||
|
||||
var div = document
|
||||
.getElementById("visual-console-container" + settings.cellId)
|
||||
.querySelector(".div-visual-console-spinner");
|
||||
container.classList.remove("is-updating");
|
||||
var div = container.querySelector(".div-visual-console-spinner");
|
||||
|
||||
if (div !== null) {
|
||||
var parent = div.parentElement;
|
||||
@ -1257,19 +1282,47 @@ function dashboardLoadVC(settings) {
|
||||
}
|
||||
}
|
||||
|
||||
// Change the links.
|
||||
if (prevProps && prevProps.id !== newProps.id) {
|
||||
if (settings.mobile != undefined && settings.mobile === true) {
|
||||
// Update Url.
|
||||
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
|
||||
var replacement = "$1" + newProps.id + "$2";
|
||||
var replacement = "$1" + props.id + "$2";
|
||||
|
||||
// Tab links.
|
||||
var menuLinks = document.querySelectorAll("div#menu_tab a");
|
||||
if (menuLinks !== null) {
|
||||
menuLinks.forEach(function(menuLink) {
|
||||
menuLink.href = menuLink.href.replace(regex, replacement);
|
||||
var regex_hash = /(hash=)[^&]+(&?)/gi;
|
||||
var replacement_hash = "$1" + props.hash + "$2";
|
||||
|
||||
var regex_width = /(width=)[^&]+(&?)/gi;
|
||||
var replacement_width = "$1" + size.width + "$2";
|
||||
|
||||
var regex_height = /(height=)[^&]+(&?)/gi;
|
||||
var replacement_height =
|
||||
"$1" + (size.height + headerMobileFix) + "$2";
|
||||
|
||||
// Change the URL (if the browser has support).
|
||||
if ("history" in window) {
|
||||
var href = window.location.href.replace(regex, replacement);
|
||||
href = href.replace(regex_hash, replacement_hash);
|
||||
href = href.replace(regex_width, replacement_width);
|
||||
href = href.replace(regex_height, replacement_height);
|
||||
window.history.replaceState({}, document.title, href);
|
||||
}
|
||||
|
||||
container.classList.remove("cv-overflow");
|
||||
|
||||
// View title.
|
||||
var title = document.querySelector(".ui-title");
|
||||
if (title !== null) {
|
||||
title.textContent = visualConsole.props.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var handleUpdate = function() {
|
||||
return;
|
||||
};
|
||||
|
||||
settings.items.map(function(item) {
|
||||
@ -1282,18 +1335,56 @@ function dashboardLoadVC(settings) {
|
||||
return item;
|
||||
});
|
||||
|
||||
createVisualConsole(
|
||||
var visualConsoleManager = createVisualConsole(
|
||||
container,
|
||||
settings.props,
|
||||
settings.items,
|
||||
settings.baseUrl,
|
||||
300 * 1000,
|
||||
interval,
|
||||
handleUpdate,
|
||||
beforeUpdate,
|
||||
settings.size,
|
||||
settings.id_user,
|
||||
settings.hash
|
||||
settings.hash,
|
||||
settings.mobile != undefined && settings.mobile === true
|
||||
? "mobile"
|
||||
: "dashboard"
|
||||
);
|
||||
|
||||
$(window).on("orientationchange", function() {
|
||||
$(container).width($(window).height());
|
||||
$(container).height($(window).width() - headerMobileFix);
|
||||
//Remove spinner change VC.
|
||||
container.classList.remove("is-updating");
|
||||
container.classList.remove("cv-overflow");
|
||||
|
||||
var div = container.querySelector(".div-visual-console-spinner");
|
||||
|
||||
if (div !== null) {
|
||||
var parent = div.parentElement;
|
||||
if (parent !== null) {
|
||||
parent.removeChild(div);
|
||||
}
|
||||
}
|
||||
|
||||
container.classList.add("is-updating");
|
||||
container.classList.add("cv-overflow");
|
||||
const divParent = document.createElement("div");
|
||||
divParent.className = "div-visual-console-spinner";
|
||||
|
||||
const divSpinner = document.createElement("div");
|
||||
divSpinner.className = "visual-console-spinner";
|
||||
|
||||
divParent.appendChild(divSpinner);
|
||||
container.appendChild(divParent);
|
||||
|
||||
var dimensions = {
|
||||
width: $(window).height(),
|
||||
height: $(window).width() - 40
|
||||
};
|
||||
|
||||
visualConsoleManager.changeDimensionsVc(dimensions, interval);
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
@ -59,7 +59,26 @@ function show_event_dialog(event, dialog_page, result) {
|
||||
background: "black"
|
||||
},
|
||||
width: 710,
|
||||
height: 600
|
||||
height: 600,
|
||||
autoOpen: true,
|
||||
open: function() {
|
||||
if (
|
||||
$.ui &&
|
||||
$.ui.dialog &&
|
||||
$.ui.dialog.prototype._allowInteraction
|
||||
) {
|
||||
var ui_dialog_interaction =
|
||||
$.ui.dialog.prototype._allowInteraction;
|
||||
$.ui.dialog.prototype._allowInteraction = function(e) {
|
||||
if ($(e.target).closest(".select2-dropdown").length)
|
||||
return true;
|
||||
return ui_dialog_interaction.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
},
|
||||
_allowInteraction: function(event) {
|
||||
return !!$(event.target).is(".select2-input") || this._super(event);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
$.post({
|
||||
|
@ -0,0 +1,32 @@
|
||||
/* globals $, uniqId, confirmDialog*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function dialogAgentModulesAffected(settings) {
|
||||
confirmDialog({
|
||||
title: settings.title,
|
||||
size: 500,
|
||||
message: function() {
|
||||
var id = "div-" + uniqId();
|
||||
var loading = settings.loadingText;
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: "godmode/agentes/planned_downtime.list",
|
||||
show_info_agents_modules_affected: 1,
|
||||
id: settings.id
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||
}
|
||||
});
|
||||
}
|
@ -577,14 +577,19 @@ function confirmDialog(settings) {
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function generalShowMsg(data, idMsg) {
|
||||
var title = "Response";
|
||||
var text = data;
|
||||
var failed = false;
|
||||
var title = data.title[data.error];
|
||||
var text = data.text[data.error];
|
||||
var failed = !data.error;
|
||||
|
||||
if (typeof data.error != "number") {
|
||||
title = "Response";
|
||||
text = data;
|
||||
failed = false;
|
||||
|
||||
if (typeof data == "object") {
|
||||
title = data.title || "Response";
|
||||
text = data.text || data.error || data.result;
|
||||
failed = failed || data.error;
|
||||
failed = data.failed || data.error;
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
@ -600,6 +605,7 @@ function generalShowMsg(data, idMsg) {
|
||||
$("body").append('<div title="' + title + '" id="' + idMsg + '"></div>');
|
||||
$("#" + idMsg).empty();
|
||||
}
|
||||
}
|
||||
|
||||
$("#" + idMsg).empty();
|
||||
$("#" + idMsg).html(text);
|
||||
|
@ -33,7 +33,8 @@ function createVisualConsole(
|
||||
beforeUpdate,
|
||||
size,
|
||||
id_user,
|
||||
hash
|
||||
hash,
|
||||
mode = ""
|
||||
) {
|
||||
if (container == null || props == null || items == null) return null;
|
||||
if (baseUrl == null) baseUrl = "";
|
||||
@ -41,9 +42,18 @@ function createVisualConsole(
|
||||
var visualConsole = null;
|
||||
var asyncTaskManager = new AsyncTaskManager();
|
||||
|
||||
function updateVisualConsole(visualConsoleId, updateInterval, tts) {
|
||||
function updateVisualConsole(
|
||||
visualConsoleId,
|
||||
updateInterval,
|
||||
tts,
|
||||
dimensions
|
||||
) {
|
||||
if (tts == null) tts = 0; // Time to start.
|
||||
|
||||
if (dimensions != undefined && dimensions != null && dimensions != "") {
|
||||
size = dimensions;
|
||||
}
|
||||
|
||||
asyncTaskManager.add(
|
||||
"visual-console",
|
||||
function(done) {
|
||||
@ -53,16 +63,13 @@ function createVisualConsole(
|
||||
size,
|
||||
id_user,
|
||||
hash,
|
||||
mode,
|
||||
function(error, data) {
|
||||
if (error) {
|
||||
//Remove spinner change VC.
|
||||
document
|
||||
.getElementById("visual-console-container")
|
||||
.classList.remove("is-updating");
|
||||
container.classList.remove("is-updating");
|
||||
|
||||
var div = document
|
||||
.getElementById("visual-console-container")
|
||||
.querySelector(".div-visual-console-spinner");
|
||||
var div = container.querySelector(".div-visual-console-spinner");
|
||||
|
||||
if (div !== null) {
|
||||
var parent = div.parentElement;
|
||||
@ -95,7 +102,7 @@ function createVisualConsole(
|
||||
var receivedAt = new Date();
|
||||
var prevProps = visualConsole.props;
|
||||
if (beforeUpdate) {
|
||||
beforeUpdate(items, visualConsole, props);
|
||||
beforeUpdate(items, visualConsole, props, size);
|
||||
} else {
|
||||
// Add the datetime when the item was received.
|
||||
items.map(function(item) {
|
||||
@ -105,6 +112,7 @@ function createVisualConsole(
|
||||
|
||||
// Update the data structure.
|
||||
visualConsole.props = props;
|
||||
|
||||
// Update the items.
|
||||
visualConsole.updateElements(items);
|
||||
}
|
||||
@ -460,6 +468,11 @@ function createVisualConsole(
|
||||
asyncTaskManager.cancel("visual-console-start");
|
||||
}
|
||||
},
|
||||
changeDimensionsVc: function(dimensions, interval) {
|
||||
if (dimensions != null) {
|
||||
updateVisualConsole(visualConsole.props.id, interval, null, dimensions);
|
||||
}
|
||||
},
|
||||
createItem: function(typeString) {
|
||||
var type;
|
||||
switch (typeString) {
|
||||
@ -673,7 +686,15 @@ function createVisualConsole(
|
||||
* @return {Object} Cancellable. Object which include and .abort([statusText]) function.
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
||||
function loadVisualConsoleData(
|
||||
baseUrl,
|
||||
vcId,
|
||||
size,
|
||||
id_user,
|
||||
hash,
|
||||
mode,
|
||||
callback
|
||||
) {
|
||||
// var apiPath = baseUrl + "/include/rest-api";
|
||||
var apiPath = baseUrl + "/ajax.php";
|
||||
var vcJqXHR = null;
|
||||
@ -762,6 +783,7 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
||||
visualConsoleId: vcId,
|
||||
id_user: typeof id_user == undefined ? id_user : null,
|
||||
auth_hash: typeof hash == undefined ? hash : null,
|
||||
mode: mode,
|
||||
widthScreen: widthScreen
|
||||
},
|
||||
"json"
|
||||
|
@ -379,23 +379,8 @@ class MapsMadeByUser extends Widget
|
||||
|
||||
$size['width'] = ($size['width'] + 30);
|
||||
|
||||
$ratio = $visualConsole->adjustToViewport($size, 'dashboard');
|
||||
$visualConsoleData = $visualConsole->toArray();
|
||||
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
|
||||
$ratio_t = ($size['width'] / $visualConsoleData['width']);
|
||||
$radio_h = ($size['height'] / $visualConsoleData['height']);
|
||||
|
||||
$visualConsoleData['width'] = $size['width'];
|
||||
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
|
||||
|
||||
if ($visualConsoleData['height'] > $size['height']) {
|
||||
$ratio_t = $radio_h;
|
||||
|
||||
$visualConsoleData['height'] = $size['height'];
|
||||
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
|
||||
}
|
||||
|
||||
$groupId = $visualConsoleData['groupId'];
|
||||
$visualConsoleName = $visualConsoleData['name'];
|
||||
|
||||
$uniq = uniqid();
|
||||
|
||||
@ -435,68 +420,16 @@ class MapsMadeByUser extends Widget
|
||||
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||
$this->values['vcId'],
|
||||
$aclUserGroups,
|
||||
$ratio_t
|
||||
$ratio
|
||||
);
|
||||
|
||||
// Horrible trick! due to the use of tinyMCE
|
||||
// it is necessary to modify specific classes of each
|
||||
// of the visual consoles.
|
||||
$output .= '<style type="text/css">';
|
||||
// $output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong > span { font-size: '.(10 * $ratio_t).'pt;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item div.label p { overflow:initial !important; margin:0px;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item div.label img { height: 100%; width: 100%; object-fit: contain;}';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td p { overflow:initial !important; margin:0px; font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
|
||||
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
|
||||
$output .= css_label_styles_visual_console($uniq, $ratio);
|
||||
$output .= '</style>';
|
||||
|
||||
$visualConsoleItems = array_reduce(
|
||||
$visualConsoleItems,
|
||||
function ($carry, $item) use ($ratio_t) {
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item->toArray();
|
||||
return $carry;
|
||||
},
|
||||
@ -508,11 +441,13 @@ class MapsMadeByUser extends Widget
|
||||
'props' => $visualConsoleData,
|
||||
'items' => $visualConsoleItems,
|
||||
'baseUrl' => ui_get_full_url('/', false, false, false),
|
||||
'ratio' => $ratio_t,
|
||||
'ratio' => $ratio,
|
||||
'size' => $size,
|
||||
'cellId' => $this->cellId,
|
||||
'hash' => User::generatePublicHash(),
|
||||
'id_user' => $config['id_user'],
|
||||
'page' => 'include/ajax/visual_console.ajax',
|
||||
'uniq' => $uniq,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -399,7 +399,10 @@ class ModuleIconWidget extends Widget
|
||||
'class' => 'flex-row flex-end w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
['label' => $image],
|
||||
[
|
||||
'label' => $image,
|
||||
'arguments' => ['type' => 'image-item'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -389,7 +389,10 @@ class ModuleStatusWidget extends Widget
|
||||
'class' => 'flex-row flex-end w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
['label' => $image],
|
||||
[
|
||||
'label' => $image,
|
||||
'arguments' => ['type' => 'image-item'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -115,25 +115,15 @@ if ($getVisualConsole === true) {
|
||||
|
||||
$width = get_parameter('widthScreen', 0);
|
||||
|
||||
$mode = get_parameter('mode', '');
|
||||
|
||||
$ratio = 0;
|
||||
if (isset($size) === true
|
||||
&& is_array($size) === true
|
||||
&& empty($size) === false
|
||||
) {
|
||||
$ratio = $visualConsole->adjustToViewport($size, $mode);
|
||||
$visualConsoleData = $visualConsole->toArray();
|
||||
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
|
||||
$ratio = ($size['width'] / $visualConsoleData['width']);
|
||||
$radio_h = ($size['height'] / $visualConsoleData['height']);
|
||||
|
||||
$visualConsoleData['width'] = $size['width'];
|
||||
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
|
||||
|
||||
if ($visualConsoleData['height'] > $size['height']) {
|
||||
$ratio = $radio_h;
|
||||
|
||||
$visualConsoleData['height'] = $size['height'];
|
||||
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
|
||||
}
|
||||
}
|
||||
|
||||
$widthRatio = 0;
|
||||
|
@ -213,6 +213,61 @@ abstract class Model
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate ratio for mobile.
|
||||
*
|
||||
* @param array $size Size viewport.
|
||||
* @param string $mode Mode calculate (dashboard or mobile).
|
||||
*
|
||||
* @return float Ratio.
|
||||
*/
|
||||
public function adjustToViewport($size, $mode='')
|
||||
{
|
||||
$ratio_visualconsole = $this->getRatio();
|
||||
$ratio_w = ($size['width'] / $this->data['width']);
|
||||
$ratio_h = ($size['height'] / $this->data['height']);
|
||||
|
||||
$this->data['width'] = $size['width'];
|
||||
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
|
||||
|
||||
$ratio = $ratio_w;
|
||||
if ($mode === 'mobile') {
|
||||
if ($this->data['height'] < $this->data['width']) {
|
||||
if ($this->data['height'] > $size['height']) {
|
||||
$ratio = $ratio_h;
|
||||
$this->data['height'] = $size['height'];
|
||||
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($this->data['height'] > $size['height']) {
|
||||
$ratio = $ratio_h;
|
||||
$this->data['height'] = $size['height'];
|
||||
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
|
||||
}
|
||||
}
|
||||
|
||||
return $ratio;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate ratio
|
||||
*
|
||||
* @return float Ratio.
|
||||
*/
|
||||
public function getRatio()
|
||||
{
|
||||
if (isset($this->data['width']) === false
|
||||
|| empty($this->data['width']) === true
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ($this->data['height'] / $this->data['width']);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* -------------
|
||||
* - UTILITIES -
|
||||
|
@ -1197,7 +1197,12 @@ class Item extends CachedModel
|
||||
'operation/visual_console/view',
|
||||
['id' => $vcId],
|
||||
// No autologin from the public view.
|
||||
!$config['public_view']
|
||||
!$config['public_view'],
|
||||
$mobile_navigation,
|
||||
[
|
||||
'page' => 'visualmap',
|
||||
'id' => $vcId,
|
||||
]
|
||||
);
|
||||
} catch (\Throwable $ignored) {
|
||||
return null;
|
||||
@ -1244,7 +1249,6 @@ class Item extends CachedModel
|
||||
'sec2' => 'operation/agentes/status_monitor',
|
||||
'id_module' => $moduleId,
|
||||
];
|
||||
}
|
||||
|
||||
if ($mobile_navigation === true) {
|
||||
return $mobileUrl.'?'.http_build_query(
|
||||
@ -1254,6 +1258,7 @@ class Item extends CachedModel
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $baseUrl.'?'.http_build_query($queryParams);
|
||||
} else if (\is_metaconsole() === true
|
||||
@ -1308,7 +1313,12 @@ class Item extends CachedModel
|
||||
'operation/agentes/status_monitor',
|
||||
['id_module' => $moduleId],
|
||||
// No autologin from the public view.
|
||||
!$config['public_view']
|
||||
!$config['public_view'],
|
||||
$mobile_navigation,
|
||||
[
|
||||
'id' => $moduleId,
|
||||
'page' => 'module_graph',
|
||||
]
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $ignored) {
|
||||
@ -1368,7 +1378,12 @@ class Item extends CachedModel
|
||||
'operation/agentes/ver_agente',
|
||||
['id_agente' => $agentId],
|
||||
// No autologin from the public view.
|
||||
!$config['public_view']
|
||||
!$config['public_view'],
|
||||
$mobile_navigation,
|
||||
[
|
||||
'id' => $agentId,
|
||||
'page' => 'agent',
|
||||
]
|
||||
);
|
||||
} catch (\Throwable $ignored) {
|
||||
return null;
|
||||
|
@ -537,7 +537,10 @@ final class Group extends Item
|
||||
'class' => 'flex-row flex-end w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
['label' => $images],
|
||||
[
|
||||
'label' => $images,
|
||||
'arguments' => ['type' => 'image-item'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -190,7 +190,10 @@ final class Icon extends Item
|
||||
'class' => 'flex-row flex-end w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
['label' => $images],
|
||||
[
|
||||
'label' => $images,
|
||||
'arguments' => ['type' => 'image-item'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -351,7 +351,10 @@ final class StaticGraph extends Item
|
||||
'class' => 'flex-row flex-end w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
['label' => $images],
|
||||
[
|
||||
'label' => $images,
|
||||
'arguments' => ['type' => 'image-item'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -562,12 +562,12 @@ div#main_pure {
|
||||
}
|
||||
|
||||
/* Mobile trick */
|
||||
.ui-mobile-viewport.ui-overlay-c > #main_page > .ui-content {
|
||||
#main_page > .ui-content {
|
||||
overflow: visible;
|
||||
overflow-x: visible;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.ui-mobile-viewport.ui-overlay-c > #main_page > .ui-content div.label > p {
|
||||
#main_page > .ui-content div.label > p {
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ ul li {
|
||||
|
||||
.button_collapse {
|
||||
margin-top: auto;
|
||||
height: 38px;
|
||||
min-height: 38px;
|
||||
background-color: #505050;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
@ -427,7 +427,6 @@ ul li {
|
||||
}
|
||||
|
||||
.button_classic {
|
||||
width: 215px;
|
||||
background-image: url(../../images/button_collapse_menu.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
@ -440,7 +439,7 @@ ul li {
|
||||
}
|
||||
|
||||
/* Menu height: 601px, 720px, 735px */
|
||||
@media screen and (max-height: 720px) {
|
||||
@media screen and (max-height: 750px) {
|
||||
.menu li,
|
||||
.menu li a,
|
||||
.menu li div {
|
||||
@ -448,7 +447,7 @@ ul li {
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 735px) {
|
||||
@media screen and (max-height: 750px) {
|
||||
.operation {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
@ -5092,6 +5092,17 @@ input:checked + .p-slider:before {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#upload_file #upload_file_input_full {
|
||||
width: 100%;
|
||||
border: 1px solid #cbcbcb;
|
||||
border-radius: 2px;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
#upload_file_input_full input#file-file::-webkit-file-upload-button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.file_table_modal_active {
|
||||
background-color: #fff;
|
||||
border: 1px solid #e6e6e6;
|
||||
@ -6038,7 +6049,6 @@ form#modal_form_feedback input[type="email"] {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-weight: lighter;
|
||||
padding: 0px 0px 2px 0px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4px;
|
||||
@ -7679,6 +7689,11 @@ div.graph div.legend table {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#table3-secondary_groups_added .select2-container,
|
||||
#table3-secondary_groups_removed .select2-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.ux_console_module {
|
||||
float: left;
|
||||
width: 98%;
|
||||
|
@ -1214,3 +1214,7 @@ input[type="image"] {
|
||||
.databox_color {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: source-code, mono, monospace;
|
||||
}
|
||||
|
@ -458,6 +458,312 @@ div.label strong span {
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/*.termframe{
|
||||
background-color: #82b92e;
|
||||
}*/
|
||||
.visual_font_size_4pt,
|
||||
.visual_font_size_4pt > em,
|
||||
.visual_font_size_4pt > strong,
|
||||
.visual_font_size_4pt > strong > span,
|
||||
.visual_font_size_4pt > span,
|
||||
.visual_font_size_4pt > strong > em,
|
||||
.visual_font_size_4pt > em > strong,
|
||||
.visual_font_size_4pt em span,
|
||||
.visual_font_size_4pt span em {
|
||||
font-size: 4pt;
|
||||
line-height: 4pt;
|
||||
}
|
||||
.visual_font_size_6pt,
|
||||
.visual_font_size_6pt > em,
|
||||
.visual_font_size_6pt > strong,
|
||||
.visual_font_size_6pt > strong > span,
|
||||
.visual_font_size_6pt > span,
|
||||
.visual_font_size_6pt > strong > em,
|
||||
.visual_font_size_6pt > em > strong,
|
||||
.visual_font_size_6pt em span,
|
||||
.visual_font_size_6pt span em {
|
||||
font-size: 6pt;
|
||||
line-height: 6pt;
|
||||
}
|
||||
.visual_font_size_8pt,
|
||||
.visual_font_size_8pt > em,
|
||||
.visual_font_size_8pt > strong,
|
||||
.visual_font_size_8pt > strong > span,
|
||||
.visual_font_size_8pt > span,
|
||||
.visual_font_size_8pt > strong > em,
|
||||
.visual_font_size_8pt > em > strong,
|
||||
.visual_font_size_8pt em span,
|
||||
.visual_font_size_8pt span em {
|
||||
font-size: 8pt;
|
||||
line-height: 8pt;
|
||||
}
|
||||
.visual_font_size_10pt,
|
||||
.visual_font_size_10pt > em,
|
||||
.visual_font_size_10pt > strong,
|
||||
.visual_font_size_10pt > strong > span,
|
||||
.visual_font_size_10pt > span,
|
||||
.visual_font_size_10pt > strong > em,
|
||||
.visual_font_size_10pt > em > strong,
|
||||
.visual_font_size_10pt em span,
|
||||
.visual_font_size_10pt span em {
|
||||
font-size: 10pt;
|
||||
line-height: 10pt;
|
||||
}
|
||||
.visual_font_size_12pt,
|
||||
.visual_font_size_12pt > em,
|
||||
.visual_font_size_12pt > strong,
|
||||
.visual_font_size_12pt > strong > span,
|
||||
.visual_font_size_12pt > span,
|
||||
.visual_font_size_12pt > strong > em,
|
||||
.visual_font_size_12pt > em > strong,
|
||||
.visual_font_size_12pt em span,
|
||||
.visual_font_size_12pt span em {
|
||||
font-size: 12pt;
|
||||
line-height: 12pt;
|
||||
}
|
||||
.visual_font_size_14pt,
|
||||
.visual_font_size_14pt > em,
|
||||
.visual_font_size_14pt > strong,
|
||||
.visual_font_size_14pt > strong > span,
|
||||
.visual_font_size_14pt > span,
|
||||
.visual_font_size_14pt > strong > em,
|
||||
.visual_font_size_14pt > em > strong,
|
||||
.visual_font_size_14pt em span,
|
||||
.visual_font_size_14pt span em {
|
||||
font-size: 14pt;
|
||||
line-height: 14pt;
|
||||
}
|
||||
.visual_font_size_18pt,
|
||||
.visual_font_size_18pt > em,
|
||||
.visual_font_size_18pt > strong,
|
||||
.visual_font_size_18pt > strong > span,
|
||||
.visual_font_size_18pt > span,
|
||||
.visual_font_size_18pt > strong > em,
|
||||
.visual_font_size_18pt > em > strong,
|
||||
.visual_font_size_18pt em span,
|
||||
.visual_font_size_18pt span em {
|
||||
font-size: 18pt;
|
||||
line-height: 18pt;
|
||||
}
|
||||
|
||||
.visual_font_size_24pt,
|
||||
.visual_font_size_24pt > em,
|
||||
.visual_font_size_24pt > strong,
|
||||
.visual_font_size_24pt > strong > span,
|
||||
.visual_font_size_24pt > span,
|
||||
.visual_font_size_24pt > strong > em,
|
||||
.visual_font_size_24pt > em > strong,
|
||||
.visual_font_size_24pt em span,
|
||||
.visual_font_size_24pt span em {
|
||||
font-size: 24pt;
|
||||
line-height: 24pt;
|
||||
}
|
||||
.visual_font_size_28pt,
|
||||
.visual_font_size_28pt > em,
|
||||
.visual_font_size_28pt > strong,
|
||||
.visual_font_size_28pt > strong > span,
|
||||
.visual_font_size_28pt > span,
|
||||
.visual_font_size_28pt > strong > em,
|
||||
.visual_font_size_28pt > em > strong,
|
||||
.visual_font_size_28pt em span,
|
||||
.visual_font_size_28pt span em {
|
||||
font-size: 28pt;
|
||||
line-height: 28pt;
|
||||
}
|
||||
.visual_font_size_36pt,
|
||||
.visual_font_size_36pt > em,
|
||||
.visual_font_size_36pt > strong,
|
||||
.visual_font_size_36pt > strong > span,
|
||||
.visual_font_size_36pt > span,
|
||||
.visual_font_size_36pt > strong > em,
|
||||
.visual_font_size_36pt > em > strong,
|
||||
.visual_font_size_36pt em span,
|
||||
.visual_font_size_36pt span em {
|
||||
font-size: 36pt;
|
||||
line-height: 36pt;
|
||||
}
|
||||
.visual_font_size_48pt,
|
||||
.visual_font_size_48pt > em,
|
||||
.visual_font_size_48pt > strong,
|
||||
.visual_font_size_48pt > strong > span,
|
||||
.visual_font_size_48pt > span,
|
||||
.visual_font_size_48pt > strong > em,
|
||||
.visual_font_size_48pt > em > strong,
|
||||
.visual_font_size_48pt em span,
|
||||
.visual_font_size_48pt span em {
|
||||
font-size: 48pt;
|
||||
line-height: 48pt;
|
||||
}
|
||||
.visual_font_size_60pt,
|
||||
.visual_font_size_60pt > em,
|
||||
.visual_font_size_60pt > strong,
|
||||
.visual_font_size_60pt > strong > span,
|
||||
.visual_font_size_60pt > span,
|
||||
.visual_font_size_60pt > strong > em,
|
||||
.visual_font_size_60pt > em > strong,
|
||||
.visual_font_size_60pt em span,
|
||||
.visual_font_size_60pt span em {
|
||||
font-size: 60pt;
|
||||
line-height: 60pt;
|
||||
}
|
||||
.visual_font_size_72pt,
|
||||
.visual_font_size_72pt > em,
|
||||
.visual_font_size_72pt > strong,
|
||||
.visual_font_size_72pt > strong > span,
|
||||
.visual_font_size_72pt > span,
|
||||
.visual_font_size_72pt > strong > em,
|
||||
.visual_font_size_72pt > em > strong,
|
||||
.visual_font_size_72pt em span,
|
||||
.visual_font_size_72pt span em {
|
||||
font-size: 72pt;
|
||||
line-height: 72pt;
|
||||
}
|
||||
|
||||
.visual_font_size_84pt,
|
||||
.visual_font_size_84pt > em,
|
||||
.visual_font_size_84pt > strong,
|
||||
.visual_font_size_84pt > strong > span,
|
||||
.visual_font_size_84pt > span,
|
||||
.visual_font_size_84pt > strong > em,
|
||||
.visual_font_size_84pt > em > strong,
|
||||
.visual_font_size_84pt em span,
|
||||
.visual_font_size_84pt span em {
|
||||
font-size: 84pt;
|
||||
line-height: 84pt;
|
||||
}
|
||||
|
||||
.visual_font_size_96pt,
|
||||
.visual_font_size_96pt > em,
|
||||
.visual_font_size_96pt > strong,
|
||||
.visual_font_size_96pt > strong > span,
|
||||
.visual_font_size_96pt > span,
|
||||
.visual_font_size_96pt > strong > em,
|
||||
.visual_font_size_96pt > em > strong,
|
||||
.visual_font_size_96pt em span,
|
||||
.visual_font_size_96pt span em {
|
||||
font-size: 96pt;
|
||||
line-height: 96pt;
|
||||
}
|
||||
|
||||
.visual_font_size_116pt,
|
||||
.visual_font_size_116pt > em,
|
||||
.visual_font_size_116pt > strong,
|
||||
.visual_font_size_116pt > strong > span,
|
||||
.visual_font_size_116pt > span,
|
||||
.visual_font_size_116pt > strong > em,
|
||||
.visual_font_size_116pt > em > strong,
|
||||
.visual_font_size_116pt em span,
|
||||
.visual_font_size_116pt span em {
|
||||
font-size: 116pt;
|
||||
line-height: 116pt;
|
||||
}
|
||||
|
||||
.visual_font_size_128pt,
|
||||
.visual_font_size_128pt > em,
|
||||
.visual_font_size_128pt > strong,
|
||||
.visual_font_size_128pt > strong > span,
|
||||
.visual_font_size_128pt > span,
|
||||
.visual_font_size_128pt > strong > em,
|
||||
.visual_font_size_128pt > em > strong,
|
||||
.visual_font_size_128pt em span,
|
||||
.visual_font_size_128pt span em {
|
||||
font-size: 128pt;
|
||||
line-height: 128pt;
|
||||
}
|
||||
|
||||
.visual_font_size_140pt,
|
||||
.visual_font_size_140pt > em,
|
||||
.visual_font_size_140pt > strong,
|
||||
.visual_font_size_140pt > strong > span,
|
||||
.visual_font_size_140pt > span,
|
||||
.visual_font_size_140pt > strong > em,
|
||||
.visual_font_size_140pt > em > strong,
|
||||
.visual_font_size_140pt em span,
|
||||
.visual_font_size_140pt span em {
|
||||
font-size: 140pt;
|
||||
line-height: 140pt;
|
||||
}
|
||||
|
||||
.visual_font_size_154pt,
|
||||
.visual_font_size_154pt > em,
|
||||
.visual_font_size_154pt > strong,
|
||||
.visual_font_size_154pt > strong > span,
|
||||
.visual_font_size_154pt > span,
|
||||
.visual_font_size_154pt > strong > em,
|
||||
.visual_font_size_154pt > em > strong,
|
||||
.visual_font_size_154pt em span,
|
||||
.visual_font_size_154pt span em {
|
||||
font-size: 154pt;
|
||||
line-height: 154pt;
|
||||
}
|
||||
|
||||
.visual_font_size_196pt,
|
||||
.visual_font_size_196pt > em,
|
||||
.visual_font_size_196pt > strong,
|
||||
.visual_font_size_196pt > strong > span,
|
||||
.visual_font_size_196pt > span,
|
||||
.visual_font_size_196pt > strong > em,
|
||||
.visual_font_size_196pt > em > strong,
|
||||
.visual_font_size_196pt em span,
|
||||
.visual_font_size_196pt span em {
|
||||
font-size: 196pt;
|
||||
line-height: 196pt;
|
||||
}
|
||||
|
||||
.resize_visual_font_size_8pt,
|
||||
.resize_visual_font_size_8pt > em,
|
||||
.resize_visual_font_size_8pt > strong,
|
||||
.resize_visual_font_size_8pt > strong > span,
|
||||
.resize_visual_font_size_8pt > span,
|
||||
.resize_visual_font_size_8pt > strong > em,
|
||||
.resize_visual_font_size_8pt > em > strong,
|
||||
.visual_font_size_8pt em span,
|
||||
.visual_font_size_8pt span em {
|
||||
font-size: 4pt;
|
||||
line-height: 4pt;
|
||||
}
|
||||
.resize_visual_font_size_14pt,
|
||||
.resize_visual_font_size_14pt > em,
|
||||
.resize_visual_font_size_14pt > strong,
|
||||
.resize_visual_font_size_14pt > strong > span,
|
||||
.resize_visual_font_size_14pt > span,
|
||||
.resize_visual_font_size_14pt > strong > em,
|
||||
.resize_visual_font_size_14pt > em > strong,
|
||||
.visual_font_size_14pt em span,
|
||||
.visual_font_size_14pt span em {
|
||||
font-size: 7pt;
|
||||
line-height: 7pt;
|
||||
}
|
||||
.resize_visual_font_size_24pt,
|
||||
.resize_visual_font_size_24pt > em,
|
||||
.resize_visual_font_size_24pt > strong,
|
||||
.resize_visual_font_size_24pt > strong > span,
|
||||
.resize_visual_font_size_24pt > span,
|
||||
.resize_visual_font_size_24pt > strong > em,
|
||||
.resize_visual_font_size_24pt > em > strong,
|
||||
.visual_font_size_14pt em span,
|
||||
.visual_font_size_14pt span em {
|
||||
font-size: 12pt;
|
||||
line-height: 12pt;
|
||||
}
|
||||
.resize_visual_font_size_36pt,
|
||||
.resize_visual_font_size_36pt > em,
|
||||
.resize_visual_font_size_36pt > strong,
|
||||
.resize_visual_font_size_36pt > strong > span,
|
||||
.resize_visual_font_size_36pt > span,
|
||||
.resize_visual_font_size_36pt > strong > em,
|
||||
.resize_visual_font_size_36pt > em > strong,
|
||||
.visual_font_size_36pt em span,
|
||||
.visual_font_size_36pt span em {
|
||||
font-size: 18pt;
|
||||
line-height: 18pt;
|
||||
}
|
||||
.resize_visual_font_size_72pt,
|
||||
.resize_visual_font_size_72pt > em,
|
||||
.resize_visual_font_size_72pt > strong,
|
||||
.resize_visual_font_size_72pt > strong > span,
|
||||
.resize_visual_font_size_72pt > span,
|
||||
.resize_visual_font_size_72pt > strong > em,
|
||||
.resize_visual_font_size_72pt > em > strong,
|
||||
.visual_font_size_72pt em span,
|
||||
.visual_font_size_72pt span em {
|
||||
font-size: 36pt;
|
||||
line-height: 36pt;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -129,7 +129,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.760';
|
||||
$build = '220308';
|
||||
$build = '220323';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -1396,6 +1396,7 @@ div.ui-mobile-viewport {
|
||||
overflow: visible;
|
||||
overflow-x: hidden;
|
||||
padding: 1em;
|
||||
min-height: calc(100vh - 60px);
|
||||
}
|
||||
.ui-corner-all > .ui-toolbar-header:first-child,
|
||||
.ui-corner-all > .ui-content:first-child,
|
||||
|
@ -1102,7 +1102,7 @@ li.ui-btn {
|
||||
}
|
||||
|
||||
.ui-header .ui-title {
|
||||
font-size: 18px !important;
|
||||
font-size: 14px;
|
||||
min-height: 1.1em;
|
||||
text-align: center;
|
||||
display: block;
|
||||
@ -1114,10 +1114,6 @@ li.ui-btn {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
* {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.event_name {
|
||||
font-size: 15px !important;
|
||||
}
|
||||
@ -1348,6 +1344,12 @@ span.nobold * {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status_small_rectangles {
|
||||
width: 20px;
|
||||
height: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.ui-content .ui-listview,
|
||||
.ui-panel-inner > .ui-listview {
|
||||
margin: 0 !important;
|
||||
@ -1444,7 +1446,7 @@ div.nodata_container {
|
||||
}
|
||||
|
||||
.ui-page-active {
|
||||
padding-top: 2.8em !important;
|
||||
padding-top: 3.2em !important;
|
||||
}
|
||||
|
||||
.ui-header-fixed {
|
||||
@ -1491,3 +1493,15 @@ div.nodata_container {
|
||||
padding: 0;
|
||||
margin: 0.5em 0 !important;
|
||||
}
|
||||
|
||||
.div-visual-console-spinner {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.cv-overflow {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.visual-console-container-dashboard a:visited {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
@ -790,12 +790,11 @@ class Ui
|
||||
echo ' <title>'.$this->title."</title>\n";
|
||||
echo " <meta charset='UTF-8' />\n";
|
||||
echo " <meta name='viewport' content='width=device-width, initial-scale=1'>\n";
|
||||
echo ' <link rel="icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/ico" />'."\n";
|
||||
echo ' <link rel="shortcut icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/x-icon" />'."\n";
|
||||
echo " <link rel='stylesheet' href='include/style/main.css' />\n";
|
||||
// echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.4.5.css' />\n";
|
||||
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.5.0-rc1.min.css' />\n";
|
||||
// echo " <script src='include/javascript/jquery.js.bakc'></script>\n";
|
||||
echo " <script src='include/javascript/jquery.js'></script>\n";
|
||||
// echo " <script src='include/javascript/jquery.mobile-1.4.5.js'></script>\n";
|
||||
echo " <script src='include/javascript/jquery.mobile-1.5.0-rc1.js'></script>\n";
|
||||
echo " <script src='../include/javascript/pandora.js'></script>\n";
|
||||
echo " <script src='../include/javascript/pandora_ui.js'></script>\n";
|
||||
@ -986,6 +985,30 @@ class Ui
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load VC.
|
||||
*
|
||||
* @param string $settings Json object.
|
||||
* @param integer $visualConsoleId Id.
|
||||
*
|
||||
* @return void Output script.
|
||||
*/
|
||||
public function loadVc($settings, $visualConsoleId)
|
||||
{
|
||||
$this->contentAddHtml(
|
||||
'<script type="text/javascript">
|
||||
var settings = '.$settings.';
|
||||
var fullUrl = "'.ui_get_full_url('/', false, false, false).'";
|
||||
var visualConsoleId = '.$visualConsoleId.';
|
||||
|
||||
$(document).ready(function () {
|
||||
dashboardLoadVC(settings);
|
||||
});
|
||||
</script>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Table
|
||||
|
@ -83,22 +83,60 @@ class User
|
||||
{
|
||||
$system = System::getInstance();
|
||||
|
||||
$loginhash = $system->getRequest('loginhash', null);
|
||||
$autologin = $system->getRequest('autologin', false);
|
||||
if ($autologin) {
|
||||
if ($autologin !== false) {
|
||||
$user = $system->getRequest('user', null);
|
||||
$password = $system->getRequest('password', null);
|
||||
|
||||
$this->login($user, $password);
|
||||
} else {
|
||||
if (empty($loginhash) === false) {
|
||||
// Hash login process.
|
||||
$loginhash_data = $system->getRequest('loginhash_data', null);
|
||||
$loginhash_user = str_rot13($system->getRequest('loginhash_user', null));
|
||||
$this->login($loginhash_user, null, $loginhash_data);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->logged;
|
||||
}
|
||||
|
||||
|
||||
public function login($user=null, $password=null)
|
||||
public function login($user=null, $password=null, $loginhash_data='')
|
||||
{
|
||||
global $config;
|
||||
$system = System::getInstance();
|
||||
|
||||
if (empty($loginhash_data) === false) {
|
||||
if ($config['loginhash_pwd'] != ''
|
||||
&& $loginhash_data == md5(
|
||||
$user.io_output_password(
|
||||
$config['loginhash_pwd']
|
||||
)
|
||||
)
|
||||
) {
|
||||
$this->logged = true;
|
||||
$this->user = $user;
|
||||
$this->loginTime = time();
|
||||
$this->errorLogin = false;
|
||||
$this->saveLogin();
|
||||
} else {
|
||||
include_once 'general/login_page.php';
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_REGISTRATION,
|
||||
'Loginhash failed',
|
||||
'system'
|
||||
);
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
return $this->logged;
|
||||
}
|
||||
|
||||
if ($system->getConfig('auth', 'mysql') === 'saml') {
|
||||
if ((bool) $system->getRequest('saml', false) === true) {
|
||||
\enterprise_include_once('include/auth/saml.php');
|
||||
|
@ -170,6 +170,8 @@ switch ($action) {
|
||||
case 'visualmap':
|
||||
$visualmap = new Visualmap();
|
||||
$visualmap->ajax($parameter2);
|
||||
break;
|
||||
|
||||
case 'tactical':
|
||||
$tactical = new Tactical();
|
||||
$tactical->ajax($parameter2);
|
||||
|
@ -1,15 +1,33 @@
|
||||
<?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 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.
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Agent view for mobile
|
||||
*
|
||||
* @category Mobile
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once '../include/functions_users.php';
|
||||
|
||||
class Agent
|
||||
@ -256,10 +274,9 @@ class Agent
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
1,
|
||||
''
|
||||
500,
|
||||
1
|
||||
);
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
@ -1,15 +1,33 @@
|
||||
<?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 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.
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Agents list view for mobile
|
||||
*
|
||||
* @category Mobile
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
class Agents
|
||||
{
|
||||
|
||||
@ -67,7 +85,7 @@ class Agents
|
||||
|
||||
$listAgents = $this->getListAgents($page, true);
|
||||
|
||||
if (!empty($listAgents['agents'])) {
|
||||
if (empty($listAgents['agents']) === false) {
|
||||
$end = 0;
|
||||
|
||||
$agents = [];
|
||||
@ -96,7 +114,7 @@ class Agents
|
||||
$system = System::getInstance();
|
||||
$user = User::getInstance();
|
||||
|
||||
// Default
|
||||
// Default.
|
||||
$filters = [
|
||||
'free_search' => '',
|
||||
'status' => -1,
|
||||
@ -104,7 +122,7 @@ class Agents
|
||||
];
|
||||
|
||||
$serialized_filters = (string) $system->getRequest('agents_filter');
|
||||
if (!empty($serialized_filters)) {
|
||||
if (empty($serialized_filters) === true) {
|
||||
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
|
||||
if ($filters_unsafe) {
|
||||
$filters = $system->safeInput($filters_unsafe);
|
||||
@ -144,8 +162,8 @@ class Agents
|
||||
$filters['group'] = $this->group;
|
||||
}
|
||||
|
||||
if (!empty($filters)) {
|
||||
// Store the filter
|
||||
if (empty($filters) === false) {
|
||||
// Store the filter.
|
||||
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
|
||||
}
|
||||
}
|
||||
@ -260,7 +278,7 @@ class Agents
|
||||
|
||||
$search_sql = '';
|
||||
|
||||
if (!empty($this->free_search)) {
|
||||
if (empty($this->free_search) === false) {
|
||||
$search_sql = " AND (
|
||||
alias LIKE '%".$this->free_search."%'
|
||||
OR nombre LIKE '%".$this->free_search."%'
|
||||
@ -463,11 +481,9 @@ class Agents
|
||||
var page = 1;
|
||||
|
||||
function custom_scroll() {
|
||||
|
||||
if (load_more_rows) {
|
||||
if ($(this).scrollTop() + $(this).height()
|
||||
>= ($(document).height() - 100)) {
|
||||
|
||||
load_more_rows = 0;
|
||||
|
||||
postvars = {};
|
||||
@ -503,15 +519,18 @@ class Agents
|
||||
load_more_rows = 1;
|
||||
refresh_link_listener_list_agents();
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
\"json\");
|
||||
// Clean
|
||||
$('#loading_rows').remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Be sure of fill all of screen first.
|
||||
custom_scroll();
|
||||
|
||||
$(window).bind(\"scroll\", function () {
|
||||
custom_scroll();
|
||||
});
|
||||
|
@ -1,15 +1,33 @@
|
||||
<?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 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.
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Alerts list view for mobile
|
||||
*
|
||||
* @category Mobile
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
class Alerts
|
||||
{
|
||||
|
||||
|
@ -734,6 +734,7 @@ class Events
|
||||
// --------------Fill the SQL POST-------------------------------
|
||||
$sql_post = ' WHERE 1=1 ';
|
||||
|
||||
if ($this->status != null) {
|
||||
switch ($this->status) {
|
||||
case 0:
|
||||
case 1:
|
||||
@ -744,13 +745,18 @@ class Events
|
||||
case 3:
|
||||
$sql_post .= ' AND (estado = 0 OR estado = 2)';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->free_search != '') {
|
||||
$sql_post .= " AND evento LIKE '%".io_safe_input($this->free_search)."%'";
|
||||
}
|
||||
|
||||
if ($this->severity != -1) {
|
||||
if ($this->severity != null && $this->severity != -1) {
|
||||
switch ($this->severity) {
|
||||
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
||||
$sql_post .= ' AND (criticity = '.EVENT_CRIT_WARNING.' OR
|
||||
|
@ -1,15 +1,33 @@
|
||||
<?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 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.
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Modules list view for mobile
|
||||
*
|
||||
* @category Mobile
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
class Modules
|
||||
{
|
||||
|
||||
@ -106,7 +124,7 @@ class Modules
|
||||
}
|
||||
|
||||
if (isset($filters['status'])) {
|
||||
$this->status = $filters['status'];
|
||||
$this->status = (int) $filters['status'];
|
||||
}
|
||||
|
||||
if (isset($filters['name'])) {
|
||||
@ -143,7 +161,7 @@ class Modules
|
||||
}
|
||||
|
||||
$this->status = $system->getRequest('status', __('Status'));
|
||||
if (($this->status === __('Status')) || ($this->status == AGENT_MODULE_STATUS_ALL)) {
|
||||
if (($this->status === __('Status')) || ((int) $this->status === AGENT_MODULE_STATUS_ALL)) {
|
||||
$this->status = AGENT_MODULE_STATUS_ALL;
|
||||
} else {
|
||||
$this->default = false;
|
||||
@ -390,35 +408,28 @@ class Modules
|
||||
}
|
||||
|
||||
// Part SQL fro Status
|
||||
if ($this->status == AGENT_MODULE_STATUS_NORMAL) {
|
||||
// Normal
|
||||
if ((int) $this->status == AGENT_MODULE_STATUS_NORMAL) {
|
||||
// Normal.
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 0
|
||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
||||
} else if ($this->status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||
// Critical
|
||||
} else if ((int) $this->status === AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||
// Critical.
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
|
||||
} else if ($this->status == AGENT_MODULE_STATUS_WARNING) {
|
||||
// Warning
|
||||
} else if ((int) $this->status === AGENT_MODULE_STATUS_WARNING) {
|
||||
// Warning.
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
|
||||
} else if ($this->status == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||
// Not normal
|
||||
} else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||
// Not normal.
|
||||
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
||||
} else if ($this->status == AGENT_MODULE_STATUS_UNKNOWN) {
|
||||
// Unknown
|
||||
} else if ((int) $this->status === AGENT_MODULE_STATUS_UNKNOWN) {
|
||||
// Unknown.
|
||||
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
|
||||
} else if ($this->status == AGENT_MODULE_STATUS_NOT_INIT) {
|
||||
// Not init
|
||||
} else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_INIT) {
|
||||
// Not init.
|
||||
$sql_conditions .= ' AND tagente_estado.utimestamp = 0
|
||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
||||
}
|
||||
|
||||
if ($this->status != AGENT_MODULE_STATUS_NOT_INIT) {
|
||||
// When filter is not "not init"
|
||||
// Not show not init modules. It's only operation view
|
||||
$sql_conditions .= ' AND (tagente_estado.utimestamp != 0
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
|
||||
}
|
||||
|
||||
if ($this->tag > 0) {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
@ -476,6 +487,7 @@ class Modules
|
||||
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all;
|
||||
|
||||
$sql_limit = 'ORDER BY tagente.nombre ASC ';
|
||||
|
||||
if (!$this->all_modules) {
|
||||
$sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize();
|
||||
}
|
||||
|
@ -126,13 +126,6 @@ class Visualmap
|
||||
$this->id = (int) $system->getRequest('id', 0);
|
||||
$this->width = (int) $system->getRequest('width', 0);
|
||||
$this->height = (int) $system->getRequest('height', 0);
|
||||
|
||||
if ($this->width < $this->height) {
|
||||
$w = $this->width;
|
||||
$this->width = $this->height;
|
||||
$this->height = $w;
|
||||
$this->rotate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +146,8 @@ class Visualmap
|
||||
$ui->retrieveViewPort();
|
||||
}
|
||||
|
||||
$this->height -= 39;
|
||||
// Header.
|
||||
$this->height -= 40;
|
||||
|
||||
$this->visualmap = db_get_row(
|
||||
'tlayout',
|
||||
@ -211,29 +205,7 @@ class Visualmap
|
||||
*/
|
||||
public function ajax(string $parameter2='')
|
||||
{
|
||||
$system = System::getInstance();
|
||||
$this->checkVisualmapACL($this->visualmap['id_group']);
|
||||
if ((bool) $this->validAcl === false) {
|
||||
$this->show_fail_acl();
|
||||
} else {
|
||||
switch ($parameter2) {
|
||||
case 'render_map':
|
||||
$map_id = $system->getRequest('map_id', '0');
|
||||
$width = $system->getRequest('width', '400');
|
||||
$height = $system->getRequest('height', '400');
|
||||
visual_map_print_visual_map(
|
||||
$map_id,
|
||||
false,
|
||||
true,
|
||||
$width,
|
||||
$height
|
||||
);
|
||||
exit;
|
||||
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -307,20 +279,8 @@ class Visualmap
|
||||
'height' => $this->height,
|
||||
];
|
||||
|
||||
$ratio_t = $visualConsole->adjustToViewport($size, 'mobile');
|
||||
$visualConsoleData = $visualConsole->toArray();
|
||||
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
|
||||
$ratio_t = ($size['width'] / $visualConsoleData['width']);
|
||||
$radio_h = ($size['height'] / $visualConsoleData['height']);
|
||||
|
||||
$visualConsoleData['width'] = $size['width'];
|
||||
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
|
||||
|
||||
if ($visualConsoleData['height'] > $size['height']) {
|
||||
$ratio_t = $radio_h;
|
||||
|
||||
$visualConsoleData['height'] = $size['height'];
|
||||
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
|
||||
}
|
||||
|
||||
$uniq = uniqid();
|
||||
|
||||
@ -328,7 +288,6 @@ class Visualmap
|
||||
// Style.
|
||||
$style = 'width:'.$visualConsoleData['width'].'px;';
|
||||
$style .= 'height:'.$visualConsoleData['height'].'px;';
|
||||
$style .= 'background-size: cover;';
|
||||
|
||||
// Class.
|
||||
$class = 'visual-console-container-dashboard c-'.$uniq;
|
||||
@ -366,42 +325,13 @@ class Visualmap
|
||||
$ratio_t
|
||||
);
|
||||
|
||||
// Horrible trick! due to the use of tinyMCE
|
||||
// it is necessary to modify specific classes of each
|
||||
// of the visual consoles.
|
||||
$output .= '<style type="text/css">';
|
||||
$output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt; line-height:'.(4 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt; line-height:'.(6 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt; line-height:'.(10 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt; line-height:'.(12 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt; line-height:'.(14 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt; line-height:'.(18 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt; line-height:'.(24 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt; line-height:'.(28 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt; line-height:'.(36 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt; line-height:'.(48 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt; line-height:'.(60 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt; line-height:'.(72 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt; line-height:'.(84 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt; line-height:'.(96 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt; line-height:'.(116 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt; line-height:'.(128 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt; line-height:'.(140 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt; line-height:'.(154 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt; line-height:'.(196 * ($ratio_t)).'pt; }';
|
||||
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio_t).'px !important; line-height: '.(50 * $ratio_t).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
|
||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
|
||||
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
|
||||
$output .= css_label_styles_visual_console($uniq, $ratio_t);
|
||||
$output .= '</style>';
|
||||
|
||||
$visualConsoleItems = array_reduce(
|
||||
$visualConsoleItems,
|
||||
function ($carry, $item) use ($ratio_t) {
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item->toArray();
|
||||
return $carry;
|
||||
},
|
||||
@ -413,36 +343,18 @@ class Visualmap
|
||||
'props' => $visualConsoleData,
|
||||
'items' => $visualConsoleItems,
|
||||
'baseUrl' => ui_get_full_url('/', false, false, false),
|
||||
'page' => 'include/ajax/visual_console.ajax',
|
||||
'ratio' => $ratio_t,
|
||||
'size' => $size,
|
||||
'cellId' => $uniq,
|
||||
'uniq' => $uniq,
|
||||
'mobile' => true,
|
||||
'vcId' => $visualConsoleId,
|
||||
]
|
||||
);
|
||||
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= '$(document).ready(function () {';
|
||||
$output .= 'dashboardLoadVC('.$settings.')';
|
||||
$output .= '});';
|
||||
if ($this->rotate === true) {
|
||||
$output .= "$('.container-center').css('transform', 'rotate(90deg)');";
|
||||
}
|
||||
|
||||
$output .= '$( window ).on( "orientationchange", function( event )';
|
||||
$output .= ' { window.location.href = "';
|
||||
$output .= ui_get_full_url(
|
||||
'/mobile/index.php?page=visualmap&id='.$visualConsoleId
|
||||
);
|
||||
$output .= '" });';
|
||||
|
||||
$output .= '</script>';
|
||||
|
||||
$ui->contentAddHtml($output);
|
||||
|
||||
// Load Visual Console Items.
|
||||
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||
$visualConsoleId,
|
||||
$aclUserGroups
|
||||
);
|
||||
$ui->loadVc($settings, $visualConsoleId);
|
||||
|
||||
$javascript = ob_get_clean();
|
||||
$ui->contentAddHtml($javascript);
|
||||
|
@ -74,6 +74,13 @@ class Visualmaps
|
||||
*/
|
||||
private $type = 0;
|
||||
|
||||
/**
|
||||
* CV favourites.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $favourite = true;
|
||||
|
||||
|
||||
/**
|
||||
* Builder.
|
||||
@ -188,6 +195,20 @@ class Visualmaps
|
||||
$ui->showFooter(false);
|
||||
$ui->beginContent();
|
||||
$this->listVisualmapsHtml();
|
||||
|
||||
$output = '<script type="text/javascript">';
|
||||
$output .= 'function loadVisualConsole(id) {';
|
||||
$output .= ' var dimensions = "&width="+$(window).width();';
|
||||
$output .= ' dimensions += "&height="+$(window).height();';
|
||||
$output .= ' window.location.href = "';
|
||||
$output .= ui_get_full_url('/', false, false, false);
|
||||
$output .= 'mobile/index.php?page=visualmap&id="';
|
||||
$output .= '+id+dimensions;';
|
||||
$output .= '};';
|
||||
$output .= '</script>';
|
||||
|
||||
$ui->contentAddHtml($output);
|
||||
|
||||
$ui->endContent();
|
||||
$ui->showPage();
|
||||
}
|
||||
@ -201,9 +222,42 @@ class Visualmaps
|
||||
private function listVisualmapsHtml()
|
||||
{
|
||||
$system = System::getInstance();
|
||||
$this->favourite = (bool) $system->getRequest('favourite', true);
|
||||
$ui = Ui::getInstance();
|
||||
|
||||
$visualmaps = visual_map_get_user_layouts();
|
||||
$visualmaps = visual_map_get_user_layouts(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
$this->favourite
|
||||
);
|
||||
|
||||
if ($this->favourite === true) {
|
||||
$ui->contentAddHtml(
|
||||
$ui->createButton(
|
||||
[
|
||||
'icon' => '',
|
||||
'pos' => 'right',
|
||||
'text' => __('All visual consoles'),
|
||||
'href' => 'index.php?page=visualmaps&favourite=0',
|
||||
'class' => '',
|
||||
]
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$ui->contentAddHtml(
|
||||
$ui->createButton(
|
||||
[
|
||||
'icon' => '',
|
||||
'pos' => 'right',
|
||||
'text' => __('Favourite visual consoles'),
|
||||
'href' => 'index.php?page=visualmaps&favourite=1',
|
||||
'class' => '',
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($visualmaps) === true) {
|
||||
$ui->contentAddHtml('<p style="color: #ff0000;">'.__('No maps defined').'</p>');
|
||||
@ -214,8 +268,8 @@ class Visualmaps
|
||||
$table->id = 'list_visualmaps';
|
||||
foreach ($visualmaps as $map) {
|
||||
$link = '<a class="ui-link" data-ajax="false" ';
|
||||
$link .= ' href="index.php?page=visualmap&id=';
|
||||
$link .= $map['id'].'">'.io_safe_output($map['name']).'</a>';
|
||||
$link .= ' href="#" onclick="loadVisualConsole(';
|
||||
$link .= $map['id'].')">'.io_safe_output($map['name']).'</a>';
|
||||
|
||||
$row = $link;
|
||||
$row .= ui_print_group_icon(
|
||||
|
@ -365,7 +365,7 @@ $data[1] = ui_progress(
|
||||
($agent['intervalo'] - (strtotime('now') - strtotime($agent['ultimo_contacto']))).' s',
|
||||
[
|
||||
'page' => 'operation/agentes/ver_agente',
|
||||
'interval' => (100 / $agent['intervalo']),
|
||||
'interval' => (empty($agent['intervalo']) === true) ? 0 : (100 / $agent['intervalo']),
|
||||
'data' => [
|
||||
'id_agente' => $id_agente,
|
||||
'refresh_contact' => 1,
|
||||
|
@ -176,6 +176,7 @@ function load_agents_selector(group) {
|
||||
{
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"get_agents_also_interfaces" : 1,
|
||||
"id_group" : group,
|
||||
"privilege" : "AW",
|
||||
"keys_prefix" : "_",
|
||||
@ -216,6 +217,7 @@ $("#checkbox-recursion").change (function () {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"get_agents_also_interfaces" : 1,
|
||||
"id_group" : $("#group_id").val(),
|
||||
"privilege" : "AW",
|
||||
"keys_prefix" : "_",
|
||||
@ -226,7 +228,6 @@ $("#checkbox-recursion").change (function () {
|
||||
$("#module").html('');
|
||||
jQuery.each (data, function (id, value) {
|
||||
id = id.substring(1);
|
||||
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente"])
|
||||
.html (value["alias"]);
|
||||
|
@ -81,6 +81,8 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>';
|
||||
} else {
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -100,7 +102,7 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
|
||||
$last_data = preg_replace('/>/', '>', $last_data);
|
||||
$last_data = preg_replace('/\n/i', '<br>', $last_data);
|
||||
$last_data = preg_replace('/\s/i', ' ', $last_data);
|
||||
echo "<div id='result_div' class='result_div'>";
|
||||
echo "<div id='result_div' class='result_div mono'>";
|
||||
echo $last_data;
|
||||
echo '</div>';
|
||||
?>
|
||||
|
@ -49,6 +49,7 @@ if (is_ajax()) {
|
||||
$get_agent_modules_json = (bool) get_parameter('get_agent_modules_json');
|
||||
$get_agent_status_tooltip = (bool) get_parameter('get_agent_status_tooltip');
|
||||
$get_agents_group_json = (bool) get_parameter('get_agents_group_json');
|
||||
$get_agents_also_interfaces = (bool) get_parameter('get_agents_also_interfaces');
|
||||
$get_modules_group_json = (bool) get_parameter('get_modules_group_json');
|
||||
$filter_modules_group_json = (bool) get_parameter('filter_modules_group_json');
|
||||
$get_modules_group_value_name_json = (bool) get_parameter('get_modules_group_value_name_json');
|
||||
@ -103,15 +104,15 @@ if (is_ajax()) {
|
||||
// Build filter.
|
||||
$filter = [];
|
||||
|
||||
if (!empty($id_os)) {
|
||||
if (empty($id_os) === false) {
|
||||
$filter['id_os'] = $id_os;
|
||||
}
|
||||
|
||||
if (!empty($agent_name)) {
|
||||
if (empty($agent_name) === false) {
|
||||
$filter['nombre'] = '%'.$agent_name.'%';
|
||||
}
|
||||
|
||||
if (!empty($agent_alias)) {
|
||||
if (empty($agent_alias) === false) {
|
||||
$filter['alias'] = '%'.$agent_alias.'%';
|
||||
}
|
||||
|
||||
@ -147,6 +148,20 @@ if (is_ajax()) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($get_agents_also_interfaces === true) {
|
||||
$listAgentsWithIface = db_get_all_rows_sql("SELECT DISTINCT id_agente FROM tagente_modulo WHERE nombre LIKE '%_ifOperStatus'");
|
||||
if (empty($listAgentsWithIface) === false) {
|
||||
$filter['matchIds'] = array_reduce(
|
||||
$listAgentsWithIface,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['id_agente'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform search.
|
||||
$agents = agents_get_group_agents(
|
||||
// Id_group.
|
||||
@ -171,7 +186,7 @@ if (is_ajax()) {
|
||||
(bool) is_metaconsole()
|
||||
);
|
||||
|
||||
if (empty($agents)) {
|
||||
if (empty($agents) === true) {
|
||||
$agents = [];
|
||||
}
|
||||
|
||||
|
@ -108,5 +108,6 @@ filemanager_file_explorer(
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false
|
||||
false,
|
||||
['all' => true]
|
||||
);
|
||||
|
@ -45,6 +45,8 @@ $group_id = (int) get_parameter('group_id');
|
||||
$tag_id = (int) get_parameter('tag_id');
|
||||
$strict_acl = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
|
||||
$serach_hirearchy = (bool) get_parameter('searchHirearchy', false);
|
||||
$show_disabled = get_parameter('show_disabled', false);
|
||||
|
||||
// ---------------------Tabs -------------------------------------------
|
||||
$enterpriseEnable = false;
|
||||
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
|
||||
@ -249,6 +251,10 @@ $row[] = html_print_input_hidden('show_not_init_modules_hidden', $show_not_init_
|
||||
if (is_metaconsole() === true) {
|
||||
$table->data[] = $row;
|
||||
$row = [];
|
||||
$row[] = __('Show only disabled');
|
||||
$row[] = html_print_checkbox('show_disabled', $show_disabled, false, true);
|
||||
$table->data[] = $row;
|
||||
$row = [];
|
||||
}
|
||||
|
||||
$row[] = html_print_submit_button(__('Filter'), 'uptbutton', false, 'class="sub search"', true);
|
||||
@ -323,7 +329,7 @@ html_print_image(
|
||||
echo "<div id='tree-controller-recipient'>";
|
||||
echo '</div>';
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@ -331,7 +337,7 @@ enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
||||
<?php if (!is_metaconsole()) { ?>
|
||||
<?php if (is_metaconsole() === false) { ?>
|
||||
<script type="text/javascript" src="include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php } else { ?>
|
||||
<script type="text/javascript" src="../../include/javascript/fixed-bottom-box.js"></script>
|
||||
@ -390,6 +396,13 @@ enterprise_hook('close_meta_frame');
|
||||
$('#hidden-show_not_init_modules_hidden').val(0);
|
||||
}
|
||||
|
||||
if($("#checkbox-show_disabled").is(':checked')){
|
||||
parameters['filter']['show_disabled'] = 1;
|
||||
}
|
||||
else{
|
||||
parameters['filter']['show_disabled'] = 0;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
|
@ -221,6 +221,12 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||
if (title !== null) {
|
||||
title.textContent = newProps.name;
|
||||
}
|
||||
|
||||
// Fullscreen Meta view title.
|
||||
var titleMeta = document.querySelector("div.vc-title-meta");
|
||||
if (titleMeta !== null) {
|
||||
titleMeta.textContent = newProps.name;
|
||||
}
|
||||
}
|
||||
|
||||
// Change the links.
|
||||
|
@ -611,7 +611,7 @@ ui_require_css_file('form');
|
||||
if (prevProps && prevProps.name != newProps.name) {
|
||||
// View title.
|
||||
var title = document.querySelector(
|
||||
"div#menu_tab_frame_view > div#menu_tab_left span"
|
||||
".breadcrumbs-title"
|
||||
);
|
||||
if (title !== null) {
|
||||
title.textContent = newProps.name;
|
||||
@ -621,7 +621,12 @@ ui_require_css_file('form');
|
||||
if (fullscreenTitle !== null) {
|
||||
fullscreenTitle.textContent = newProps.name;
|
||||
}
|
||||
// TODO: Change the metaconsole title.
|
||||
|
||||
// Fullscreen Meta view title.
|
||||
var fullscreenTitleMeta = document.querySelector("div.vc-title-meta");
|
||||
if (fullscreenTitleMeta !== null) {
|
||||
fullscreenTitleMeta.textContent = newProps.name;
|
||||
}
|
||||
}
|
||||
|
||||
// Change the links.
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220323
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220323
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220323
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -4039,6 +4039,7 @@ CREATE TABLE IF NOT EXISTS `tipam_vlan` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(250) NOT NULL,
|
||||
`description` TEXT,
|
||||
`custom_id` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
@ -4226,3 +4227,17 @@ CREATE TABLE IF NOT EXISTS `tncm_firmware` (
|
||||
`path` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tbackup`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tbackup` (
|
||||
`id` SERIAL,
|
||||
`utimestamp` BIGINT DEFAULT 0,
|
||||
`filename` VARCHAR(512) DEFAULT '',
|
||||
`id_user` VARCHAR(60) DEFAULT '',
|
||||
`description` MEDIUMTEXT,
|
||||
`pid` INT UNSIGNED DEFAULT 0,
|
||||
`filepath` VARCHAR(512) DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user