Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-05-11 07:37:56 +02:00
commit c19e398057
54 changed files with 692 additions and 210 deletions

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.754-210510
Version: 7.0NG.754-210511
Architecture: all
Priority: optional
Section: admin

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

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

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

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

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.754"
PI_BUILD="210510"
PI_BUILD="210511"
OS_NAME=`uname -s`
FORCE=0

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210510}
{210511}
ViewReadme
{Yes}

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

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

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.754-210510
Version: 7.0NG.754-210511
Architecture: all
Priority: optional
Section: admin

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

@ -15,14 +15,14 @@ global $config;
check_login();
ui_require_css_file('first_task');
?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no planned downtime defined yet.') ]); ?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no scheduled downtime defined yet.') ]); ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<?php
echo __(
"%s contains a scheduled downtime management system.
@ -34,7 +34,7 @@ ui_require_css_file('first_task');
?>
</p>
<form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
<input type="submit" class="button_task" value="<?php echo __('Create Scheduled Downtime'); ?>" />
</form>
</div>
</div>

@ -1004,9 +1004,9 @@ echo '<div class="action-buttons agent_manager" style="width: '.$table->width.'"
// The context help about the learning mode.
if ($modo == 0) {
echo "<span id='modules_not_learning_mode_context_help pdd_r_10px' '>";
echo "<span id='modules_not_learning_mode_context_help' class='pdd_r_10px'>";
} else {
echo "<span id='modules_not_learning_mode_context_help' style='display:none'>";
echo "<span id='modules_not_learning_mode_context_help' class='invisible'>";
}
echo clippy_context_help('modules_not_learning_mode');

@ -746,9 +746,9 @@ if ($agents !== false) {
if ($in_planned_downtime) {
ui_print_help_tip(
__('Agent in planned downtime'),
__('Agent in scheduled downtime'),
false,
$config['image']['minireloj_16']
'images/minireloj-16.png'
);
echo '</em>';

@ -64,7 +64,7 @@ $buttons = [
// Header.
ui_print_page_header(
__('Planned Downtime'),
__('Scheduled Downtime'),
'images/gm_monitoring.png',
false,
'',
@ -308,12 +308,12 @@ if ($create_downtime || $update_downtime) {
);
} else {
ui_print_error_message(
__('Each planned downtime must have a different name')
__('Each scheduled downtime must have a different name')
);
}
} else {
ui_print_error_message(
__('Planned downtime must have a name')
__('Scheduled downtime must have a name')
);
}
} else if ($update_downtime) {
@ -345,7 +345,7 @@ if ($create_downtime || $update_downtime) {
$values = [];
if (trim(io_safe_output($name)) == '') {
ui_print_error_message(
__('Planned downtime must have a name')
__('Scheduled downtime must have a name')
);
}
@ -1489,14 +1489,14 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(this).css ("width", "180px");
});
// Warning message about the problems caused updating a past planned downtime
// Warning message about the problems caused updating a past scheduled downtime
var type_execution = "<?php echo $type_execution; ?>";
var datetime_from = <?php echo json_encode(strtotime($once_date_from.' '.$once_time_from)); ?>;
var datetime_now = <?php echo json_encode($utimestamp); ?>;
var create = <?php echo json_encode($create); ?>;
if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) {
$("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you edit this planned downtime, the data of future SLA reports may be altered'); ?>")) {
if (!confirm("<?php echo __('WARNING: If you edit this scheduled downtime, the data of future SLA reports may be altered'); ?>")) {
e.preventDefault();
}
});

@ -196,5 +196,5 @@ if (!empty($downtimes)) {
echo chr(13);
}
} else {
echo '<div class="nf">'.__('No planned downtime').'</div>';
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
}

