Merge remote-tracking branch 'origin/develop' into ent-7288-correlacion-eventos-no-permite-crear-condiciones-complejas

This commit is contained in:
fbsanchez 2021-04-15 15:33:14 +02:00
commit 3bc8f6c4ac
63 changed files with 1768 additions and 988 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.753-210414
Version: 7.0NG.753-210415
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.753-210414"
pandora_version="7.0NG.753-210415"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.753';
use constant AGENT_BUILD => '210414';
use constant AGENT_BUILD => '210415';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.753
%define release 210414
%define release 210415
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.753
%define release 210414
%define release 210415
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.753"
PI_BUILD="210414"
PI_BUILD="210415"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210414}
{210415}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.753(Build 210414)")
#define PANDORA_VERSION ("7.0NG.753(Build 210415)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.753(Build 210414))"
VALUE "ProductVersion", "(7.0NG.753(Build 210415))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.753-210414
Version: 7.0NG.753-210415
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.753-210414"
pandora_version="7.0NG.753-210415"
package_pear=0
package_pandora=1

View File

@ -61,6 +61,11 @@ if (defined('METACONSOLE')) {
$sec = 'galertas';
}
$can_edit_all = false;
if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$can_edit_all = true;
}
// Header.
if (defined('METACONSOLE')) {
alerts_meta_print_header();
@ -79,30 +84,13 @@ if ($copy_action) {
$al_action = alerts_get_alert_action($id);
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
if ($al_action !== false) {
// If user tries to copy an action with group=ALL.
if ($al_action['id_group'] == 0) {
// Then must have "PM" access privileges.
if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
// If user who doesn't have permission to modify group all tries to copy an action with group=ALL.
if ($can_edit_all == false && $al_action['id_group'] == 0) {
$al_action['id_group'] = users_get_first_group(false, 'LM', false);
} else {
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
if ($can_edit_all == true || check_acl($config['id_user'], 0, 'PM')) {
$own_groups = array_keys(
users_get_groups($config['id_user'], 'LM')
);
@ -125,7 +113,7 @@ if ($copy_action) {
}
}
$result = alerts_clone_alert_action($id);
$result = alerts_clone_alert_action($id, $al_action['id_group']);
if ($result) {
db_pandora_audit(
@ -397,10 +385,9 @@ foreach ($actions as $action) {
$data = [];
if (check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
} else {
$data[0] = $action['name'];
if ($action['id_group'] == 0 && $can_edit_all == false) {
$data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true);
}
$data[1] = $action['command_name'];
@ -420,7 +407,7 @@ foreach ($actions as $action) {
$data[4] = '';
if (is_central_policies_on_node() === false
&& check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')
&& check_acl($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [
3 => 'action_buttons',
@ -430,10 +417,35 @@ foreach ($actions as $action) {
$id_action = $action['id'];
$text_confirm = __('Are you sure?');
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="copy_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="delete_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data[3] = '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.$text_confirm.'\')) return false;">';
$data[3] .= html_print_input_hidden('copy_action', 1, true);
$data[3] .= html_print_input_hidden('id', $id_action, true);
$data[3] .= html_print_input_image(
'dup',
'images/copy.png',
1,
'',
true,
['title' => __('Duplicate')]
);
$data[3] .= '</form> ';
if ($action['id_group'] != 0 || $can_edit_all == true) {
$data[4] = '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.$text_confirm.'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_action', 1, true);
$data[4] .= html_print_input_hidden('id', $id_action, true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
1,
'',
true,
['title' => __('Delete')]
);
$data[4] .= '</form> ';
} else {
$data[4] = '';
}
}
array_push($table->data, $data);
@ -458,44 +470,3 @@ if (is_central_policies_on_node() === false) {
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function copy_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"copy_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
function delete_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"delete_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
</script>

View File

@ -28,12 +28,6 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
exit;
}
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
echo "<div id='message_permissions' title='".__('Permissions warning')."' style='display:none;'>";
echo "<p style='text-align: center;font-weight: bold;'>".__('Command management is limited to administrator users or user profiles with permissions over Pandora FMS management').'</p>';
echo '</div>';
}
if (is_metaconsole()) {
$sec = 'advanced';
} else {
@ -467,6 +461,20 @@ if (is_ajax()) {
return;
}
// This check should be after ajax. Because, ajax will be called from configure_alert_action.
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin(
$config['id_user
']
)
) {
echo "<div id='message_permissions' title='".__('Permissions warning')."' s
tyle='display:none;'>";
echo "<p style='text-align: center;font-weight: bold; margin: 15px'>".__(
'Command management is limited to administrator users or user profiles with permissions PM'
).'</p>';
echo '</div>';
}
enterprise_hook('open_meta_frame');
if ($update_command) {
@ -675,13 +683,20 @@ foreach ($commands as $command) {
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
$config['id_user
']
)
) {
$data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '</span>';
}
}
array_push($table->data, $data);
}

View File

@ -401,17 +401,16 @@ foreach ($templates as $template) {
$data = [];
if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'&pure='.$pure.'">'.$template['name'].'</a>';
} else {
$data[0] = $template['name'];
if (!check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[0] .= ui_print_help_tip(__('You cannot edit this alert template, You don\'t have the permission to edit All group.'), true);
}
$data[1] = ui_print_group_icon($template['id_group'], true);
$data[3] = alerts_get_alert_templates_type_name($template['type']);
if (is_central_policies_on_node() === false
&& check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')
&& check_acl($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" class="float-left inline_line">';
@ -427,6 +426,7 @@ foreach ($templates as $template) {
);
$data[4] .= '</form> ';
if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[4] .= '<form method="post" class="float-right inline_line" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_template', 1, true);
$data[4] .= html_print_input_hidden('id', $template['id'], true);
@ -439,6 +439,7 @@ foreach ($templates as $template) {
['title' => __('Delete')]
);
$data[4] .= '</form> ';
}
} else {
$data[4] = '';
}

View File

@ -58,7 +58,7 @@ if (defined('METACONSOLE')) {
if ($al_action !== false) {
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
if ($own_info['is_admin'] || check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
} else {
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
@ -91,8 +91,14 @@ if ($al_action !== false) {
true
);
}
$is_in_group = true;
}
if (!$is_in_group && $al_action['id_group'] != 0) {
db_pandora_audit('ACL Violation', 'Trying to access unauthorized alert action configuration');
include 'general/noaccess.php';
exit;
}
$is_central_policies_on_node = is_central_policies_on_node();
@ -102,6 +108,11 @@ if ($is_central_policies_on_node === true) {
);
}
$disabled = !$is_in_group;
$disabled_attr = '';
if ($disabled) {
$disabled_attr = 'disabled="disabled"';
}
$name = '';
$id_command = '';
@ -116,15 +127,6 @@ if ($id) {
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
$create_wu_integria = $action['create_wu_integria'];
if (!check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
}
// Hidden div with help hint to fill with javascript.
@ -175,7 +177,7 @@ $table->data[0][1] = html_print_input_text(
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
if (io_safe_output($name) == 'Monitoring Event') {
@ -194,7 +196,7 @@ $own_info = get_user_info($config['id_user']);
$return_all_group = false;
if (users_can_manage_group_all('LW') === true) {
if (users_can_manage_group_all('LW') === true || $disabled) {
$return_all_group = true;
}
@ -211,7 +213,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
).'</div>';
$table->colspan[1][1] = 2;
@ -245,11 +247,11 @@ $table->data[2][1] = html_print_select_from_sql(
true,
false,
false,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[2][1] .= ' ';
if ($is_central_policies_on_node === false
&& check_acl($config['id_user'], 0, 'PM')
&& check_acl($config['id_user'], 0, 'PM') && !$disabled
) {
$table->data[2][1] .= __('Create Command');
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
@ -272,7 +274,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
false,
true,
'',
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
false,
'',
false,
@ -308,7 +310,7 @@ $table->data[6][0] = __('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
true
);
$table->data[6][1] = html_print_checkbox_switch_extended('create_wu_integria', 1, $create_wu_integria, false, '', '', true);
$table->data[6][1] = html_print_checkbox_switch_extended('create_wu_integria', 1, $create_wu_integria, false, '', $disabled_attr, true);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = html_print_image(
@ -328,12 +330,16 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][1] .= html_print_input_hidden(
'field'.$i.'_value',
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
true
true,
'',
$disabled_attr
);
$table->data['field'.$i][2] .= html_print_input_hidden(
'field'.$i.'_recovery_value',
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
true
true,
'',
$disabled_attr
);
}
@ -346,9 +352,7 @@ if ($is_central_policies_on_node === false) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);
if ($al_action['id_group'] == 0) {
// Then must have "PM" access privileges.
if (check_acl($config['id_user'], 0, 'PM')) {
if (!$disabled) {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
@ -356,15 +360,12 @@ if ($is_central_policies_on_node === false) {
false,
'class="sub upd"'
);
}
} else {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
'create',
false,
'class="sub upd"'
);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions">';
html_print_submit_button(__('Back'), 'back', false, 'class="sub upd"');
echo '</form>';
echo '</div>';
}
} else {
html_print_input_hidden('create_action', 1);
@ -608,6 +609,7 @@ $(document).ready (function () {
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';
var disabled = '';
var field_row = data["fields_rows"][i];
var $table_macros_field = $('#table_macros-field' + i);
@ -623,6 +625,7 @@ $(document).ready (function () {
== ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled');
}
if (($("[name=field" + i + "_recovery_value]").attr('id'))
@ -689,6 +692,10 @@ $(document).ready (function () {
$('#help_alert_macros_hint').html());
}
if (disabled) {
$("[name=field" + i + "_value]").attr('disabled','disabled');
$("[name=field" + i + "_recovery_value]").attr('disabled','disabled');
}
$table_macros_field.show();
}

View File

@ -38,7 +38,6 @@ $step = (int) get_parameter('step', 1);
// We set here the number of steps.
define('LAST_STEP', 3);
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
if ($duplicate_template) {
$source_id = (int) get_parameter('source_id');
$a_template = alerts_get_alert_template($source_id);
@ -52,19 +51,14 @@ if (defined('METACONSOLE')) {
$sec = 'galertas';
}
$can_edit_all = false;
if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$can_edit_all = true;
}
if ($a_template !== false) {
// If user tries to duplicate/edit a template with group=ALL
if ($a_template['id_group'] == 0) {
if (users_can_manage_group_all('LM') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
@ -146,7 +140,12 @@ if ($a_template !== false) {
if ($duplicate_template) {
$source_id = (int) get_parameter('source_id');
$id = alerts_duplicate_alert_template($source_id);
// If user doesn't have the permission to access All group and source template is All group, then group is changed to the first group of user.
if ($can_edit_all == false && a_template['id_group'] == 0) {
$a_template['id_group'] = users_get_first_group(false, 'LM', false);
}
$id = alerts_duplicate_alert_template($source_id, $a_template['id_group']);
if ($id) {
db_pandora_audit('Template alert management', 'Duplicate alert template '.$source_id.' clone to '.$id);
@ -386,6 +385,14 @@ $create_alert = (bool) get_parameter('create_alert');
$create_template = (bool) get_parameter('create_template');
$update_template = (bool) get_parameter('update_template');
$disabled = false;
if (!$create_alert && !$create_template) {
// When user edits a template with All group, user must have "LM" access privileges againt All group.
if ($a_template['id_group'] == 0 && !$can_edit_all) {
$disabled = true;
}
}
$name = '';
$description = '';
$type = '';
@ -602,7 +609,7 @@ if ($step == 2) {
1,
$monday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Tue');
$table->data[0][1] .= html_print_checkbox(
@ -610,7 +617,7 @@ if ($step == 2) {
1,
$tuesday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Wed');
$table->data[0][1] .= html_print_checkbox(
@ -618,7 +625,7 @@ if ($step == 2) {
1,
$wednesday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Thu');
$table->data[0][1] .= html_print_checkbox(
@ -626,7 +633,7 @@ if ($step == 2) {
1,
$thursday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Fri');
$table->data[0][1] .= html_print_checkbox(
@ -634,7 +641,7 @@ if ($step == 2) {
1,
$friday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Sat');
$table->data[0][1] .= html_print_checkbox(
@ -642,7 +649,7 @@ if ($step == 2) {
1,
$saturday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][1] .= __('Sun');
$table->data[0][1] .= html_print_checkbox(
@ -650,7 +657,7 @@ if ($step == 2) {
1,
$sunday,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[0][2] = __('Use special days list');
@ -659,7 +666,7 @@ if ($step == 2) {
1,
$special_day,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[1][0] = __('Time from');
@ -680,7 +687,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[1][2] = __('Time to');
$table->data[1][3] = html_print_input_text(
@ -700,7 +707,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->colspan['threshold'][1] = 3;
@ -716,7 +723,7 @@ if ($step == 2) {
false,
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[3][0] = __('Min. number of alerts');
@ -737,7 +744,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[3][2] = __('Reset counter for non-sustained alerts');
@ -750,7 +757,7 @@ if ($step == 2) {
1,
$min_alerts_reset_counter,
true,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
'',
false,
$create_template == 1 ? 'checked=checked' : ''
@ -774,7 +781,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[4][2] = __('Disable event');
@ -783,7 +790,7 @@ if ($step == 2) {
1,
$disable_event,
true,
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[5][0] = __('Default action');
@ -811,7 +818,7 @@ if ($step == 2) {
true,
false,
false,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
false,
false,
0
@ -833,7 +840,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
$table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
@ -886,7 +893,8 @@ if ($step == 2) {
'',
5,
255,
true
true,
$disabled
);
$table->colspan['min'][1] = 3;
@ -897,7 +905,8 @@ if ($step == 2) {
'',
5,
255,
true
true,
$disabled
);
$table->colspan['max'][1] = 3;
@ -940,7 +949,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->colspan[0][1] = 2;
@ -966,7 +975,7 @@ if ($step == 2) {
0,
'',
false,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
"removeTinyMCE('textarea_field".$i."')",
'',
true
@ -979,7 +988,7 @@ if ($step == 2) {
0,
'',
true,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
"addTinyMCE('textarea_field".$i."')",
'',
true
@ -995,7 +1004,7 @@ if ($step == 2) {
'class="fields" min-height-40px',
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
// Recovery.
@ -1007,7 +1016,7 @@ if ($step == 2) {
0,
'',
false,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
"removeTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1020,7 +1029,7 @@ if ($step == 2) {
0,
'',
true,
$is_central_policies_on_node,
$is_central_policies_on_node | $disabled,
"addTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1036,7 +1045,7 @@ if ($step == 2) {
'class="fields min-height-40px"',
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
}
} else {
@ -1093,7 +1102,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
@ -1103,8 +1112,12 @@ if ($step == 2) {
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
if (users_can_manage_group_all('LM') === true || $disabled) {
$return_all_group = true;
} else {
if ($id_group == 0) {
$id_group = users_get_first_group(false, 'LM', false);
}
}
$table->data[0][1] .= '&nbsp;';
@ -1121,7 +1134,7 @@ if ($step == 2) {
false,
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
).'</div>';
@ -1134,7 +1147,7 @@ if ($step == 2) {
'',
true,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
$table->data[2][0] = __('Priority');
@ -1149,7 +1162,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
$is_central_policies_on_node | $disabled
);
if (defined('METACONSOLE')) {
@ -1186,16 +1199,6 @@ if ($id) {
html_print_input_hidden('create_template', 1);
}
$disabled = false;
if (!$create_alert && !$create_template) {
if ($a_template['id_group'] == 0) {
// then must have "PM" access privileges
if (! check_acl($config['id_user'], 0, 'PM')) {
$disabled = true;
}
}
}
if (!$disabled) {
if ($is_central_policies_on_node === false) {
if ($step >= LAST_STEP) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC210414';
$build_version = 'PC210415';
$pandora_version = 'v7.0NG.753';
// Do not overwrite default timezone set if defined.

View File

@ -2252,12 +2252,16 @@ function check_login($output=true)
return true;
}
} else {
include_once $config['homedir'].'/mobile/include/db.class.php';
include_once $config['homedir'].'/mobile/include/system.class.php';
include_once $config['homedir'].'/mobile/include/user.class.php';
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
$user = User::getInstance();
$id_user = $user->getIdUser();
if (is_user($id_user)) {
$_SESSION['id_usuario'] = $id_user;
$config['id_user'] = $id_user;
return true;
}
}

View File

@ -448,10 +448,11 @@ function alerts_delete_alert_action($id_alert_action)
* Clone an alert action.
*
* @param int Id of the original alert action
* @param int Agent group id if it wants to be changed when clone.
*
* @return mixed Id of the cloned action or false in case of fail.
*/
function alerts_clone_alert_action($id_alert_action)
function alerts_clone_alert_action($id_alert_action, $id_group)
{
$id_alert_action = safe_int($id_alert_action, 1);
if (empty($id_alert_action)) {
@ -464,6 +465,10 @@ function alerts_clone_alert_action($id_alert_action)
return false;
}
if ($id_group != '') {
$action['id_group'] = $id_group;
}
unset($action['id']);
return alerts_create_alert_action($action['name'].' '.__('copy'), $action['id_alert_command'], $action);
@ -1130,10 +1135,11 @@ function alerts_get_alert_template_field3_recovery($id_alert_template)
* Duplicates an alert template.
*
* @param int Id of an alert template.
* @param int Agent group id if it wants to be changed when duplicate.
*
* @return mixed Duplicates an alert template or false if something goes wrong.
*/
function alerts_duplicate_alert_template($id_alert_template)
function alerts_duplicate_alert_template($id_alert_template, $id_group)
{
$template = alerts_get_alert_template($id_alert_template);
@ -1141,6 +1147,10 @@ function alerts_duplicate_alert_template($id_alert_template)
return false;
}
if ($id_group != '') {
$template['id_group'] = $id_group;
}
$name = io_safe_input(__('Copy of').' ').$template['name'];
$type = $template['type'];

View File

@ -885,6 +885,11 @@ function html_print_select(
";
}
$select2 = 'select2.min';
if ($config['style'] === 'pandora_black') {
$select2 = 'select2_dark.min';
}
if ($multiple === false) {
if (is_ajax()) {
$output .= '<script src="';
@ -898,18 +903,13 @@ function html_print_select(
$output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url(
'include/styles/select2.min.css',
'include/styles/'.$select2.'.css',
false,
false,
false
);
$output .= '"/>';
} else {
$select2 = 'select2.min';
if ($config['style'] === 'pandora_black') {
$select2 = 'select2_dark.min';
}
ui_require_css_file($select2);
ui_require_javascript_file('select2.min');
}

View File

@ -130,17 +130,24 @@ function html_do_report_info($report)
$date_today = date($config['date_format']);
$date_today = preg_split('/[\s,]+/', io_safe_output($date_today));
$date_today = __($date_today[0]).' '.$date_today[1].' '.$date_today[2].' '.$date_today[3].' '.$date_today[4];
$html = '<div class="report_info" style="background: '.$background_color.'"><table>
<tr>
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
</tr>
<tr>
<td><b>'.__('Report date').': </b></td>';
$date_before = date($config['date_format'], $report['datetime']);
$date_before = preg_split('/[\s,]+/', io_safe_output($date_before));
$date_before = __($date_before[0]).' '.$date_before[1].' '.$date_before[2].' '.$date_before[3].' '.$date_before[4];
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
} else {
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
$html .= '<td>'.__('Items period before').' <b>'.$date_before.'</b></td>';
}
$html .= '</tr>

View File

@ -290,7 +290,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
}
$last_data_str .= '&nbsp;';
$last_data_str .= html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px']);
$last_data_str .= html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px', 'class' => 'invert_filter']);
$is_snapshot = is_snapshot_data($last_data['datos']);
$is_large_image = is_text_to_black_string($last_data['datos']);
@ -307,7 +307,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
}
if ($salida !== null) {
$last_data_str = html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px']);
$last_data_str = html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px', 'class' => 'invert_filter']);
}
$last_data_str .= $salida;

View File

@ -322,7 +322,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
<tr>
<td class="icon icon_ui" rowspan="2" >'.html_print_image($icon_image, true, false, false, false, false).'</td>
<td class="title pandora_upper pdd_t_10px"><b>'.$text_title.'</b></td>
<td class="title pandora_upper pdd_t_10px text_left"><b>'.$text_title.'</b></td>
<td class="icon right pdd_r_3px">';
if (!$no_close_bool) {
// Use the no_meta parameter because this image is only in

View File

@ -29,10 +29,10 @@ Licensed under the MIT license.
* V. 1.1: Fix error handling so e.g. parsing an empty string does
* produce a color rather than just crashing.
*/
(function($){$.color={};$.color.make=function(r,g,b,a){var o={};o.r=r||0;o.g=g||0;o.b=b||0;o.a=a!=null?a:1;o.add=function(c,d){for(var i=0;i<c.length;++i)o[c.charAt(i)]+=d;return o.normalize()};o.scale=function(c,f){for(var i=0;i<c.length;++i)o[c.charAt(i)]*=f;return o.normalize()};o.toString=function(){if(o.a>=1){return"rgb("+[o.r,o.g,o.b].join(",")+")"}else{return"rgba("+[o.r,o.g,o.b,o.a].join(",")+")"}};o.normalize=function(){function clamp(min,value,max){return value<min?min:value>max?max:value}o.r=clamp(0,parseInt(o.r),255);o.g=clamp(0,parseInt(o.g),255);o.b=clamp(0,parseInt(o.b),255);o.a=clamp(0,o.a,1);return o};o.clone=function(){return $.color.make(o.r,o.b,o.g,o.a)};return o.normalize()};$.color.extract=function(elem,css){var c;do{c=elem.css(css).toLowerCase();if(c!=""&&c!="transparent")break;elem=elem.parent()}while(elem.length&&!$.nodeName(elem.get(0),"body"));if(c=="rgba(0, 0, 0, 0)")c="transparent";return $.color.parse(c)};$.color.parse=function(str){var res,m=$.color.make;if(res=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10));if(res=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10),parseFloat(res[4]));if(res=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55);if(res=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55,parseFloat(res[4]));if(res=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))return m(parseInt(res[1],16),parseInt(res[2],16),parseInt(res[3],16));if(res=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))return m(parseInt(res[1]+res[1],16),parseInt(res[2]+res[2],16),parseInt(res[3]+res[3],16));var name=$.trim(str).toLowerCase();if(name=="transparent")return m(255,255,255,0);else{res=lookupColors[name]||[0,0,0];return m(res[0],res[1],res[2])}};var lookupColors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
(function ($) { $.color = {}; $.color.make = function (r, g, b, a) { var o = {}; o.r = r || 0; o.g = g || 0; o.b = b || 0; o.a = a != null ? a : 1; o.add = function (c, d) { for (var i = 0; i < c.length; ++i)o[c.charAt(i)] += d; return o.normalize() }; o.scale = function (c, f) { for (var i = 0; i < c.length; ++i)o[c.charAt(i)] *= f; return o.normalize() }; o.toString = function () { if (o.a >= 1) { return "rgb(" + [o.r, o.g, o.b].join(",") + ")" } else { return "rgba(" + [o.r, o.g, o.b, o.a].join(",") + ")" } }; o.normalize = function () { function clamp(min, value, max) { return value < min ? min : value > max ? max : value } o.r = clamp(0, parseInt(o.r), 255); o.g = clamp(0, parseInt(o.g), 255); o.b = clamp(0, parseInt(o.b), 255); o.a = clamp(0, o.a, 1); return o }; o.clone = function () { return $.color.make(o.r, o.b, o.g, o.a) }; return o.normalize() }; $.color.extract = function (elem, css) { var c; do { c = elem.css(css).toLowerCase(); if (c != "" && c != "transparent") break; elem = elem.parent() } while (elem.length && !$.nodeName(elem.get(0), "body")); if (c == "rgba(0, 0, 0, 0)") c = "transparent"; return $.color.parse(c) }; $.color.parse = function (str) { var res, m = $.color.make; if (res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str)) return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10)); if (res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)) return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4])); if (res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str)) return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55); if (res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)) return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55, parseFloat(res[4])); if (res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str)) return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16)); if (res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str)) return m(parseInt(res[1] + res[1], 16), parseInt(res[2] + res[2], 16), parseInt(res[3] + res[3], 16)); var name = $.trim(str).toLowerCase(); if (name == "transparent") return m(255, 255, 255, 0); else { res = lookupColors[name] || [0, 0, 0]; return m(res[0], res[1], res[2]) } }; var lookupColors = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], brown: [165, 42, 42], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgrey: [169, 169, 169], darkgreen: [0, 100, 0], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkviolet: [148, 0, 211], fuchsia: [255, 0, 255], gold: [255, 215, 0], green: [0, 128, 0], indigo: [75, 0, 130], khaki: [240, 230, 140], lightblue: [173, 216, 230], lightcyan: [224, 255, 255], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightyellow: [255, 255, 224], lime: [0, 255, 0], magenta: [255, 0, 255], maroon: [128, 0, 0], navy: [0, 0, 128], olive: [128, 128, 0], orange: [255, 165, 0], pink: [255, 192, 203], purple: [128, 0, 128], violet: [128, 0, 128], red: [255, 0, 0], silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0] } })(jQuery);
// the actual Flot code
(function($) {
(function ($) {
// Cache the prototype hasOwnProperty for faster access
@ -45,10 +45,10 @@ Licensed under the MIT license.
// Do not merge this into Flot 0.9, since it requires jQuery 1.4.4+.
if (!$.fn.detach) {
$.fn.detach = function() {
return this.each(function() {
$.fn.detach = function () {
return this.each(function () {
if (this.parentNode) {
this.parentNode.removeChild( this );
this.parentNode.removeChild(this);
}
});
};
@ -129,7 +129,7 @@ Licensed under the MIT license.
// @param {number} width New width of the canvas, in pixels.
// @param {number} width New height of the canvas, in pixels.
Canvas.prototype.resize = function(width, height) {
Canvas.prototype.resize = function (width, height) {
if (width <= 0 || height <= 0) {
throw new Error("Invalid dimensions for plot, width = " + width + ", height = " + height);
@ -174,13 +174,13 @@ Licensed under the MIT license.
// Clears the entire canvas area, not including any overlaid HTML text
Canvas.prototype.clear = function() {
Canvas.prototype.clear = function () {
this.context.clearRect(0, 0, this.width, this.height);
};
// Finishes rendering the canvas, including managing the text overlay.
Canvas.prototype.render = function() {
Canvas.prototype.render = function () {
var cache = this._textCache;
@ -236,7 +236,7 @@ Licensed under the MIT license.
// uniquely identify the text layer.
// @return {object} The jQuery-wrapped text-layer div.
Canvas.prototype.getTextLayer = function(classes) {
Canvas.prototype.getTextLayer = function (classes) {
var layer = this.text[classes];
@ -247,7 +247,7 @@ Licensed under the MIT license.
// Create the text layer container, if it doesn't exist
if (this.textContainer == null) {
this.textContainer = $("<div class='flot-text'></div>")
this.textContainer = $("<div class='flot-text white_important'></div>")
.css({
position: "absolute",
top: 0,
@ -315,7 +315,7 @@ Licensed under the MIT license.
// @param {number=} width Maximum width of the text before it wraps.
// @return {object} a text info object.
Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) {
Canvas.prototype.getTextInfo = function (layer, text, font, angle, width) {
var textStyle, layerCache, styleCache, info;
@ -401,7 +401,7 @@ Licensed under the MIT license.
// @param {string=} valign Vertical alignment of the text; either "top",
// "middle" or "bottom".
Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) {
Canvas.prototype.addText = function (layer, x, y, text, font, angle, width, halign, valign) {
var info = this.getTextInfo(layer, text, font, angle, width),
positions = info.positions;
@ -474,7 +474,7 @@ Licensed under the MIT license.
// @param {number=} angle Angle at which the text is rotated, in degrees.
// Angle is currently unused, it will be implemented in the future.
Canvas.prototype.removeText = function(layer, x, y, text, font, angle) {
Canvas.prototype.removeText = function (layer, x, y, text, font, angle) {
if (text == null) {
var layerCache = this._textCache[layer];
if (layerCache != null) {
@ -610,7 +610,7 @@ Licensed under the MIT license.
mouseActiveRadius: 10 // how far the mouse can be away to activate an item
},
interaction: {
redrawOverlayInterval: 1000/60 // time between updates, -1 means in same flow
redrawOverlayInterval: 1000 / 60 // time between updates, -1 means in same flow
},
hooks: {}
},
@ -619,7 +619,7 @@ Licensed under the MIT license.
eventHolder = null, // jQuery object that events should be bound to
ctx = null, octx = null,
xaxes = [], yaxes = [],
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
plotOffset = { left: 0, right: 0, top: 0, bottom: 0 },
plotWidth = 0, plotHeight = 0,
hooks = {
processOptions: [],
@ -639,9 +639,9 @@ Licensed under the MIT license.
plot.setData = setData;
plot.setupGrid = setupGrid;
plot.draw = draw;
plot.getPlaceholder = function() { return placeholder; };
plot.getCanvas = function() { return surface.element; };
plot.getPlotOffset = function() { return plotOffset; };
plot.getPlaceholder = function () { return placeholder; };
plot.getCanvas = function () { return surface.element; };
plot.getPlotOffset = function () { return plotOffset; };
plot.width = function () { return plotWidth; };
plot.height = function () { return plotHeight; };
plot.offset = function () {
@ -667,7 +667,7 @@ Licensed under the MIT license.
plot.highlight = highlight;
plot.unhighlight = unhighlight;
plot.triggerRedrawOverlay = triggerRedrawOverlay;
plot.pointOffset = function(point) {
plot.pointOffset = function (point) {
return {
left: parseInt(xaxes[axisNumber(point, "x") - 1].p2c(+point.x) + plotOffset.left, 10),
top: parseInt(yaxes[axisNumber(point, "y") - 1].p2c(+point.y) + plotOffset.top, 10)
@ -1106,7 +1106,7 @@ Licensed under the MIT license.
s = series[i];
s.datapoints = { points: [] };
executeHooks(hooks.processRawData, [ s, s.data, s.datapoints ]);
executeHooks(hooks.processRawData, [s, s.data, s.datapoints]);
}
// first pass: clean and copy data
@ -1222,7 +1222,7 @@ Licensed under the MIT license.
for (i = 0; i < series.length; ++i) {
s = series[i];
executeHooks(hooks.processDatapoints, [ s, s.datapoints]);
executeHooks(hooks.processDatapoints, [s, s.datapoints]);
}
// second pass: find datamax/datamin for auto-scaling
@ -1303,7 +1303,7 @@ Licensed under the MIT license.
// from a previous plot in this container that we'll try to re-use.
placeholder.css("padding", 0) // padding messes up the positioning
.children().filter(function(){
.children().filter(function () {
return !$(this).hasClass("flot-overlay") && !$(this).hasClass('flot-base');
}).remove();
@ -1445,7 +1445,7 @@ Licensed under the MIT license.
// Determine the axis's position in its direction and on its side
$.each(isXAxis ? xaxes : yaxes, function(i, a) {
$.each(isXAxis ? xaxes : yaxes, function (i, a) {
if (a && (a.show || a.reserveSpace)) {
if (a === axis) {
found = true;
@ -1535,7 +1535,7 @@ Licensed under the MIT license.
if (minMargin == null) {
minMargin = 0;
for (i = 0; i < series.length; ++i)
minMargin = Math.max(minMargin, 2 * (series[i].points.radius + series[i].points.lineWidth/2));
minMargin = Math.max(minMargin, 2 * (series[i].points.radius + series[i].points.lineWidth / 2));
}
var margins = {
@ -1581,7 +1581,7 @@ Licensed under the MIT license.
// If the grid is visible, add its border width to the offset
for (var a in plotOffset) {
if(typeof(options.grid.borderWidth) == "object") {
if (typeof (options.grid.borderWidth) == "object") {
plotOffset[a] += showGrid ? options.grid.borderWidth[a] : 0;
}
else {
@ -2125,20 +2125,20 @@ Licensed under the MIT license.
// If either borderWidth or borderColor is an object, then draw the border
// line by line instead of as one rectangle
bc = options.grid.borderColor;
if(typeof bw == "object" || typeof bc == "object") {
if (typeof bw == "object" || typeof bc == "object") {
if (typeof bw !== "object") {
bw = {top: bw, right: bw, bottom: bw, left: bw};
bw = { top: bw, right: bw, bottom: bw, left: bw };
}
if (typeof bc !== "object") {
bc = {top: bc, right: bc, bottom: bc, left: bc};
bc = { top: bc, right: bc, bottom: bc, left: bc };
}
if (bw.top > 0) {
ctx.strokeStyle = bc.top;
ctx.lineWidth = bw.top;
ctx.beginPath();
ctx.moveTo(0 - bw.left, 0 - bw.top/2);
ctx.lineTo(plotWidth, 0 - bw.top/2);
ctx.moveTo(0 - bw.left, 0 - bw.top / 2);
ctx.lineTo(plotWidth, 0 - bw.top / 2);
ctx.stroke();
}
@ -2164,15 +2164,15 @@ Licensed under the MIT license.
ctx.strokeStyle = bc.left;
ctx.lineWidth = bw.left;
ctx.beginPath();
ctx.moveTo(0 - bw.left/2, plotHeight + bw.bottom);
ctx.lineTo(0- bw.left/2, 0);
ctx.moveTo(0 - bw.left / 2, plotHeight + bw.bottom);
ctx.lineTo(0 - bw.left / 2, 0);
ctx.stroke();
}
}
else {
ctx.lineWidth = bw;
ctx.strokeStyle = options.grid.borderColor;
ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw);
ctx.strokeRect(-bw / 2, -bw / 2, plotWidth + bw, plotHeight + bw);
}
}
@ -2472,10 +2472,10 @@ Licensed under the MIT license.
ctx.lineWidth = sw;
ctx.strokeStyle = "rgba(0,0,0,0.1)";
// position shadow at angle from the mid of line
var angle = Math.PI/18;
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/2), Math.cos(angle) * (lw/2 + sw/2), series.xaxis, series.yaxis);
ctx.lineWidth = sw/2;
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4), series.xaxis, series.yaxis);
var angle = Math.PI / 18;
plotLine(series.datapoints, Math.sin(angle) * (lw / 2 + sw / 2), Math.cos(angle) * (lw / 2 + sw / 2), series.xaxis, series.yaxis);
ctx.lineWidth = sw / 2;
plotLine(series.datapoints, Math.sin(angle) * (lw / 2 + sw / 4), Math.cos(angle) * (lw / 2 + sw / 4), series.xaxis, series.yaxis);
}
ctx.lineWidth = lw;
@ -2530,7 +2530,7 @@ Licensed under the MIT license.
// Doing the conditional here allows the shadow setting to still be
// optional even with a lineWidth of 0.
if( lw == 0 )
if (lw == 0)
lw = 0.0001;
if (lw > 0 && sw > 0) {
@ -2538,11 +2538,11 @@ Licensed under the MIT license.
var w = sw / 2;
ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)";
plotPoints(series.datapoints, radius, null, w + w/2, true,
plotPoints(series.datapoints, radius, null, w + w / 2, true,
series.xaxis, series.yaxis, symbol);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
plotPoints(series.datapoints, radius, null, w/2, true,
plotPoints(series.datapoints, radius, null, w / 2, true,
series.xaxis, series.yaxis, symbol);
}
@ -2748,7 +2748,7 @@ Licensed under the MIT license.
entries.reverse();
} else {
var ascending = options.legend.sorted != "descending";
entries.sort(function(a, b) {
entries.sort(function (a, b) {
return a.label == b.label ? 0 : (
(a.label < b.label) != ascending ? 1 : -1 // Logical XOR
);
@ -2798,7 +2798,7 @@ Licensed under the MIT license.
pos += 'right:' + (m[0] + plotOffset.right) + 'px;';
else if (p.charAt(1) == "w")
pos += 'left:' + (m[0] + plotOffset.left) + 'px;';
var legend = $('<div class="legend">' + table.replace('style="', 'style="position:absolute;' + pos +';') + '</div>').appendTo(placeholder);
var legend = $('<div class="bg_222_important">' + table.replace('style="', 'style="position:absolute;' + pos + ';') + '</div>').appendTo(placeholder);
if (options.legend.backgroundOpacity != 0.0) {
// put in the transparent background
// separately to avoid blended labels and
@ -2814,7 +2814,7 @@ Licensed under the MIT license.
c = c.toString();
}
var div = legend.children();
$('<div style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);
$('<div class="" style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos + 'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);
}
}
}
@ -2917,10 +2917,12 @@ Licensed under the MIT license.
j = item[1];
ps = series[i].datapoints.pointsize;
return { datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),
return {
datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),
dataIndex: j,
series: series[i],
seriesIndex: i };
seriesIndex: i
};
}
return null;
@ -2977,7 +2979,7 @@ Licensed under the MIT license.
highlight(item.series, item.datapoint, eventname);
}
placeholder.trigger(eventname, [ pos, item ]);
placeholder.trigger(eventname, [pos, item]);
}
function triggerRedrawOverlay() {
@ -3141,7 +3143,7 @@ Licensed under the MIT license.
// Add the plot function to the top level of the jQuery object
$.plot = function(placeholder, data, options) {
$.plot = function (placeholder, data, options) {
//var t0 = new Date();
var plot = new Plot($(placeholder), data, options, $.plot.plugins);
//(window.console ? console.log : alert)("time used (msecs): " + ((new Date()).getTime() - t0.getTime()));
@ -3154,8 +3156,8 @@ Licensed under the MIT license.
// Also add the plot function as a chainable property
$.fn.plot = function(data, options) {
return this.each(function() {
$.fn.plot = function (data, options) {
return this.each(function () {
$.plot(this, data, options);
});
};

File diff suppressed because one or more lines are too long

View File

@ -114,7 +114,8 @@ function pandoraFlotPie(
// Reset styles
function resetInteractivity() {
legends.css("color", "#fff");
legends.css("color", "#3F3F3D");
legends.attr("class", "invert_filter");
}
if (water_mark) {
@ -293,7 +294,6 @@ function pandoraFlotPieCustom(
function resetInteractivity() {
legends.each(function() {
// fix the widths so they don't jump around
console.log($(this));
$(this).css("color", "#3F3F3D");
});
}

View File

@ -683,12 +683,13 @@ function flot_vcolumn_chart(array $options)
$options['graphId'] = $graphId;
// If pandora_black theme its enabled then change grid colors.
/*
if ($config['style'] === 'pandora_black') {
$options['grid']['backgroundColor']['colors'][0] = 'transparent';
$options['grid']['backgroundColor']['colors'][1] = 'transparent';
$options['y']['color'] = 'transparent';
$options['x']['color'] = 'transparent';
}
}*/
$settings = base64_encode(json_encode($options));

View File

@ -2486,6 +2486,7 @@ function printClockAnalogic1(
var face = svg
.append("g")
.attr("id", "clock-face")
.attr("class", "invert_filter")
.attr(
"transform",
"translate(" +
@ -2646,6 +2647,8 @@ function printClockDigital1(
svg = d3.selectAll("#clock_" + id_element + " svg");
svgUnderlay.attr("id", "underlay_" + id_element);
svgUnderlay.attr("class", "invert_filter");
svgOverlay.attr("id", "overlay_" + id_element);
var digit = svg.selectAll(".digit"),

View File

@ -3385,8 +3385,8 @@ function init_graph(parameter_object) {
"stroke-opacity: 0.75; " +
"stroke-dasharray: none; " +
"stroke-dashoffset: 0"
);
)
.attr("class", "fill_222");
window.layer_graph
.append("text")
.append("tspan")
@ -3406,6 +3406,7 @@ function init_graph(parameter_object) {
"stroke: none; " +
"font-family: Verdana"
)
.attr("class", "fill_fff")
.attr(
"x",
networkmap_dimensions[0] + node_radius - holding_area_dimensions[0]
@ -4072,7 +4073,7 @@ function draw_elements_graph() {
node_temp
.append("text")
.attr("class", "node_text")
.attr("class", "node_text fill_fff")
.attr("id", "node_text_" + networkmap_id)
.attr(
"style",
@ -4094,7 +4095,7 @@ function draw_elements_graph() {
.text(function(d) {
return ellipsize(get_node_name_ov(d), 30);
})
.classed("dragable_node", true) //own dragable
.classed("dragable_node fill_fff", true) //own dragable
.on("click", selected_node)
.on("contextmenu", function(d) {
show_menu("node", d);

View File

@ -490,6 +490,8 @@ class Widget
*/
public function getFormInputs(): array
{
global $config;
$inputs = [];
$values = $this->values;
@ -501,6 +503,10 @@ class Widget
if (empty($values['background']) === true) {
$values['background'] = '#ffffff';
if ($config['style'] === 'pandora_black') {
$values['background'] = '#222222';
}
}
$inputs[] = [

View File

@ -732,7 +732,12 @@ class EventsListWidget extends Widget
$table->data[$i] = $data;
$table->cellstyle[$i][0] = 'background: #E8E8E8;';
$bg_color = 'background: #E8E8E8;';
if ($config['style'] === 'pandora_black') {
$bg_color = 'background: #222;';
}
$table->cellstyle[$i][0] = $bg_color;
$rowclass = \events_get_criticity_class($event['criticity']);
$table->cellclass[$i][1] = $rowclass;
$table->cellclass[$i][2] = $rowclass;

View File

@ -510,7 +510,7 @@ class SystemGroupStatusWidget extends Widget
$show_link = array_key_exists($group['g'], $user_groups);
if ((in_array($group['g'], $this->values['groupId'])) === true) {
$table->data[$i][] = '<span>'.$group['name'].'</span>';
$table->data[$i][] = '<span class="legendLabel">'.$group['name'].'</span>';
$url = $config['homeurl'].'index.php';
$url .= '?sec=estado&sec2=operation/agentes/status_monitor';

View File

@ -536,6 +536,9 @@ class TreeViewWidget extends Widget
// Css Files.
\ui_require_css_file('tree', 'include/styles/', true);
if ($config['style'] == 'pandora_black') {
\ui_require_css_file('pandora_black', 'include/styles/', true);
}
// Javascript Files.
\ui_include_time_picker();
@ -683,7 +686,7 @@ class TreeViewWidget extends Widget
];
// Show the modal window of an module.
$output .= '<div id="module_details_window" class="invisible">';
$output .= '<div id="module_details_window" class="">';
$output .= '</div>';
// Script.

View File

@ -1069,6 +1069,16 @@ class Item extends CachedModel
{
global $config;
$mobile_navigation = false;
if (isset($_SERVER['PHP_SELF']) === true
&& (strstr($_SERVER['PHP_SELF'], 'mobile/') !== false
|| strstr($_SERVER['HTTP_REFERER'], 'mobile/') !== false)
) {
$mobile_navigation = true;
}
error_log(obhd($_SERVER['PHP_SELF']));
// Load side libraries.
include_once $config['homedir'].'/include/functions_ui.php';
if (\is_metaconsole() === true) {
@ -1081,6 +1091,7 @@ class Item extends CachedModel
$linkedAgent = static::extractLinkedAgent($data);
$baseUrl = \ui_get_full_url('index.php');
$mobileUrl = \ui_get_full_url('mobile/index.php');
if ((bool) $data['agentDisabled'] === true
|| (bool) $data['moduleDisabled'] === true
@ -1135,6 +1146,15 @@ class Item extends CachedModel
* We are in a regular console.
*/
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'visualmap',
'id' => $vcId,
]
);
}
return $baseUrl.'?'.http_build_query(
[
'sec' => 'network',
@ -1211,6 +1231,15 @@ class Item extends CachedModel
];
}
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'module_graph',
'id' => $moduleId,
]
);
}
return $baseUrl.'?'.http_build_query($queryParams);
} else if (\is_metaconsole() === true
&& (bool) \can_user_access_node() === true
@ -1290,6 +1319,15 @@ class Item extends CachedModel
* We are in a regular console.
*/
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'agent',
'id' => $agentId,
]
);
}
return $baseUrl.'?'.http_build_query(
[
'sec' => 'estado',

View File

@ -76,7 +76,7 @@ h1 {
.grid-stack-item-content {
color: #2c3e50;
/*text-align: center;*/
text-align: center;
background-color: #ffffff;
border-radius: 5px;
-webkit-box-shadow: 5px 5px 5px 0px rgba(214, 214, 214, 1);
@ -390,6 +390,7 @@ table.group_modules_status_box tr td > span {
}
table.group_modules_status_box tr td div {
background-color: #82b92e;
width: 90%;
padding: 3px;
text-align: center;
@ -543,3 +544,14 @@ div#main_pure {
color: inherit;
font-family: inherit;
}
/* Mobile trick */
.ui-mobile-viewport.ui-overlay-c > #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 {
margin: 0;
}

View File

@ -665,6 +665,9 @@ form ul.form_flex {
border-radius: 4px;
}
text {
color: #fff !important;
}
.legendLabel {
color: #fff;
}
@ -720,8 +723,9 @@ form ul.form_flex {
color: #900;
}
.cluetip-default ul {
text-align: left;
.cluetip-default ul,
.text_left {
text-align: left !important;
}
.card {
border: 1px solid #e2e2e2;
@ -892,3 +896,53 @@ div.integria_details_description textarea {
color: #fff;
resize: vertical;
}
.grid-stack-item-content {
color: #fff !important;
}
.widget-groups-status h1 a {
font-size: 1.1em;
font-weight: bold;
line-height: 20px;
color: #fff;
font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt;
text-decoration: none;
text-transform: capitalize;
}
.widget_groups_status {
background-color: #222;
}
.flot-text {
color: #fff !important;
}
.table.group_modules_status_box tr td {
font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt;
font-size: 11pt;
text-decoration: none;
color: #fff !important;
font-weight: bolder;
text-align: justify;
border-bottom: 0px;
}
.bg_222_important {
background-color: #222 !important;
}
.networkconsole {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background-color: #111;
}
.fill_222 {
fill: #222 !important;
}
.fill_fff {
fill: #fff !important;
}

View File

@ -255,7 +255,7 @@
.select2-container--default
.select2-selection--multiple
.select2-selection__choice {
background-color: #e4e4e4;
background-color: #222;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
@ -263,7 +263,7 @@
margin-right: 5px;
margin-top: 5px;
padding: 0 5px;
color: #111;
color: #fff;
}
.select2-container--default
.select2-selection--multiple
@ -277,7 +277,7 @@
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove:hover {
color: #333;
color: #82b92e;
}
.select2-container--default[dir="rtl"]
.select2-selection--multiple
@ -301,7 +301,7 @@
}
.select2-container--default.select2-container--focus
.select2-selection--multiple {
border: solid black 1px;
border: solid #fff 1px;
outline: 0;
}
.select2-container--default.select2-container--disabled
@ -331,7 +331,7 @@
border: 1px solid #aaa;
}
.select2-container--default .select2-search--inline .select2-search__field {
background: transparent;
background: #222;
border: none;
outline: 0;
box-shadow: none;

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.753';
$build = '210414';
$build = '210415';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -34,6 +34,12 @@ body {
font-weight: bold;
}
td.flex-center {
display: flex !important;
align-items: center;
justify-content: space-between;
}
/*INIT----------Tactical styles-----------------------------------------*/
/* Common */
@ -351,6 +357,22 @@ tr.events {
font-size: 12px !important;
}
table.event_details {
height: 14px;
color: #424242;
}
table.event_details tr th {
text-align: left;
}
table.event_details td:not(:first-child) {
display: flex;
flex-direction: row;
align-items: center;
justify-items: start;
}
table#list_events th {
font-size: 12px !important;
font-weight: bolder !important;
@ -1274,6 +1296,11 @@ table.tactical_bars {
-webkit-border-radius: 15px !important;
}
.ui-header.ui-bar-a .ui-btn-icon-notext .ui-btn-inner .ui-icon {
margin-top: -3px;
margin-left: 3.5px;
}
#login_btn-container .ui-icon {
background-color: #333 !important;
border-radius: 15px !important;
@ -1354,6 +1381,17 @@ span.nobold * {
display: block !important;
}
.status_rounded_rectangles.forced_title {
width: 1em;
height: 1em;
border-radius: 50%;
}
.ui-content .ui-listview,
.ui-panel-inner > .ui-listview {
margin: 0 !important;
}
#list_Modules *,
#list_agent_Modules *,
#list_agents *,
@ -1398,7 +1436,7 @@ div.nodata_container {
}
.ui-icon-delete {
margin-top: -3px !important;
margin-top: -3px;
}
.empty_advice {

View File

@ -151,7 +151,7 @@ class System
}
public function getDefaultACLFailText()
public static function getDefaultACLFailText()
{
return __('Access to this page is restricted to authorized users only, please contact your system administrator if you should need help.').'<br><br>'.__('Please remember that any attempts to access this page will be recorded on the %s System Database.', get_product_name());
}

View File

@ -1,4 +1,5 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
@ -48,6 +49,20 @@ class Ui
private $dialog = '';
/**
* List of extra CSS files to be loaded.
*
* @var array
*/
private $cssList = [];
/**
* List of extra Javascript files to be loaded.
*
* @var array
*/
private $jsList = [];
public function __construct()
{
@ -777,6 +792,30 @@ class Ui
echo " <script src='../include/javascript/pandora.js'></script>\n";
echo " <script src='../include/javascript/pandora_ui.js'></script>\n";
$loaded = [];
foreach ($this->cssList as $filename) {
if (in_array($filename, $loaded) === true) {
continue;
}
array_push($loaded, $filename);
$url_css = ui_get_full_url($filename, false, false, false);
echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />'."\n\t";
}
$js_loaded = [];
foreach ($this->jsList as $filename) {
if (in_array($filename, $js_loaded) === true) {
continue;
}
array_push($js_loaded, $filename);
$url_css = ui_get_full_url($filename, false, false, false);
echo '<script src="'.$url_css.'" rel="text/javascript"></script>'."\n\t";
}
echo " </head>\n";
echo " <body>\n";
echo include_javascript_dependencies_flot_graph(false, false);
@ -857,6 +896,88 @@ class Ui
}
/**
* Add CSS file to be loaded.
*
* @param string $name Css file name, as in ui_require_css.
* @param string $path Path where search for css file.
*
* @return boolean True if success, False if not.
*/
public function require_css(
string $name,
string $path='include/styles/'
):bool {
$filename = $path.$name.'.css';
$system = System::getInstance();
if (file_exists($filename) === false
&& file_exists($system->getConfig('homedir').'/'.$filename) === false
&& file_exists($system->getConfig('homedir').'/'.ENTERPRISE_DIR.'/'.$filename) === false
) {
return false;
}
if (in_array($filename, $this->cssList) === false) {
$this->cssList[] = $filename;
}
return true;
}
/**
* Add JS file to be loaded.
*
* @param string $name JAvascript file name, as in
* \ui_require_javascript_file.
* @param string $path Path where search for Javascript file.
*
* @return boolean True if success, False if not.
*/
public function require_javascript(
string $name,
string $path='include/javascript/'
):bool {
$filename = $path.$name.'.js';
$system = System::getInstance();
if (file_exists($filename) === false
&& file_exists($system->getConfig('homedir').'/'.$filename) === false
&& file_exists($system->getConfig('homedir').'/'.ENTERPRISE_DIR.'/'.$filename) === false
) {
return false;
}
if (in_array($filename, $this->jsList) === false) {
$this->jsList[] = $filename;
}
return true;
}
/**
* Forces reload to retrieve with and height.
*
* @return void
*/
public function retrieveViewPort()
{
?>
<script type="text/javascript">
var dimensions = '&width=' + $(window).width();
dimensions += '&height=' + $(window).height();
window.location.href = window.location.href + dimensions;
</script>
<?php
}
}
class Table

View File

@ -38,8 +38,15 @@ class User
$system = System::getInstance();
$user = $system->getSession('user', null);
if (is_object($user) === false) {
$user = json_decode($user, true);
}
if (!empty($user)) {
self::$instance = $user;
self::$instance = new self();
foreach ($user as $k => $v) {
self::$instance->{$k} = $v;
}
} else {
self::$instance = new self();
}
@ -49,6 +56,12 @@ class User
}
public function jsonSerialize()
{
return get_object_vars($this);
}
public function saveLogin()
{
if ($this->logged) {
@ -59,7 +72,7 @@ class User
$config['id_user'] = $this->user;
$system->setSessionBase('id_usuario', $this->user);
$system->setSession('user', $this);
$system->setSession('user', json_encode($this->jsonSerialize()));
config_user_set_custom_config();
}
@ -86,6 +99,46 @@ class User
{
$system = System::getInstance();
if ($system->getConfig('auth', 'mysql') === 'saml') {
if ((bool) $system->getRequest('saml', false) === true) {
\enterprise_include_once('include/auth/saml.php');
$saml_user_id = enterprise_hook('saml_process_user_login');
if (!$saml_user_id) {
$this->logged = false;
$this->errorLogin = $system->getConfig('auth_error');
\enterprise_hook('saml_logout', [true]);
} else {
$this->logged = true;
$this->user = $saml_user_id;
$this->loginTime = time();
$this->errorLogin = false;
}
$this->saveLogin();
return $this->logged;
}
// Maybe back from SAML login.
$saml_session = $system->getSession('samlid', null);
if ($saml_session !== null) {
$this->user = $system->getSession('id_usuario', null);
if ($this->user !== null) {
$this->loginTime = time();
$this->errorLogin = false;
$this->logged = true;
} else {
// SAML Session OK but not in DB.
$this->logged = false;
$this->errorLogin = __(
'User cannot log in into this console, please contact administrator'
);
}
$this->saveLogin();
return $this->logged;
}
}
if (($user == null) && ($password == null)) {
$user = $system->getRequest('user', null);
$password = $system->getRequest('password', null);
@ -205,6 +258,12 @@ class User
public function logout()
{
$system = System::getInstance();
if ($system->getConfig('auth', 'mysql') === 'saml') {
\enterprise_include_once('include/auth/saml.php');
\enterprise_hook('saml_logout');
}
$this->user = null;
$this->logged = false;
$this->loginTime = false;
@ -213,7 +272,6 @@ class User
$this->needDoubleAuth = false;
$this->errorDoubleAuth = false;
$system = System::getInstance();
$system->setSession('user', null);
$system->sessionDestroy();
}
@ -230,7 +288,12 @@ class User
if ($this->errorLogin) {
$options['type'] = 'onStart';
$options['title_text'] = __('Login Failed');
if ($this->errorLogin !== false) {
$options['content_text'] = $this->errorLogin;
} else {
$options['content_text'] = __('User not found in database or incorrect password.');
}
$ui->addDialog($options);
}
@ -286,7 +349,29 @@ class User
'name' => 'login_btn',
];
$ui->formAddSubmitButton($options);
$ui->endForm();
if ($system->getConfig('auth', 'mysql') === 'saml') {
// Add SAML login button.
$ui->beginForm('');
$ui->formAddHtml(
html_print_input_hidden('action', 'login', true)
);
$ui->formAddHtml(
html_print_input_hidden('saml', '1', true)
);
$ui->formAddSubmitButton(
[
'value' => __('Login with SAML'),
'icon' => 'arrow-r',
'icon_pos' => 'right',
'name' => 'login_button_saml',
]
);
$ui->endForm('');
}
$ui->contentAddHtml('</div>');
$ui->endContent();
$ui->showPage();

View File

@ -183,7 +183,6 @@ switch ($action) {
}
return;
break;
case 'login':
if ($user->login() && $user->isLogged()) {
if (file_exists('../enterprise/load_enterprise.php')) {
@ -279,9 +278,6 @@ switch ($action) {
$page = 'events';
break;
case 'Group view':
break;
case 'Alert detail':
$page = 'alerts';
break;
@ -295,6 +291,11 @@ switch ($action) {
$id_map = (int) db_get_value('id', 'tlayout', 'name', $section_data);
$_GET['id'] = $id_map;
break;
case 'Group view':
default:
// No content.
break;
}
}
@ -349,6 +350,17 @@ switch ($action) {
$agent = new Agent();
$agent->show();
break;
case 'visualmaps':
// Show a list of VC.
$vc_list = new Visualmaps();
$vc_list->show();
break;
case 'visualmap':
$vc = new Visualmap();
$vc->show();
break;
}
break;
}

View File

@ -425,7 +425,12 @@ class Agent
success: function(r) {
$.mobile.hidePageLoadingMsg();
var className = $('#list_agent_Modules').attr('class');
if (document.getElementById('list_agent_Modules') == null) {
$($('p.empty_advice')[0]).parent().html(r);
className = 'ui-responsive table-stroke ui-table ui-table-reflow';
} else {
$('#list_agent_Modules').parent().html(r);
}
$('#list_agent_Modules').addClass(className);
},
error: function(r, t, e) {
@ -468,7 +473,7 @@ class Agent
'id_agent' => $this->id,
'all_modules' => true,
'status' => -1,
'name' => $name_filter,
'name' => '%'.$name_filter.'%',
];
}

View File

@ -60,7 +60,16 @@ class Home
'icon' => 'groups',
];
if (!$system->getConfig('metaconsole')) {
if ((bool) $system->getConfig('legacy_vc', false) === false) {
// Show Visual consoles only if new system is enabled.
$items['visualmaps'] = [
'name' => __('Visual consoles'),
'filename' => 'visualmaps.php',
'menu_item' => true,
'icon' => 'visual_console',
];
}
$items['alerts'] = [
'name' => __('Alerts'),
'filename' => 'alerts.php',
@ -74,6 +83,7 @@ class Home
'menu_item' => true,
'icon' => 'agents',
];
$items['modules'] = [
'name' => __('Modules'),
'filename' => 'modules.php',
@ -94,7 +104,6 @@ class Home
'menu_item' => false,
'icon' => '',
];
}
$this->pagesItems = $items;
}
@ -154,7 +163,7 @@ class Home
$options = [
'name' => 'free_search',
'value' => $this->global_search,
'placeholder' => __('Global search'),
'placeholder' => __('Agent search'),
];
$ui->formAddInputSearch($options);
$ui->endForm();

View File

@ -1,59 +1,160 @@
<?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.
require_once '../include/functions_visual_map.php';
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Visual console mobile viewer class.
*
* @category Mix
* @package Pandora FMS
* @subpackage OpenSource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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_visual_map.php';
use Models\VisualConsole\Container as VisualConsole;
/**
* Visual console view handler class.
*/
class Visualmap
{
private $correct_acl = false;
/**
* Undocumented variable
*
* @var boolean
*/
private $validAcl = false;
/**
* Undocumented variable
*
* @var boolean
*/
private $acl = 'VR';
/**
* Undocumented variable
*
* @var boolean
*/
private $id = 0;
/**
* Undocumented variable
*
* @var boolean
*/
private $visualmap = null;
/**
* View widh.
*
* @var integer
*/
private $width;
function __construct()
/**
* View height.
*
* @var integer
*/
private $height;
/**
* Rotate view.
*
* @var boolean
*/
private $rotate = false;
/**
* Constructor.
*/
public function __construct()
{
}
private function checkVisualmapACL($groupID=0)
/**
* Verifies ACL access.
*
* @param integer $groupID Target group id.
*
* @return void
*/
private function checkVisualmapACL(int $groupID=0)
{
$system = System::getInstance();
if ($system->checkACL($this->acl)) {
$this->correct_acl = true;
$this->validAcl = true;
} else {
$this->correct_acl = false;
$this->validAcl = false;
}
}
/**
* Retrieve filters.
*
* @return void
*/
private function getFilters()
{
$system = System::getInstance();
$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;
}
}
/**
* Renders the view.
*
* @return void
*/
public function show()
{
$this->getFilters();
if (empty($this->width) === true
&& empty($this->height) === true
) {
// Reload forcing user to send width and height.
$ui = Ui::getInstance();
$ui->retrieveViewPort();
}
$this->height -= 39;
$this->visualmap = db_get_row(
'tlayout',
'id',
@ -65,7 +166,7 @@ class Visualmap
}
$this->checkVisualmapACL($this->visualmap['id_group']);
if (!$this->correct_acl) {
if (!$this->validAcl) {
$this->show_fail_acl();
}
@ -73,12 +174,25 @@ class Visualmap
}
private function show_fail_acl()
/**
* Shows an error if ACL fails.
*
* @param string $msg Optional message.
*
* @return void
*/
private function show_fail_acl(string $msg='')
{
$error['type'] = 'onStart';
if (empty($msg) === false) {
$error['title_text'] = __('Error');
$error['content_text'] = $msg;
} else {
$error['title_text'] = __('You don\'t have access to this page');
$error['content_text'] = System::getDefaultACLFailText();
if (class_exists('HomeEnterprise')) {
}
if (class_exists('HomeEnterprise') === true) {
$home = new HomeEnterprise();
} else {
$home = new Home();
@ -88,11 +202,18 @@ class Visualmap
}
public function ajax($parameter2=false)
/**
* Ajax call manager.
*
* @param string $parameter2 Not sure why is doing this stuff.
*
* @return void
*/
public function ajax(string $parameter2='')
{
$system = System::getInstance();
$this->checkVisualmapACL($this->visualmap['id_group']);
if (!$this->correct_acl) {
if ((bool) $this->validAcl === false) {
$this->show_fail_acl();
} else {
switch ($parameter2) {
@ -100,18 +221,55 @@ class Visualmap
$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);
visual_map_print_visual_map(
$map_id,
false,
true,
$width,
$height
);
exit;
default:
exit;
}
}
}
/**
* Generates HTML code to view target Visual console.
*
* @return void
*/
private function show_visualmap()
{
$ui = Ui::getInstance();
$system = System::getInstance();
include_once $system->getConfig('homedir').'/vendor/autoload.php';
// Query parameters.
$visualConsoleId = (int) $system->getRequest('id');
// Refresh interval in seconds.
$refr = (int) get_parameter('refr', $system->getConfig('vc_refr'));
// Check groups can access user.
$aclUserGroups = [];
if (!users_can_manage_group_all('AR')) {
$aclUserGroups = array_keys(users_get_groups(false, 'AR'));
}
// Load Visual Console.
$visualConsole = null;
try {
$visualConsole = VisualConsole::fromDB(['id' => $visualConsoleId]);
} catch (Throwable $e) {
$this->show_fail_acl($e->getMessage());
exit;
}
$ui->createPage();
$ui->createDefaultHeader(
sprintf(
@ -127,61 +285,167 @@ class Visualmap
]
)
);
$ui->require_css('visual_maps');
$ui->require_css('register');
$ui->require_css('dashboards');
$ui->require_javascript('pandora_visual_console');
$ui->require_javascript('pandora_dashboards');
$ui->require_javascript('jquery.cookie');
$ui->require_css('modal');
$ui->require_css('form');
$ui->showFooter(false);
$ui->beginContent();
ob_start();
$rendered_map = '<div id="rendered_visual_map">';
$rendered_map .= html_print_image('images/spinner.gif', true);
$rendered_map .= '</div>';
ob_clean();
$ui->contentAddHtml($rendered_map);
$ui->contentAddHtml(
"<script type=\"text/javascript\">
function ajax_load_map() {
$('#rendered_visual_map').html('<div class=\"center\"> ".__('Loading...')."<br /><img src=\"images/ajax-loader.gif\" /></div>');
var map_max_width = window.innerWidth * 0.90;
var map_max_height = (window.innerHeight - 47) * 0.90;
var original_width = ".$this->visualmap['width'].';
var original_height = '.$this->visualmap['height'].';
var map_width = map_max_width;
var map_height = original_height / (original_width / map_width);
if(map_height > map_max_height) {
map_height = map_max_height;
map_width = original_width / (original_height / map_height);
}
postvars = {};
postvars["action"] = "ajax";
postvars["parameter1"] = "visualmap";
postvars["parameter2"] = "render_map";
postvars["map_id"] = "'.$this->id."\";
postvars[\"width\"] = map_width;
postvars[\"height\"] = map_height;
$.post(\"index.php\",
postvars,
function (data) {
$('#rendered_visual_map').html(data);
},
\"html\");
}
ajax_load_map();
// Detect orientation change to refresh dinamic content
$(window).on({
orientationchange: function(e) {
ajax_load_map();
}
});
</script>"
include_javascript_d3(true)
);
$size = [
'width' => $this->width,
'height' => $this->height,
];
$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();
$output = '<div class="container-center" style="position:relative;">';
// Style.
$style = 'width:'.$visualConsoleData['width'].'px;';
$style .= 'height:'.$visualConsoleData['height'].'px;';
$style .= 'background-size: cover;';
// Class.
$class = 'visual-console-container-dashboard c-'.$uniq;
// Id.
$id = 'visual-console-container-'.$uniq;
$output .= '<div style="'.$style.'" class="'.$class.'" id="'.$id.'">';
$output .= '</div>';
$output .= '</div>';
// Check groups can access user.
$aclUserGroups = [];
if (users_can_manage_group_all('AR') === true) {
$aclUserGroups = array_keys(
users_get_groups(false, 'AR')
);
}
$ignored_params['refr'] = '';
\ui_require_javascript_file(
'tiny_mce',
'include/javascript/tiny_mce/'
);
\ui_require_javascript_file(
'pandora_visual_console',
'include/javascript/',
true
);
\include_javascript_d3();
\visual_map_load_client_resources();
// Load Visual Console Items.
$visualConsoleItems = VisualConsole::getItemsFromDB(
$visualConsoleId,
$aclUserGroups,
$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>';
$visualConsoleItems = array_reduce(
$visualConsoleItems,
function ($carry, $item) use ($ratio_t) {
$carry[] = $item->toArray();
return $carry;
},
[]
);
$settings = \json_encode(
[
'props' => $visualConsoleData,
'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false),
'ratio' => $ratio_t,
'size' => $size,
'cellId' => $uniq,
]
);
$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
);
$javascript = ob_get_clean();
$ui->contentAddHtml($javascript);
$ui->endContent();
$ui->showPage();
}

View File

@ -1,56 +1,107 @@
<?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.ValidFunctionName.ScopeNotCamelCaps
/**
* List of visual consoles, for mobile view.
*
* @category Common Class
* @package Pandora FMS
* @subpackage OpenSource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
ob_start();
require_once '../include/functions_visual_map.php';
ob_get_clean();
// Fixed unused javascript code.
/**
* Class to generate a list of current visual consoles defined.
*/
class Visualmaps
{
private $correct_acl = false;
/**
* ACL allowed.
*
* @var boolean
*/
private $allowed = false;
/**
* Perms needed to access this feature.
*
* @var string
*/
private $acl = 'VR';
private $default = true;
private $default_filters = [];
/**
* Default filters.
*
* @var array
*/
private $defaultFilters = [];
/**
* Group.
*
* @var integer
*/
private $group = 0;
/**
* Type. Something about filtering.
*
* @var boolean
*/
private $type = 0;
private $list_types = null;
function __construct()
/**
* Builder.
*/
public function __construct()
{
$system = System::getInstance();
if ($system->checkACL($this->acl)) {
$this->correct_acl = true;
$this->allowed = true;
} else {
$this->correct_acl = false;
$this->allowed = false;
}
}
/**
* Prepare filters for current view.
*
* @return void
*/
private function getFilters()
{
$system = System::getInstance();
$user = User::getInstance();
$this->default_filters['group'] = true;
$this->default_filters['type'] = true;
$this->defaultFilters['group'] = true;
$this->defaultFilters['type'] = true;
$this->group = (int) $system->getRequest('group', __('Group'));
if (!$user->isInGroup($this->acl, $this->group)) {
@ -61,7 +112,7 @@ class Visualmaps
$this->group = 0;
} else {
$this->default = false;
$this->default_filters['group'] = false;
$this->defaultFilters['group'] = false;
}
$this->type = $system->getRequest('type', __('Type'));
@ -69,14 +120,19 @@ class Visualmaps
$this->type = '0';
} else {
$this->default = false;
$this->default_filters['type'] = false;
$this->defaultFilters['type'] = false;
}
}
/**
* Run view.
*
* @return void
*/
public function show()
{
if (!$this->correct_acl) {
if (!$this->allowed) {
$this->show_fail_acl();
} else {
$this->getFilters();
@ -85,12 +141,19 @@ class Visualmaps
}
/**
* Show a message about failed ACL access.
*
* @return void
*/
private function show_fail_acl()
{
$error['type'] = 'onStart';
$error['title_text'] = __('You don\'t have access to this page');
$error['content_text'] = System::getDefaultACLFailText();
if (class_exists('HomeEnterprise')) {
// Redirect to main page.
if (class_exists('HomeEnterprise') === true) {
$home = new HomeEnterprise();
} else {
$home = new Home();
@ -100,6 +163,11 @@ class Visualmaps
}
/**
* Show visual console list header.
*
* @return void
*/
private function show_visualmaps()
{
$ui = Ui::getInstance();
@ -124,58 +192,45 @@ class Visualmaps
}
/**
* Show list of visual consoles.
*
* @return void
*/
private function listVisualmapsHtml()
{
$system = System::getInstance();
$ui = Ui::getInstance();
// Create filter
$where = [];
// Order by type field
$where['order'] = 'type';
$visualmaps = visual_map_get_user_layouts();
if ($this->group != '0') {
$where['id_group'] = $this->group;
}
if ($this->type != '0') {
$where['type'] = $this->type;
}
// Only display maps of "All" group if user is administrator
// or has "RR" privileges, otherwise show only maps of user group
$id_user = $system->getConfig('id_user');
$own_info = get_user_info($id_user);
if ($own_info['is_admin'] || $system->checkACL($this->acl)) {
$maps = visual_map_get_user_layouts();
} else {
$maps = visual_map_get_user_layouts($id_user, false, false, false);
}
if (empty($maps)) {
$maps = [];
}
$list = [];
foreach ($maps as $map) {
$row = [];
$row[__('Name')] = '<a class="ui-link" data-ajax="false" href="index.php?page=visualmap&id='.$map['id'].'">'.io_safe_output($map['name']).'</a>';
// $row[__('Type')] = $map['type'];
$row[__('Group')] = ui_print_group_icon($map['id_group'], true, 'groups_small', '', false);
$list[] = $row;
}
if (count($maps) == 0) {
$ui->contentAddHtml('<p class="color_ff0">'.__('No maps defined').'</p>');
if (empty($visualmaps) === true) {
$ui->contentAddHtml('<p style="color: #ff0000;">'.__('No maps defined').'</p>');
} else {
$table = new Table();
// Without header jquery.mobile crashes.
$table->addHeader(['']);
$table->id = 'list_visualmaps';
$table->importFromHash($list);
$ui->contentAddHtml($table->getHTML());
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>';
$row = $link;
$row .= ui_print_group_icon(
$map['id_group'],
true,
'groups_small',
'',
false
);
$table->addRow([ $map['id'].' flex-center' => $row]);
}
$ui->contentAddHtml($table->getHTML());
$ui->contentAddLinkListener('list_visualmaps');
}
}
}

View File

@ -438,7 +438,7 @@ enterprise_hook('close_meta_frame');
.hide()
.prop("id", "module_details_window")
.appendTo('body');
console.log("vamos a ver");
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
var params = {};
var f = new Date();

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.753
%define release 210414
%define release 210415
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.753
%define release 210414
%define release 210415
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.753
%define release 210414
%define release 210415
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -73,6 +73,13 @@ if ($manageDashboards !== 0) {
$output .= '</div>';
$output .= '</div>';
if ($config['style'] === 'pandora') {
$options['background'] = '#fff';
}
if ($config['style'] === 'pandora_black') {
$options['background'] = '#222';
}
if ((int) $cellData['id_widget'] !== 0) {
$style = 'style="background-color:'.$options['background'].';"';

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.753-210414
Version: 7.0NG.753-210415
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.753-210414"
pandora_version="7.0NG.753-210415"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.753";
my $pandora_build = "210414";
my $pandora_build = "210415";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.753";
my $pandora_build = "210414";
my $pandora_build = "210415";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.753
%define release 210414
%define release 210415
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.753
%define release 210414
%define release 210415
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.753"
PI_BUILD="210414"
PI_BUILD="210415"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.753 PS210414";
my $version = "7.0NG.753 PS210415";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.753 PS210414";
my $version = "7.0NG.753 PS210415";
# save program name for logging
my $progname = basename($0);
@ -193,6 +193,7 @@ sub help_screen{
help_screen_line('--delete_profile', '<user_name> <profile_name> <group_name>', 'Delete perfil from user');
help_screen_line('--add_profile_to_user', '<user_id> <profile_name> [<group_name>]', 'Add a profile in group to a user');
help_screen_line('--create_profile', "<profile_name> <incident_view> <incident_edit> <incident_management> <agent_view>\n\t <agent_edit> <agent_disable> <alert_edit> <alert_management> <user_management> <db_management>\n\t <event_view> <event_edit> <event_management> <report_view> <report_edit> <report_management>\n\t <map_view> <map_edit> <map_management> <vconsole_view> <vconsole_edit> <vconsole_management>\n\t <pandora_management>", 'Create profile');
help_screen_line('--update_profile', "<profile_name> <incident_view> <incident_edit> <incident_management> <agent_view>\n\t <agent_edit> <agent_disable> <alert_edit> <alert_management> <user_management> <db_management>\n\t <event_view> <event_edit> <event_management> <report_view> <report_edit> <report_management>\n\t <map_view> <map_edit> <map_management> <vconsole_view> <vconsole_edit> <vconsole_management>\n\t <pandora_management>", 'Modify profile');
help_screen_line('--disable_eacl', '', 'Disable enterprise ACL system');
help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system');
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
@ -568,13 +569,29 @@ sub pandora_create_profile ($$$$$$$$$$$$$$$$$$$$$$$$$) {
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management) = @_;
return db_insert ($dbh, 'id_up', 'INSERT INTO tperfil (name,incident_edit,incident_view,incident_management,agent_view,agent_edit,alert_edit,user_management,db_management,alert_management,pandora_management,report_view,report_edit,report_management,event_view,event_edit,event_management,agent_disable,map_view,map_edit,map_management,vconsole_view,vconsole_edit,vconsole_management) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);',
$profile_name, $incident_view,$incident_edit, $incident_management, $agent_view,
return db_insert ($dbh, 'id_up', 'INSERT INTO tperfil (name,incident_view,incident_edit,incident_management,agent_view,agent_edit,agent_disable,alert_edit,alert_management,user_management,db_management,event_view,event_edit,event_management,report_view,report_edit,report_management,map_view,map_edit,map_management,vconsole_view,vconsole_edit,vconsole_management,pandora_management) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);',
safe_input($profile_name), $incident_view,$incident_edit, $incident_management, $agent_view,
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
}
##########################################################################
#### Update profile.
###########################################################################
sub pandora_update_profile ($$$$$$$$$$$$$$$$$$$$$$$$$) {
my ($dbh, $profile_name, $incident_view,$incident_edit, $incident_management, $agent_view,
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management) = @_;
return db_update ($dbh, 'UPDATE tperfil SET incident_view = ?, incident_edit = ?, incident_management = ?, agent_view = ?, agent_edit = ?, agent_disable = ?, alert_edit = ?, alert_management = ?, user_management = ?, db_management = ?, event_view = ?, event_edit = ?, event_management = ?, report_view = ?, report_edit = ?, report_management = ?, map_view = ?, map_edit = ?, map_management = ?, vconsole_view = ?, vconsole_edit = ?, vconsole_management = ?, pandora_management = ? WHERE name=?;',
$incident_view,$incident_edit, $incident_management, $agent_view,
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management, safe_input($profile_name));
}
##########################################################################
## Delete a profile from the given user/group.
##########################################################################
@ -4005,6 +4022,26 @@ sub cli_create_profile() {
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
}
##############################################################################
## Update profile.
## Related option: --update_profile
##############################################################################
#
sub cli_update_profile() {
my ($profile_name,$incident_view,$incident_edit,$incident_management,$agent_view,
$agent_edit,$agent_disable,$alert_edit,$alert_management,$user_management,$db_management,
$event_view,$event_edit,$event_management,$report_view,$report_edit,$report_management,
$map_view,$map_edit,$map_management,$vconsole_view,$vconsole_edit,$vconsole_management,$pandora_management) = @ARGV[2..25];
my $id_profile = get_profile_id($dbh,$profile_name);
exist_check($id_profile,'profile',$profile_name);
pandora_update_profile ($dbh, $profile_name, $incident_view, $incident_edit, $incident_management, $agent_view,
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
}
##############################################################################
# Delete profile.
# Related option: --delete_profile
@ -7432,6 +7469,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 24);
cli_create_profile();
}
elsif ($param eq '--update_profile') {
param_check($ltotal, 24);
cli_update_profile();
}
elsif ($param eq '--delete_profile') {
param_check($ltotal, 3);
cli_delete_profile();

0
pandora_server/util/recon_scripts/ipmi-recon.pl Normal file → Executable file
View File