mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Merge branch 'develop' into 'ent-12673-eliminar-el-de-todas-las-custom-queries-en-el-discovery-de-oracle-2'
# Conflicts: # pandora_console/extras/mr/68.sql
This commit is contained in:
commit
2b33bf84bf
@ -3,5 +3,6 @@ START TRANSACTION;
|
|||||||
-- Update version for plugin oracle
|
-- Update version for plugin oracle
|
||||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||||
|
|
||||||
COMMIT;
|
ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ;
|
||||||
|
|
||||||
|
COMMIT;
|
@ -399,12 +399,12 @@ if ($new_agent === true) {
|
|||||||
|
|
||||||
// Ip adress.
|
// Ip adress.
|
||||||
$tableAgent->data['caption_ip_address'] = __('IP Address');
|
$tableAgent->data['caption_ip_address'] = __('IP Address');
|
||||||
$tableAgent->rowclass['ip_address'] = 'w540px';
|
$tableAgent->rowclass['ip_address'] = 'w400px';
|
||||||
$tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px');
|
$tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px');
|
||||||
|
$tableAgent->data['ip_address'][1] = html_print_button(__('Check unique IP'), 'check_unique_ip', false, '', ['class' => 'secondary w130px'], true);
|
||||||
|
$tableAgent->data['message_check_ip'][0] = html_print_div(['id' => 'message_check_ip'], true);
|
||||||
|
|
||||||
$tableAgent->rowclass['additional_ip_address'] = 'subinput';
|
$tableAgent->rowclass['additional_ip_address'] = 'subinput';
|
||||||
$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
|
|
||||||
$tableAgent->data['additional_ip_address'][1] = __('Unique IP');
|
|
||||||
$tableAgent->cellclass['additional_ip_address'][1] = 'w120px';
|
$tableAgent->cellclass['additional_ip_address'][1] = 'w120px';
|
||||||
$tableAgent->data['additional_ip_address'][2] = html_print_input(
|
$tableAgent->data['additional_ip_address'][2] = html_print_input(
|
||||||
[
|
[
|
||||||
@ -1301,6 +1301,7 @@ ui_require_jquery_file('bgiframe');
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
let unique_ip_trigger = false;
|
||||||
// Show/Hide custom field row.
|
// Show/Hide custom field row.
|
||||||
function show_custom_field_row(id){
|
function show_custom_field_row(id){
|
||||||
if( $('#field-'+id).css('display') == 'none'){
|
if( $('#field-'+id).css('display') == 'none'){
|
||||||
@ -1464,23 +1465,40 @@ ui_require_jquery_file('bgiframe');
|
|||||||
$("#text-agente").prop('readonly', true);
|
$("#text-agente").prop('readonly', true);
|
||||||
|
|
||||||
|
|
||||||
// Disable fixed ip button if empty.
|
$("#text-direccion").on('change',function(e){
|
||||||
if($("#text-direccion").val() == '') {
|
const unique_ip_token = '<?php echo $config['unique_ip']; ?>';
|
||||||
$("#fixed_ip").prop('disabled',true);
|
unique_ip_trigger = false;
|
||||||
}
|
if (unique_ip_token == 1) {
|
||||||
|
check_unique_ip();
|
||||||
$("#text-direccion").on('input',function(e){
|
|
||||||
if($("#text-direccion").val() == '') {
|
|
||||||
$("#fixed_ip").prop('disabled',true);
|
|
||||||
} else {
|
|
||||||
$("#fixed_ip").prop('disabled',false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
check_basic_options();
|
check_basic_options();
|
||||||
$('#id_os').on('change', function(){
|
$('#id_os').on('change', function(){
|
||||||
check_basic_options();
|
check_basic_options();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
$('#button-check_unique_ip').on('click', function() {
|
||||||
|
check_unique_ip();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#form_agent').on('submit', function(e) {
|
||||||
|
if (unique_ip_trigger) {
|
||||||
|
e.preventDefault();
|
||||||
|
const form = this;
|
||||||
|
confirmDialog(
|
||||||
|
{
|
||||||
|
title: '<?php echo __('Are you sure?'); ?>',
|
||||||
|
message: '<?php echo __('This IP address is in use. Are you sure you want to save it?'); ?>',
|
||||||
|
ok: '<?php echo __('Yes'); ?>',
|
||||||
|
cancel: '<?php echo __('Cancel'); ?>',
|
||||||
|
onAccept: function() {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function check_basic_options(){
|
function check_basic_options(){
|
||||||
@ -1490,4 +1508,40 @@ ui_require_jquery_file('bgiframe');
|
|||||||
$('#basic_options').addClass('invisible');
|
$('#basic_options').addClass('invisible');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function check_unique_ip() {
|
||||||
|
const direccion = $('#text-direccion').val();
|
||||||
|
let ip_all = <?php echo json_encode($ip_all); ?>;
|
||||||
|
if (ip_all) {
|
||||||
|
ip_all = Object.keys(ip_all);
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
page: "include/ajax/agent",
|
||||||
|
check_unique_ip: 1,
|
||||||
|
direccion,
|
||||||
|
ip_all
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
$('#message_check_ip').attr('class', 'success');
|
||||||
|
} else {
|
||||||
|
$('#message_check_ip').attr('class', 'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.exist_ip) {
|
||||||
|
unique_ip_trigger = true;
|
||||||
|
} else {
|
||||||
|
unique_ip_trigger = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#message_check_ip').html(data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -102,7 +102,6 @@ $alias_as_name = 0;
|
|||||||
$direccion_agente = get_parameter('direccion', '');
|
$direccion_agente = get_parameter('direccion', '');
|
||||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||||
$direccion_agente = io_safe_input($direccion_agente);
|
$direccion_agente = io_safe_input($direccion_agente);
|
||||||
$unique_ip = 0;
|
|
||||||
$intervalo = SECONDS_5MINUTES;
|
$intervalo = SECONDS_5MINUTES;
|
||||||
$ff_interval = 0;
|
$ff_interval = 0;
|
||||||
$quiet_module = 0;
|
$quiet_module = 0;
|
||||||
@ -186,7 +185,6 @@ if ($create_agent) {
|
|||||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
|
||||||
|
|
||||||
// Safe_output only validate ip.
|
// Safe_output only validate ip.
|
||||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||||
@ -269,12 +267,7 @@ if ($create_agent) {
|
|||||||
$nombre_agente = $alias;
|
$nombre_agente = $alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($unique_ip && $direccion_agente != '') {
|
if (!$exists_alias) {
|
||||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
|
||||||
$exists_ip = db_get_row_sql($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$exists_alias && !$exists_ip) {
|
|
||||||
$id_agente = db_process_sql_insert(
|
$id_agente = db_process_sql_insert(
|
||||||
'tagente',
|
'tagente',
|
||||||
[
|
[
|
||||||
@ -371,8 +364,6 @@ if ($create_agent) {
|
|||||||
$agent_creation_error = __('Could not be created');
|
$agent_creation_error = __('Could not be created');
|
||||||
if ($exists_alias) {
|
if ($exists_alias) {
|
||||||
$agent_creation_error = __('Could not be created, because name already exists');
|
$agent_creation_error = __('Could not be created, because name already exists');
|
||||||
} else if ($exists_ip) {
|
|
||||||
$agent_creation_error = __('Could not be created, because IP already exists');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -962,7 +953,6 @@ if ($update_agent) {
|
|||||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
|
||||||
// Safe_output only validate ip.
|
// Safe_output only validate ip.
|
||||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||||
|
|
||||||
@ -1097,18 +1087,11 @@ if ($update_agent) {
|
|||||||
// If there is an agent with the same name, but a different ID.
|
// If there is an agent with the same name, but a different ID.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') {
|
|
||||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
|
||||||
$exists_ip = db_get_row_sql($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$old_group = agents_get_agent_group($id_agente);
|
$old_group = agents_get_agent_group($id_agente);
|
||||||
if ($grupo <= 0) {
|
if ($grupo <= 0) {
|
||||||
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
|
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
|
||||||
} else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) {
|
} else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) {
|
||||||
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
|
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
|
||||||
} else if ($exists_ip) {
|
|
||||||
ui_print_error_message(__('Duplicate main IP address'));
|
|
||||||
} else {
|
} else {
|
||||||
// If different IP is specified than previous, add the IP.
|
// If different IP is specified than previous, add the IP.
|
||||||
if ($direccion_agente != ''
|
if ($direccion_agente != ''
|
||||||
|
@ -111,6 +111,15 @@ $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
|
|||||||
false,
|
false,
|
||||||
'width: 100%'
|
'width: 100%'
|
||||||
);
|
);
|
||||||
|
// Home screen. External link and Other.
|
||||||
|
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
|
||||||
|
'data_section',
|
||||||
|
$user_info['data_section'],
|
||||||
|
'',
|
||||||
|
60,
|
||||||
|
999,
|
||||||
|
true
|
||||||
|
);
|
||||||
$customHomeScreenDataField = '';
|
$customHomeScreenDataField = '';
|
||||||
foreach ($customHomeScreenAddition as $key => $customField) {
|
foreach ($customHomeScreenAddition as $key => $customField) {
|
||||||
$customHomeScreenDataField .= html_print_div(
|
$customHomeScreenDataField .= html_print_div(
|
||||||
|
@ -39,6 +39,7 @@ $get_agent_filters = get_parameter('get_agent_filters', 0);
|
|||||||
$save_agent_filter = get_parameter('save_agent_filter', 0);
|
$save_agent_filter = get_parameter('save_agent_filter', 0);
|
||||||
$update_agent_filter = get_parameter('update_agent_filter', 0);
|
$update_agent_filter = get_parameter('update_agent_filter', 0);
|
||||||
$delete_agent_filter = get_parameter('delete_agent_filter', 0);
|
$delete_agent_filter = get_parameter('delete_agent_filter', 0);
|
||||||
|
$check_unique_ip = (bool) get_parameter('check_unique_ip', 0);
|
||||||
|
|
||||||
if (https_is_running()) {
|
if (https_is_running()) {
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
@ -1020,4 +1021,29 @@ $(document).ready(function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($check_unique_ip === true) {
|
||||||
|
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||||
|
$ip_all = get_parameter_post('ip_all', '');
|
||||||
|
|
||||||
|
if (empty($direccion_agente) === true) {
|
||||||
|
echo json_encode(['success' => false, 'message' => __('Please enter an IP address.')]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||||
|
$exists_ip = db_get_row_sql($sql);
|
||||||
|
|
||||||
|
if ($exists_ip !== false) {
|
||||||
|
if (is_array($ip_all) === true && in_array($direccion_agente, $ip_all) === true) {
|
||||||
|
echo json_encode(['success' => true, 'message' => __('Success! but this IP is already in the list.')]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => __('This IP is already being used'), 'exist_ip' => true]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => true, 'message' => __('Success! this IP is available to be used.')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -388,26 +388,40 @@ class SatelliteAgent extends HTML
|
|||||||
$tmp->actions = '';
|
$tmp->actions = '';
|
||||||
|
|
||||||
if ($delete === false) {
|
if ($delete === false) {
|
||||||
$tmp->actions .= html_print_image(
|
$tmp->actions .= html_print_anchor(
|
||||||
($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
'border' => '0',
|
'href' => '#',
|
||||||
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
'content' => html_print_image(
|
||||||
'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')',
|
($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png',
|
||||||
]
|
true,
|
||||||
|
[
|
||||||
|
'title' => ($disable === true) ? __('Enable') : __('Disable'),
|
||||||
|
'border' => '0',
|
||||||
|
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
||||||
|
'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($disable === false) {
|
if ($disable === false) {
|
||||||
$tmp->actions .= html_print_image(
|
$tmp->actions .= html_print_anchor(
|
||||||
($delete === true) ? 'images/add.png' : 'images/delete.svg',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
'border' => '0',
|
'href' => '#',
|
||||||
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
'content' => html_print_image(
|
||||||
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')',
|
($delete === true) ? 'images/add.png' : 'images/delete.svg',
|
||||||
]
|
true,
|
||||||
|
[
|
||||||
|
'title' => ($delete === true) ? __('Add') : __('Delete'),
|
||||||
|
'border' => '0',
|
||||||
|
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
||||||
|
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +481,11 @@ select:-internal-list-box {
|
|||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.w130px {
|
||||||
|
width: 130px;
|
||||||
|
max-width: 130px;
|
||||||
|
}
|
||||||
|
|
||||||
.w200px {
|
.w200px {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
@ -598,6 +603,10 @@ select:-internal-list-box {
|
|||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mw130px {
|
||||||
|
min-width: 130px;
|
||||||
|
}
|
||||||
|
|
||||||
.mw180px {
|
.mw180px {
|
||||||
min-width: 180px;
|
min-width: 180px;
|
||||||
}
|
}
|
||||||
|
@ -1294,7 +1294,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
|
|||||||
`section` TEXT,
|
`section` TEXT,
|
||||||
`data_section` TEXT,
|
`data_section` TEXT,
|
||||||
`metaconsole_section` VARCHAR(255) NOT NULL DEFAULT 'Default',
|
`metaconsole_section` VARCHAR(255) NOT NULL DEFAULT 'Default',
|
||||||
`metaconsole_data_section` VARCHAR(255) NOT NULL DEFAULT '',
|
`metaconsole_data_section` TEXT,
|
||||||
`force_change_pass` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
`force_change_pass` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`last_pass_change` DATETIME,
|
`last_pass_change` DATETIME,
|
||||||
`last_failed_login` DATETIME,
|
`last_failed_login` DATETIME,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user