@ -44,7 +44,7 @@ if ($migrate_malformed) {
if ($migration_result['status'] == false) {
ui_print_error_message(
__('An error occurred while migrating the malformed planned downtimes').'. '.__('Please run the migration again or contact with the administrator')
__('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
);
echo '<br>';
}
@ -80,7 +80,7 @@ if ($stop_downtime) {
$result = planned_downtimes_stop($downtime);
if ($result === false) {
ui_print_error_message(__('An error occurred stopping the planned downtime'));
ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
} else {
echo $result['message'];
}
@ -103,7 +103,7 @@ if ($delete_downtime) {
// The downtime shouldn't be running!!
if ($downtime['executed']) {
ui_print_error_message(__('This planned downtime is running'));
ui_print_error_message(__('This scheduled downtime is running'));
} else {
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
@ -362,7 +362,7 @@ else if (!$downtimes) {
echo '</form>';
// Info message.
echo '<div class="nf">'.__('No planned downtime').'</div>';
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
echo '<div class="action-buttons w100p" >';
@ -572,13 +572,13 @@ $(document).ready (function () {
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("a#delete_downtime").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you delete this planned downtime, it will not be taken into account in future SLA reports'); ?>")) {
if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
e.preventDefault();
}
});
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
if (confirm("<?php echo __('WARNING: There are malformed scheduled downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
}
}

@ -200,11 +200,7 @@ $table->data[5] = $data;
if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">';
html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right_align">';
} else {
echo '<div class="w100p right">';
}
html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']);
echo '</div>';
@ -212,11 +208,7 @@ if ($event_response_id == 0) {
} else {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">';
html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right_align">';
} else {
echo '<div class="w100p right">';
}
html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']);
echo '</div>';

@ -3326,6 +3326,9 @@ function print_SLA_list($width, $action, $idItem=null)
<input id="hidden-id_agent_sla" name="id_agent_sla" value="" type="hidden">
<input id="hidden-id_server" name="id_server" value="" type="hidden">
<?php
// Set autocomplete image.
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black') ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
// Params for agent autocomplete input.
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'agent_sla';
@ -3335,6 +3338,8 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_sla';
$params['add_none_module'] = false;
$params['check_only_empty_javascript_on_blur_function'] = true;
$params['icon_image'] = $autocompleteImage;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
@ -3370,6 +3375,7 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false;
$params['icon_image'] = $autocompleteImage;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
@ -4734,8 +4740,10 @@ function addSLARow() {
var serviceId = $("select#id_service>option:selected").val();
var serviceName = $("select#id_service>option:selected").text();
if (((idAgent != '') && (slaMin != '') && (slaMax != '')
&& (slaLimit != '')) || serviceId != '') {
if ((((idAgent != '') && (idAgent > 0))
&& ((idModule != '') && (idModule > 0)))
|| serviceId != null)
{
if (nameAgent != '') {
//Truncate nameAgent
var params = [];
@ -4892,6 +4900,7 @@ function addSLARow() {
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_sla]").css("background","url('<?php echo $autocompleteImage; ?>') right center no-repeat")
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');

@ -420,7 +420,7 @@ $table->data[$i++][1] = html_print_select(
$config['past_planned_downtimes'] = isset(
$config['past_planned_downtimes']
) ? $config['past_planned_downtimes'] : 1;
$table->data[$i][0] = __('Allow create planned downtimes in the past');
$table->data[$i][0] = __('Allow create scheduled downtimes in the past');
$table->data[$i++][1] = html_print_checkbox_switch(
'past_planned_downtimes',
1,

@ -94,7 +94,7 @@ is not working on the metaconsole and there is no time to fix it -->
var mr_available_header = "<?php echo __('There are db changes'); ?>\n";
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n";
var text3_mr_file = "<?php echo __('Scheduled downtime'); ?>\n";
var language = "<?php echo $config['language']; ?>";
var docsUrl = (language === "es")

@ -233,8 +233,7 @@ if (defined('METACONSOLE')) {
$disable_user = get_parameter('disable_user', false);
if (isset($_GET['user_del'])) {
if ((bool) get_parameter('user_del', false) === true) {
// delete user
$id_user = get_parameter('delete_user', 0);
// Only allow delete user if is not the actual user
@ -312,13 +311,13 @@ if (isset($_GET['user_del'])) {
$result = false;
}
if ($disable_user == 1) {
if ($disable_user === 1) {
ui_print_result_message(
$result,
__('Successfully disabled'),
__('There was a problem disabling user')
);
} else {
} else if ($disable_user === 0) {
ui_print_result_message(
$result,
__('Successfully enabled'),
@ -562,7 +561,7 @@ foreach ($info as $user_id => $user_info) {
$iterator++;
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.$user_id.'</a>';
$data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
} else {
$data[0] = $user_id;
}
@ -642,19 +641,126 @@ foreach ($info as $user_id => $user_info) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = '';
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
if (!isset($user_info['not_delete'])) {
// Disable / Enable user.
if (isset($user_info['not_delete']) === false) {
if ($user_info['disabled'] == 0) {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=1&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable'), 'class' => 'invert_filter']).'</a>';
$toDoString = __('Disable');
$toDoAction = '1';
$toDoImage = 'images/lightbulb.png';
} else {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=0&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
$toDoString = __('Enable');
$toDoAction = '0';
$toDoImage = 'images/lightbulb_off.png';
}
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'id',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'disable_user',
$toDoAction,
true
);
$data[6] .= html_print_input_image(
'submit_disable_enable',
$toDoImage,
'',
'',
true,
[
'data-title' => $toDoString,
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
}
$data[6] .= '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit'), 'class' => 'invert_filter']).'</a>';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && !isset($user_info['not_delete'])) {
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
if (defined('METACONSOLE')) {
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['class' => 'invert_filter', 'title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
// Edit user.
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
$data[6] .= html_print_input_hidden(
'id_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'edit_user',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_edit_user',
'images/config.png',
'',
'padding:0',
true,
[
'data-title' => __('Edit'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && isset($user_info['not_delete']) === false) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_user',
'images/cross.png',
'',
'padding:0',
true,
[
'data-title' => __('Delete'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if (is_metaconsole() === true) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_hidden(
'delete_all',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_all',
'images/cross_double.png',
'',
'',
true,
[
'data-title' => __('Delete from all consoles'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
}
} else {
$data[6] .= '';

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

@ -1614,6 +1614,302 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
}
/**
* Update an agent by indicating a pair of field - value separated by comma.
*
* @param integer $id_agent Id (or alias) agent to upadate.
* @param boolean $use_agent_alias Use alias instead of id.
* @param array $params Pair of parameter/value separated by comma. Available fields are:
* 'alias',
* 'direccion',
* 'id_parent',
* 'id_grupo',
* 'cascade_protection',
* 'cascade_protection_module',
* 'intervalo',
* 'id_os',
* 'server_name',
* 'custom_id',
* 'modo',
* 'disabled',
* 'comentarios'
*
* eg . http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_agent_field&id=pandora&other=id_os,1|alias,pandora|direccion,192.168.10.16|id_parent,1cascade_protection,1|cascade_protection_module,1|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*/
function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
{
global $config;
$return = false;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
return;
}
// Check the agent.
if ((bool) $use_agent_alias === true) {
$agents_by_alias = agents_get_agent_id_by_alias($id_agent);
if (empty($agents_by_alias) === false) {
foreach ($agents_by_alias as $agent) {
if (agents_check_access_agent($agent['id_agente'], 'AW') === true) {
$agents[] = $agent['id_agente'];
}
}
if (empty($agents) === true) {
returnError('forbidden', 'string');
return;
}
} else {
returnError('Alias does not match any agent.');
return;
}
} else {
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AW')) {
return;
}
$agents[] = $id_agent;
}
// Serialize the data for update.
if ($params['type'] === 'array') {
// Keys available to change.
$available_fields = [
'alias',
'direccion',
'id_parent',
'id_grupo',
'cascade_protection',
'cascade_protection_module',
'intervalo',
'id_os',
'server_name',
'custom_id',
'modo',
'disabled',
'comentarios',
];
foreach ($params['data'] as $key_value) {
list($key, $value) = explode(',', $key_value, 2);
if (in_array($key, $available_fields) === true) {
$fields[$key] = $value;
}
}
}
if (empty($fields) === true) {
returnError('Selected field not available. Please, select one the fields avove');
return;
}
// Check fields.
foreach ($fields as $field => $data) {
switch ($field) {
case 'alias':
if (empty($data)) {
returnError('No agent alias specified');
return;
}
break;
case 'id_grupo':
if (db_get_value_sql('SELECT FROM tgrupo WHERE id_grupo = '.$data) === false) {
returnError('The group doesn`t exist.');
return;
}
break;
case 'id_os':
if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$data) === false) {
returnError('The OS doesn`t exist.');
return;
}
break;
case 'server_name':
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$data.'"');
if ($server_name === false) {
returnError('The server doesn`t exist.');
return;
}
break;
case 'cascade_protection':
if ($data == 1) {
if (($field['id_parent'] != 0) && (db_get_value_sql(
'SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = '.$fields['id_parent'].' AND id_agente_modulo = '.$fields['cascade_protection_module']
) === false)
) {
returnError('Cascade protection is not applied because it is not a parent module');
}
} else {
unset($fields['cascade_protection']);
}
break;
case 'id_grupo':
// Check ACL group.
if (!check_acl($config['id_user'], $data, 'AW')) {
returnError('forbidden', 'string');
return;
}
if ($data == 0) {
$agent_update_error = 'The agent could not be modified. For security reasons, use a group other than 0.';
returnError($agent_update_error);
return;
}
break;
case 'id_parent':
$parentCheck = agents_check_access_agent($data);
if (is_null($parentCheck) === true) {
returnError('The parent agent does not exist.');
return;
}
if ($parentCheck === false) {
returnError('The user cannot access to parent agent.');
return;
}
break;
default:
// Default empty.
break;
}
}
// Var applied in case there is more than one agent.
$return = false;
$applied = 0;
foreach ($agents as $agent) {
$values_old = db_get_row_filter(
'tagente',
['id_agente' => $agent],
[
'id_grupo',
'disabled',
]
);
$tpolicy_group_old = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$values_old['id_grupo']
);
$return = db_process_sql_update(
'tagente',
$fields,
['id_agente' => $agent]
);
if ((count($agents) > 1) && $return !== 0) {
$applied += 1;
}
if ($return && !isset($field['direccion'])) {
// register ip for this agent in 'taddress'.
agents_add_address($agent, $field['direccion']);
}
if ($return) {
// Update config file
if (isset($field['disabled']) && $values_old['disabled'] != $field['disabled']) {
enterprise_hook(
'config_agents_update_config_token',
[
$agent,
'standby',
$field['disabled'],
]
);
}
if ($tpolicy_group_old) {
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$agent
);
if ($tpolicy_agents_old) {
$result2 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 1],
[
'id_agent' => $agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
$tpolicy_group = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$field['id_grupo']
);
if ($tpolicy_group) {
foreach ($tpolicy_group as $key => $value) {
$tpolicy_agents = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$agent
);
if (!$tpolicy_agents) {
db_process_sql_insert(
'tpolicy_agents',
[
'id_policy' => $value['id_policy'],
'id_agent' => $agent,
]
);
} else {
$result3 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 0],
[
'id_agent' => $agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
}
}
if (count($agents) > 1) {
returnData(
'string',
[
'type' => 'string',
'data' => __('Updated %d/%d agents', $applied, count($agents)),
]
);
} else {
returnData(
'string',
[
'type' => 'string',
'data' => __('Agent updated.'),
]
);
}
}
/**
* Create a new agent, and print the id for new agent.
*
@ -6717,7 +7013,7 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3)
$data = db_get_row_sql($sql);
if ($data['type_execution'] == 'periodically' && $data['executed'] == 1) {
returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running planned downtime cannot be stopped.'));
returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running scheduled downtime cannot be stopped.'));
return;
}
@ -7203,7 +7499,7 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
}
if (empty($agents)) {
returnError('No agents to create planned downtime items');
returnError('No agents to create scheduled downtime items');
} else {
if (!empty($returned['bad_modules'])) {
$bad_modules = __("and this modules are doesn't exists or not applicable a this agents: ").implode(', ', $returned['bad_modules']);
@ -8412,6 +8708,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
$values['contact'] = $safe_other_data[6];
$values['other'] = $safe_other_data[7];
$values['max_agents'] = $safe_other_data[8];
$values['password'] = $safe_other_data[9];
$id_group = groups_create_group($group_name, $values);

@ -319,7 +319,7 @@ function config_update_config()
}
if (!config_update_value('past_planned_downtimes', get_parameter('past_planned_downtimes'))) {
$error_update[] = __('Allow create planned downtimes in the past');
$error_update[] = __('Allow create scheduled downtimes in the past');
}
if (!config_update_value('limit_parameters_massive', get_parameter('limit_parameters_massive'))) {

@ -4318,10 +4318,6 @@ function events_page_details($event, $server='')
$table_class = 'table_modal_alternate';
if ($config['style'] === 'pandora_black') {
$table_class = 'black_table_modal_alternate';
}
// Details.
$table_details = new stdClass;
$table_details->width = '100%';
@ -4526,7 +4522,7 @@ function events_page_details($event, $server='')
$link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)";
$data[1] = '<a href="javascript:'.$link.'">';
$data[1] .= html_print_image('images/chart_curve.png', true);
$data[1] .= html_print_image('images/chart_curve.png', true, ['class' => 'invert_filter']);
$data[1] .= '</a>';
$table_details->data[] = $data;
}
@ -4546,13 +4542,19 @@ function events_page_details($event, $server='')
$data[1] .= html_print_image(
'images/bell.png',
true,
['title' => __('Go to data overview')]
[
'title' => __('Go to data overview'),
'class' => 'invert_filter',
]
);
} else {
$data[1] .= html_print_image(
'images/bell_pause.png',
true,
['title' => __('Go to data overview')]
[
'title' => __('Go to data overview'),
'class' => 'invert_filter',
]
);
}

@ -2765,6 +2765,8 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
'lang',
'tabindex',
'title',
'data-title',
'data-use_title_for_force_title',
'xml:lang',
'onclick',
'ondblclick',
@ -5078,10 +5080,13 @@ function html_print_input_multicheck(array $data):string
/**
* Print an autocomplete input filled out with Integria IMS users.
*
* @param string $name The name of ajax control, by default is "users".
* @param string $default The default value to show in the ajax control.
* @param boolean $return If it is true return a string with the output instead to echo the output.
* @param string $size Size.
* @param string $name The name of ajax control, by default is "users".
* @param string $default The default value to show in the ajax control.
* @param boolean $return If it is true return a string with the output instead to echo the output.
* @param string $size Size.
* @param boolean $disable Disable the button (optional, button enabled by default).
* @param boolean $required Attribute required.
* @param string $class Text inpunt class.
*
* @return mixed If the $return is true, return the output as string.
*/
@ -5091,7 +5096,8 @@ function html_print_autocomplete_users_from_integria(
$return=false,
$size='30',
$disable=false,
$required=false
$required=false,
$class=null
) {
global $config;
@ -5108,6 +5114,10 @@ function html_print_autocomplete_users_from_integria(
$attrs['required'] = 'required';
}
if (empty($class) === false) {
$attrs['class'] = $class;
}
html_print_input_text_extended(
$name,
$default,

@ -1,22 +1,32 @@
<?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 Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Modules
* Functions for modules.
*
* @category Functions script.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_tags.php';
@ -567,7 +577,7 @@ function modules_update_agent_module(
* Creates a module in an agent.
*
* @param integer $id_agent Agent id.
* @param integer $name Module name id.
* @param string $name Module name id.
* @param array $values Extra values for the module.
* @param boolean $disableACL Disable the ACL checking, for default false.
* @param mixed $tags Array with tag's ids or false.
@ -575,35 +585,36 @@ function modules_update_agent_module(
* @return New module id if the module was created. False if not.
*/
function modules_create_agent_module(
$id_agent,
$name,
$values=false,
$disableACL=false,
int $id_agent,
string $name,
array $values=[],
bool $disableACL=false,
$tags=false
) {
global $config;
if (!$disableACL) {
if (!users_is_admin() && (empty($id_agent)
|| !users_access_to_agent($id_agent, 'AW'))
if ((bool) $disableACL === false) {
if ((bool) users_is_admin() === false
&& (empty($id_agent) === true
|| users_access_to_agent($id_agent, 'AW') === false)
) {
return false;
}
}
if (empty($name)) {
if (empty($name) === true) {
return ERR_INCOMPLETE;
}
// Check for non valid characters in module name.
if (mb_ereg_match('[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]', io_safe_output($name)) !== false) {
if (mb_ereg_match(
'[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]',
io_safe_output($name)
) !== false
) {
return ERR_GENERIC;
}
if (! is_array($values)) {
$values = [];
}
$values['nombre'] = $name;
$values['id_agente'] = (int) $id_agent;
@ -616,29 +627,39 @@ function modules_create_agent_module(
]
);
if ($exists) {
if ($exists === true) {
return ERR_EXIST;
}
// Encrypt passwords.
if (isset($values['plugin_pass'])) {
// Avoid two times encryption
if (isset($values['plugin_pass']) === true) {
// Avoid two times encryption.
$plugin_pass = io_safe_output($values['plugin_pass']);
$values['plugin_pass'] = io_input_password($plugin_pass);
}
// Encrypt SNMPv3 passwords.
if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15
&& $values['id_tipo_modulo'] <= 18)
&& isset($values['tcp_send']) && ($values['tcp_send'] == 3)
&& isset($values['custom_string_2'])
if (isset($values['id_tipo_modulo']) === true
&& ((int) $values['id_tipo_modulo'] >= MODULE_TYPE_REMOTE_SNMP
&& (int) $values['id_tipo_modulo'] <= MODULE_TYPE_REMOTE_SNMP_PROC)
&& isset($values['tcp_send']) === true
&& ((int) $values['tcp_send'] === 3)
&& isset($values['custom_string_2']) === true
) {
$values['custom_string_2'] = io_input_password(
$values['custom_string_2']
);
}
// Only for Web server modules.
if (isset($values['id_tipo_modulo']) === true
&& ($values['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
&& $values['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING)
) {
$values['debug_content'] = io_safe_input($values['debug_content']);
}
$id_agent_module = db_process_sql_insert('tagente_modulo', $values);
if ($id_agent_module === false) {
@ -646,7 +667,7 @@ function modules_create_agent_module(
}
$return_tag = true;
if (($tags !== false) || (empty($tags))) {
if (($tags !== false) || (empty($tags) === true)) {
$return_tag = tags_insert_module_tag($id_agent_module, $tags);
}
@ -659,10 +680,10 @@ function modules_create_agent_module(
return ERR_DB;
}
if (isset($values['id_tipo_modulo'])
&& ($values['id_tipo_modulo'] == 21
|| $values['id_tipo_modulo'] == 22
|| $values['id_tipo_modulo'] == 23)
if (isset($values['id_tipo_modulo']) === true
&& ((int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_PROC
|| (int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_DATA
|| (int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_STRING)
) {
// Async modules start in normal status.
$status = AGENT_MODULE_STATUS_NORMAL;
@ -706,8 +727,8 @@ function modules_create_agent_module(
}
// Update module status count if the module is not created disabled.
if ((!isset($values['disabled']) || $values['disabled'] == 0) && $values['id_modulo'] > 0) {
if ($status == 0) {
if (isset($values['disabled']) === false || (int) $values['disabled'] === 0) {
if ((int) $status === AGENT_MODULE_STATUS_NORMAL) {
db_process_sql(
'UPDATE tagente
SET total_count=total_count+1, normal_count=normal_count+1
@ -2362,7 +2383,7 @@ function modules_get_agentmodule_data_for_humans($module)
}
} else {
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
if ($data_macro) {
if ($data_macro !== false) {
$salida = $data_macro;
} else {
$salida = ui_print_module_string_value(

@ -95,12 +95,12 @@ function planned_downtimes_update($values, $downtime_id=0, $check_dates=true)
$name_exists = (bool) db_get_value('id', 'tplanned_downtime', 'name', $values['name']);
if ($name_exists) {
$result['message'] = ui_print_error_message(__('Each planned downtime must have a different name'), '', true);
$result['message'] = ui_print_error_message(__('Each scheduled downtime must have a different name'), '', true);
return $result;
}
} else {
$result['message'] = ui_print_error_message(__('Planned downtime must have a name'), '', true);
$result['message'] = ui_print_error_message(__('Scheduled downtime must have a name'), '', true);
return $result;
}
@ -811,13 +811,13 @@ function planned_downtimes_created($values)
} else {
return [
'return' => false,
'message' => __('Each planned downtime must have a different name'),
'message' => __('Each scheduled downtime must have a different name'),
];
}
} else {
return [
'return' => false,
'message' => __('Planned downtime must have a name'),
'message' => __('Scheduled downtime must have a name'),
];
}
@ -904,16 +904,16 @@ function delete_planned_downtimes($filter)
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute');
if ($downtime_execute) {
$return = __("This planned downtime are executed now. Can't delete in this moment.");
$return = __("This scheduled downtime are executed now. Can't delete in this moment.");
} else {
$delete = db_process_sql_delete(
'tplanned_downtime',
['id' => $filter['id_downtime']]
);
if ($delete) {
$return = __('Deleted this planned downtime successfully.');
$return = __('Deleted this scheduled downtime successfully.');
} else {
$return = __('Problems for deleted this planned downtime.');
$return = __('Problems for deleted this scheduled downtime.');
}
}

@ -856,7 +856,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table1->size[10] = '2%';
$table1->data[0][10] = '<img src ="'.$src.'images/square_light_gray.png">';
$table1->size[11] = '15%';
$table1->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
$table1->data[0][11] = '<span>'.__('Scheduled Downtime').'</span>';
if ($pdf === 0) {
$table->colspan['legend']['cell'] = 2;
@ -4081,7 +4081,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table2->size[10] = '2%';
$table2->data[0][10] = '<img src ="'.$src.$hack_metaconsole.'images/square_light_gray.png">';
$table2->size[11] = '15%';
$table2->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
$table2->data[0][11] = '<span>'.__('Scheduled Downtime').'</span>';
}
if ($pdf !== 0) {
@ -5609,8 +5609,8 @@ function reporting_html_planned_downtimes_table($planned_downtimes)
$table = new StdClass();
$table->width = '99%';
$table->title = __('This SLA has been affected by the following planned downtimes').ui_print_help_tip(
__('If the duration of the planned downtime is less than 5 minutes it will not be represented in the graph'),
$table->title = __('This SLA has been affected by the following scheduled downtimes').ui_print_help_tip(
__('If the duration of the scheduled downtime is less than 5 minutes it will not be represented in the graph'),
true
);
$table->head = [];
@ -5648,7 +5648,7 @@ function reporting_html_planned_downtimes_table($planned_downtimes)
if ($downtime_malformed) {
$info_malformed = ui_print_error_message(
__('This item is affected by a malformed planned downtime').'. '.__('Go to the planned downtimes section to solve this').'.',
__('This item is affected by a malformed scheduled downtime').'. '.__('Go to the scheduled downtimes section to solve this').'.',
'',
true
);

@ -1483,7 +1483,10 @@ function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
return false;
}
if (is_metaconsole()) {
if (is_metaconsole()
&& (isset($config['requirements_use_base_url']) === false
|| $config['requirements_use_base_url'] === false)
) {
$config['css'][$name] = '/../../'.$filename;
} else {
$config['css'][$name] = $filename;
@ -1535,7 +1538,10 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
return false;
}
if (is_metaconsole()) {
if (is_metaconsole()
&& (isset($config['requirements_use_base_url']) === false
|| $config['requirements_use_base_url'] === false)
) {
$config['js'][$name] = '../../'.$filename;
} else {
$config['js'][$name] = $filename;
@ -5178,6 +5184,11 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change = '';
// Default value.
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.css("background","url(\'"+image+"\') right center no-repeat");
}
function set_functions_change_autocomplete_'.$input_name.'() {
var cache_'.$input_name.' = {};
@ -5192,10 +5203,9 @@ function ui_print_agent_autocomplete_input($parameters)
if (cache_'.$input_name.'[groupId] == null) {
cache_'.$input_name.'[groupId] = {};
}
//Set loading
$("#'.$input_id.'")
.css("background","url(\"'.$spinner_image.'\") right center no-repeat");
setInputBackground("'.$input_id.'", "'.$spinner_image.'");
//Function to call when the source
if ('.((int) !empty($javascript_function_action_into_source_js_call)).') {
@ -5209,8 +5219,7 @@ function ui_print_agent_autocomplete_input($parameters)
response(cache_'.$input_name.'[groupId][term]);
//Set icon
$("#'.$input_id.'")
.css("background","url(\"'.$icon_image.'\") right center no-repeat '.$icon_image.'");
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
}
else {
@ -5228,7 +5237,9 @@ function ui_print_agent_autocomplete_input($parameters)
response(cache_'.$input_name.'[groupId][oldterm]);
found = true;
//Set icon
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
}
});
@ -5244,11 +5255,10 @@ function ui_print_agent_autocomplete_input($parameters)
if (found) {
//Set icon
$("#'.$input_id.'")
.css("background","url(\"'.$icon_image.'\") right center no-repeat");
setInputBackground("'.$input_id.'", "'.$icon_image.'");
select_item_click = 0;
return;
}
@ -5263,16 +5273,13 @@ function ui_print_agent_autocomplete_input($parameters)
response(data);
//Set icon
$("#'.$input_id.'")
.css("background",
"url(\"'.$icon_image.'\") right center no-repeat");
select_item_click = 0;
setInputBackground("'.$input_id.'", "'.$icon_image.'");
select_item_click = 0;
return;
}
});
return;
},
//---END source-----------------------------------------
@ -5451,15 +5458,23 @@ function ui_print_agent_autocomplete_input($parameters)
return;
}
if ('.((int) $check_only_empty_javascript_on_blur_function).') {
return
}
if (select_item_click) {
select_item_click = 0;
$("#'.$input_id.'")
.css("background",
"url(\"'.$icon_image.'\") right center no-repeat");
return;
}
} else {
// Clear selectbox if item is not selected.
$("#'.$selectbox_id.'").empty();
$("#'.$selectbox_id.'").append($("<option value=0>'.__('Select an Agent first').'</option>"));
$("#'.$selectbox_id.'").attr("disabled", "disabled");
// Not allow continue on blur .
if ('.((int) $check_only_empty_javascript_on_blur_function).') {
return
}
}
//Set loading
$("#'.$input_id.'")
.css("background",
@ -5533,7 +5548,7 @@ function ui_print_agent_autocomplete_input($parameters)
if ('.((int) !empty($javascript_function_action_after_select_js_call)).') {
'.$javascript_function_action_after_select_js_call.'
}
//Set icon
$("#'.$input_id.'")
.css("background",

@ -1428,7 +1428,7 @@ function update_manager_check_online_free_packages($is_ajax=true)
var mr_available_header = "<?php echo __('There are db changes'); ?>\n";
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n";
var text3_mr_file = "<?php echo __('Scheduled downtime'); ?>\n";
var language = "<?php echo $config['language']; ?>";
var docsUrl = (language === "es")

@ -1078,7 +1078,6 @@ class Item extends CachedModel
$mobile_navigation = true;
}
error_log(obhd($_SERVER['PHP_SELF']));
// Load side libraries.
include_once $config['homedir'].'/include/functions_ui.php';
if (\is_metaconsole() === true) {

@ -1000,3 +1000,6 @@ table.databox {
.tactical_set {
border-color: #707070;
}
li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab {
border: 1px solid #707070;
}

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

@ -688,7 +688,7 @@ if (!empty($table->data)) {
);
}
echo '<div id="alerts_list w100p">';
echo '<div id="alerts_list" class="w100p">';
html_print_table($table);
echo '</div>';

@ -808,9 +808,9 @@ foreach ($agents as $agent) {
if ($in_planned_downtime) {
$data[0] .= ui_print_help_tip(
__('Agent in planned downtime'),
__('Agent in scheduled downtime'),
true,
$config['image']['minireloj_16']
'images/minireloj-16.png'
);
$data[0] .= '</em>';
}

@ -137,7 +137,7 @@ if ($agent['disabled']) {
if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
$agent_name .= '<em>&nbsp;'.ui_print_help_tip(
__('Agent in planned downtime'),
__('Agent in scheduled downtime'),
true,
'images/minireloj-16.png'
).'</em>';
@ -145,7 +145,7 @@ if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
|| ($in_planned_downtime && !$agent['quiet'])
) {
$agent_name .= '&nbsp;'.ui_print_help_tip(
__('Agent in planned downtime'),
__('Agent in scheduled downtime'),
true,
'images/minireloj-16.png'
).'</em>';

@ -151,11 +151,34 @@ ui_print_message_dialog(
// ACL.
$all_groups = agents_get_all_groups_agent($agent_id);
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
// If in metaconsole, resotre DB to check meta user acl.
if (is_metaconsole()) {
metaconsole_restore_db();
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') !== true) {
include $config['homedir'].'/general/noaccess.php';
exit;
}
// Metaconsole connection to the node.
$server_id = (int) get_parameter('server', 0);
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting.
if (metaconsole_connect($server) !== NOERR) {
echo '<html>';
echo '<body>';
ui_print_error_message(
__('There was a problem connecting with the node')
);
echo '</body>';
echo '</html>';
exit;
}
}
$draw_alerts = get_parameter('draw_alerts', 0);
$period = get_parameter('period');

@ -163,32 +163,30 @@ $table->colspan[3][0] = 3;
$help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : '';
if (isset($_GET['from_event'])) {
if ($update) {
$input_value_title = $incident_details[3];
$input_value_type = $incident_details[17];
$input_value_status = $incident_details[6];
$input_value_group = $incident_details[8];
$input_value_criticity = $incident_details[7];
$input_value_owner = $incident_details[5];
$input_value_content = $incident_details[4];
} else if (isset($_GET['from_event'])) {
$input_value_title = $config['cr_incident_title'];
$input_value_type = $config['cr_incident_type'];
$input_value_status = $config['cr_incident_status'];
$input_value_group = $config['cr_default_group'];
$input_value_criticity = $config['cr_default_criticity'];
$input_value_owner = $config['cr_default_owner'];
$input_value_content = $config['cr_incident_content'];
} else {
$input_value_title = '';
$input_value_type = '';
$input_value_status = '';
$input_value_group = '';
$input_value_criticity = '';
$input_value_owner = '';
$input_value_content = '';
}
if ($update) {
$input_value_title = $incident_details[3];
$input_value_type = $incident_details[17];
$input_value_status = $incident_details[6];
$input_value_group = $incident_details[8];
$input_value_criticity = $incident_details[7];
$input_value_owner = $incident_details[5];
$input_value_content = $incident_details[4];
} else if (isset($_GET['from_event'])) {
$input_value_title = $config['cr_incident_title'];
$input_value_type = $config['cr_incident_type'];
$input_value_status = $config['cr_incident_status'];
$input_value_group = $config['cr_default_group'];
$input_value_criticity = $config['cr_default_criticity'];
$input_value_owner = $config['cr_default_owner'];
$input_value_content = $config['cr_incident_content'];
} else {
$input_value_title = '';
$input_value_type = '';
$input_value_status = '';
$input_value_group = '';
$input_value_criticity = '';
$input_value_owner = '';
$input_value_content = '';
}
$table->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Title').':&nbsp'.$help_macros.'</p>';
@ -295,7 +293,11 @@ $table->data[2][2] = '<div class="label_select"><p class="input_label">'.__('Own
$table->data[2][2] .= '<div class="label_select_parent">'.html_print_autocomplete_users_from_integria(
'owner',
$input_value_owner,
true
true,
'30',
false,
false,
'w100p'
).'</div>';
$table->data[3][0] = '<div class="label_select"><p class="input_label">'.__('Description').':&nbsp'.$help_macros.'</p>';

@ -95,7 +95,7 @@ if (!$agents || !$searchAgents) {
);
if ($in_planned_downtime) {
$cellName .= '<em>'.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png');
$cellName .= '<em>'.ui_print_help_tip(__('Agent in scheduled downtime'), true, 'images/minireloj-16.png');
$cellName .= '</em>';
}

@ -32,7 +32,7 @@ global $config;
// Load the header.
require $config['homedir'].'/operation/users/user_edit_header.php';
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
date_default_timezone_set('UTC');
include 'include/javascript/timezonepicker/includes/parser.inc';
@ -648,11 +648,13 @@ foreach ($timezones as $timezone_name => $tz) {
}
if (is_metaconsole()) {
echo '<form name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=advanced&sec2=advanced/users_setup').'&amp;tab=user_edit&amp;modified=1&amp;id='.$id.'&amp;pure='.$config['pure'].'">';
echo '<form name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=advanced&sec2=advanced/users_setup').'&amp;tab=user_edit&amp;modified=1&amp;pure='.$config['pure'].'">';
} else {
echo '<form name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=workspace&sec2=operation/users/user_edit').'&amp;modified=1&amp;id='.$id.'&amp;pure='.$config['pure'].'">';
echo '<form name="user_mod" method="post" action="'.ui_get_full_url('index.php?sec=workspace&sec2=operation/users/user_edit').'&amp;modified=1&amp;pure='.$config['pure'].'">';
}
html_print_input_hidden('id', $id, false, false, false, 'id');
echo '<div id="user_form">
<div class="user_edit_first_row">
<div class="edit_user_info white_box">

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

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

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

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.754-210510
Version: 7.0NG.754-210511
Architecture: all
Priority: optional
Section: admin

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

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.754";
my $pandora_build = "210510";
my $pandora_build = "210511";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -117,9 +117,9 @@ sub pandora_init {
($pa_config->{"pandora_path"} = $parametro);
}
}
if ($pa_config->{"pandora_path"} eq ""){
print " [ERROR] I need at least one parameter: Complete path to " . pandora_get_initial_product_name() . " configuration file. \n";
print " For example: ./pandora_server /etc/pandora/pandora_server.conf \n\n";
if (!defined ($pa_config->{"pandora_path"}) || $pa_config->{"pandora_path"} eq ""){
print "[ERROR] I need at least one parameter: Complete path to " . pandora_get_initial_product_name() . " configuration file. \n";
print "For example: ./pandora_server /etc/pandora/pandora_server.conf \n\n";
exit;
}
}

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.754";
my $pandora_build = "210510";
my $pandora_build = "210511";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -792,7 +792,8 @@ sub transfer_xml {
my $file_name;
my $file_path;
if (! -f $xml) {
if ($xml =~ /\n/ || ! -f $xml) {
# Not a file, it's content.
if (! (empty ($name))) {
$file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data";
}

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

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

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

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

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.754 PS210510";
my $version = "7.0NG.754 PS210511";
# save program name for logging
my $progname = basename($0);