Merge remote-tracking branch 'origin/develop' into ent-12019-api-2-0
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.775-240112
|
||||
Version: 7.0NG.775-240123
|
||||
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.775-240112"
|
||||
pandora_version="7.0NG.775-240123"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.775';
|
||||
use constant AGENT_BUILD => '240112';
|
||||
use constant AGENT_BUILD => '240123';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240112
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240112
|
||||
%define release 240123
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240112
|
||||
%define release 240123
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240112
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240112
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240112"
|
||||
PI_BUILD="240123"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{240112}
|
||||
{240123}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240112")
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240123")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240112))"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240123))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.775-240112
|
||||
Version: 7.0NG.775-240123
|
||||
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.775-240112"
|
||||
pandora_version="7.0NG.775-240123"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Allow Grafana proxy
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
|
||||
|
||||
// Get all request headers
|
||||
$headers = apache_request_headers();
|
||||
|
@ -23,7 +23,10 @@ if ($headers['X-DS-Authorization']) {
|
|||
|
||||
list($user, $password) = explode(':', base64_decode($headers['X-DS-Authorization']));
|
||||
|
||||
// Check user login
|
||||
// Prevent sql injection.
|
||||
$user = mysqli_real_escape_string($config['dbconnection'], $user);
|
||||
|
||||
// Check user login.
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
|
||||
if ($user_in_db !== false) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Allow Grafana proxy.
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
|
||||
|
||||
// Get all request headers.
|
||||
$headers = apache_request_headers();
|
||||
|
@ -38,7 +38,7 @@ if ($headers['Authorization']) {
|
|||
$result_data = [];
|
||||
|
||||
// Decode target data sent by datasource plugin in Grafana
|
||||
$target_data = json_decode($target['target'], true);
|
||||
$target_data = $target['target'];
|
||||
|
||||
if ($target_data['module']) {
|
||||
// Get module name as target if not defined in Grafana.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Allow Grafana proxy
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
|
||||
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
|
||||
|
||||
// Get all request headers
|
||||
$headers = apache_request_headers();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||
pandorafms.oracle=abdfd7280f76276f696115cabdac731e
|
||||
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
|
||||
pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
|
||||
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
|
||||
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
|
||||
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
|
||||
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
START TRANSACTION;
|
||||
|
||||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
|
||||
ALTER TABLE `tncm_agent_data`
|
||||
ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;
|
||||
|
||||
ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ;
|
||||
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`;
|
||||
|
||||
|
||||
COMMIT;
|
|
@ -397,21 +397,23 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
$modal_box .= '<a href="https://discord.com/invite/xVt2ruSxmr" target="_blank">'.__('Join discord community').'</a>';
|
||||
$modal_box .= '</div>';
|
||||
|
||||
$modal_help = html_print_div(
|
||||
[
|
||||
'id' => 'modal-help-content',
|
||||
'content' => html_print_image(
|
||||
'images/help@header.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Help'),
|
||||
'class' => 'main_menu_icon bot invert_filter',
|
||||
'alt' => 'user',
|
||||
]
|
||||
).$modal_box,
|
||||
],
|
||||
true,
|
||||
);
|
||||
if ($config['activate_feedback'] === '1') {
|
||||
$modal_help = html_print_div(
|
||||
[
|
||||
'id' => 'modal-help-content',
|
||||
'content' => html_print_image(
|
||||
'images/help@header.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Help'),
|
||||
'class' => 'main_menu_icon bot invert_filter',
|
||||
'alt' => 'user',
|
||||
]
|
||||
).$modal_box,
|
||||
],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// User.
|
||||
|
|
|
@ -399,12 +399,12 @@ if ($new_agent === true) {
|
|||
|
||||
// Ip adress.
|
||||
$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'][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->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->data['additional_ip_address'][2] = html_print_input(
|
||||
[
|
||||
|
@ -1130,17 +1130,12 @@ foreach ($fields as $field) {
|
|||
}
|
||||
|
||||
if ((bool) $field['is_password_type'] === true) {
|
||||
$customContent = html_print_input_text_extended(
|
||||
$customContent = html_print_input_password(
|
||||
'customvalue_'.$field['id_field'],
|
||||
$custom_value,
|
||||
'customvalue_'.$field['id_field'],
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
45,
|
||||
255,
|
||||
true
|
||||
);
|
||||
} else if ($field['is_link_enabled']) {
|
||||
|
@ -1301,6 +1296,7 @@ ui_require_jquery_file('bgiframe');
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
let unique_ip_trigger = false;
|
||||
// Show/Hide custom field row.
|
||||
function show_custom_field_row(id){
|
||||
if( $('#field-'+id).css('display') == 'none'){
|
||||
|
@ -1464,23 +1460,40 @@ ui_require_jquery_file('bgiframe');
|
|||
$("#text-agente").prop('readonly', true);
|
||||
|
||||
|
||||
// Disable fixed ip button if empty.
|
||||
if($("#text-direccion").val() == '') {
|
||||
$("#fixed_ip").prop('disabled',true);
|
||||
}
|
||||
|
||||
$("#text-direccion").on('input',function(e){
|
||||
if($("#text-direccion").val() == '') {
|
||||
$("#fixed_ip").prop('disabled',true);
|
||||
} else {
|
||||
$("#fixed_ip").prop('disabled',false);
|
||||
$("#text-direccion").on('change',function(e){
|
||||
const unique_ip_token = '<?php echo $config['unique_ip']; ?>';
|
||||
unique_ip_trigger = false;
|
||||
if (unique_ip_token == 1) {
|
||||
check_unique_ip();
|
||||
}
|
||||
});
|
||||
|
||||
check_basic_options();
|
||||
$('#id_os').on('change', function(){
|
||||
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(){
|
||||
|
@ -1490,4 +1503,40 @@ ui_require_jquery_file('bgiframe');
|
|||
$('#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>
|
||||
|
|
|
@ -102,7 +102,6 @@ $alias_as_name = 0;
|
|||
$direccion_agente = get_parameter('direccion', '');
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
$direccion_agente = io_safe_input($direccion_agente);
|
||||
$unique_ip = 0;
|
||||
$intervalo = SECONDS_5MINUTES;
|
||||
$ff_interval = 0;
|
||||
$quiet_module = 0;
|
||||
|
@ -186,7 +185,6 @@ if ($create_agent) {
|
|||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
|
||||
// Safe_output only validate ip.
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
|
@ -269,12 +267,7 @@ if ($create_agent) {
|
|||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
if ($unique_ip && $direccion_agente != '') {
|
||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||
$exists_ip = db_get_row_sql($sql);
|
||||
}
|
||||
|
||||
if (!$exists_alias && !$exists_ip) {
|
||||
if (!$exists_alias) {
|
||||
$id_agente = db_process_sql_insert(
|
||||
'tagente',
|
||||
[
|
||||
|
@ -371,8 +364,6 @@ if ($create_agent) {
|
|||
$agent_creation_error = __('Could not be created');
|
||||
if ($exists_alias) {
|
||||
$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_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
// Safe_output only validate ip.
|
||||
$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 ($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);
|
||||
if ($grupo <= 0) {
|
||||
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
|
||||
} 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'));
|
||||
} else if ($exists_ip) {
|
||||
ui_print_error_message(__('Duplicate main IP address'));
|
||||
} else {
|
||||
// If different IP is specified than previous, add the IP.
|
||||
if ($direccion_agente != ''
|
||||
|
|
|
@ -275,21 +275,27 @@ $(document).ready (function () {
|
|||
$('#configure_field-3').show();
|
||||
dialog_message("#message_no_set_password");
|
||||
$('#configure_field-1').hide();
|
||||
$('#configure_field-2-0').hide();
|
||||
}
|
||||
else{
|
||||
$('#configure_field-3').hide();
|
||||
$('#configure_field-1').show();
|
||||
$('#configure_field-2-0').show();
|
||||
}
|
||||
});
|
||||
$('input[type=checkbox][name=is_password_type]').change(function () {
|
||||
if( $('input[type=checkbox][name=is_password_type]').prop('checked')){
|
||||
$('#configure_field-1').hide();
|
||||
dialog_message("#message_no_set_combo");
|
||||
$('#configure_field-3').hide();
|
||||
$('#configure_field-2-1').hide();
|
||||
}
|
||||
else{
|
||||
if($('input[type=checkbox][name=is_combo_enable]').prop('checked') === true) {
|
||||
$('#configure_field-3').show();
|
||||
}
|
||||
$('#configure_field-1').show();
|
||||
$('#configure_field-2-1').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -131,9 +131,13 @@ if ($add_inventory_module) {
|
|||
}
|
||||
}
|
||||
|
||||
// Load inventory module data for updating
|
||||
// Load inventory module data for updating.
|
||||
if ($load_inventory_module) {
|
||||
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
|
||||
$sql = sprintf(
|
||||
'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = %s AND id_agente = %d',
|
||||
$load_inventory_module,
|
||||
$id_agente
|
||||
);
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
if (!empty($row)) {
|
||||
|
|
|
@ -1131,13 +1131,13 @@ if (isset($id_agente) === true && (int) $moduletype === MODULE_DATA) {
|
|||
$tableCron->data['cron_to_select'][0] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
}
|
||||
|
||||
$table_advanced->rowclass['cron_section'] = 'table_section full_section';
|
||||
$table_advanced->rowclass['cron_section'] = 'table_section full_section mrgn_top_mod_0px';
|
||||
$table_advanced->data['cron_section'] = html_print_table($tableCron, true);
|
||||
|
||||
$table_advanced->data['title_3'] = html_print_subtitle_table(__('Thresholds and state changes'));
|
||||
|
||||
$table_advanced->rowclass['caption_min_max_values'] = 'w50p pdd_t_10px';
|
||||
$table_advanced->rowclass['min_max_values'] = 'w50p';
|
||||
$table_advanced->rowclass['min_max_values'] = 'w50p pdd_b_10px';
|
||||
$table_advanced->data['caption_min_max_values'][0] = __('Min. Value');
|
||||
$table_advanced->data['caption_min_max_values'][1] = __('Max. Value');
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ $tableDynamicThreshold->data['adv_dynamic_threshold_twotailed'][0] = html_print_
|
|||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section';
|
||||
$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section mrgn_top_mod_0px';
|
||||
$table_advanced->data['dynamic_threshold_table'] = html_print_table($tableDynamicThreshold, true);
|
||||
|
||||
$tableFFThreshold = new stdClass();
|
||||
|
@ -1304,10 +1304,15 @@ $tableFFThreshold->data['ff_thresholds_each'][2] = html_print_input_text(
|
|||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$table_advanced->rowclass['gap_flipflop'] = 'mrgn_top_btn_10px_imp';
|
||||
$table_advanced->data['gap_flipflop'] = html_print_input_hidden('gap_flipflop', 0);
|
||||
|
||||
$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section';
|
||||
$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section mrgn_top_mod_0px';
|
||||
$table_advanced->data['flipflop_thresholds_table'] = html_print_table($tableFFThreshold, true);
|
||||
|
||||
$table_advanced->rowclass['gap_ff'] = 'mrgn_top_btn_10px_imp';
|
||||
$table_advanced->data['gap_ff'] = html_print_input_hidden('gap_ff', 0);
|
||||
|
||||
$table_advanced->rowclass['caption_ff_interval_timeout'] = 'w50p';
|
||||
$table_advanced->rowclass['ff_interval_timeout'] = 'w50p';
|
||||
$table_advanced->cellclass['caption_ff_interval_timeout'][0] = 'w50p';
|
||||
|
|
|
@ -497,7 +497,12 @@ foreach ($actions as $action) {
|
|||
$pagination = '';
|
||||
if (isset($data)) {
|
||||
html_print_table($table);
|
||||
$pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', false, '');
|
||||
$show_count = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$show_count = true;
|
||||
}
|
||||
|
||||
$pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', $show_count, '');
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||
}
|
||||
|
|
|
@ -1080,7 +1080,12 @@ foreach ($commands as $command) {
|
|||
|
||||
if (isset($data) === true && count($table->data) > 0) {
|
||||
html_print_table($table);
|
||||
$pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, '');
|
||||
$show_count = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$show_count = true;
|
||||
}
|
||||
|
||||
$pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', $show_count, '');
|
||||
} else {
|
||||
ui_print_info_message(
|
||||
[
|
||||
|
|
|
@ -493,6 +493,11 @@ foreach ($templates as $template) {
|
|||
|
||||
$pagination = '';
|
||||
if (isset($data) === true) {
|
||||
$show_count = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$show_count = true;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
$pagination = ui_pagination(
|
||||
$total_templates,
|
||||
|
@ -501,7 +506,7 @@ if (isset($data) === true) {
|
|||
0,
|
||||
true,
|
||||
'offset',
|
||||
false,
|
||||
$show_count,
|
||||
''
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,17 @@ if ($multiple_delete) {
|
|||
['id_filter' => $id]
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
if ($result !== false) {
|
||||
db_process_sql_delete(
|
||||
'tfavmenu_user',
|
||||
[
|
||||
'id_element' => $id,
|
||||
'section' => 'Events',
|
||||
'id_user' => $config['id_user'],
|
||||
]
|
||||
);
|
||||
$result = true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +220,7 @@ foreach ($filters as $filter) {
|
|||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ check_login();
|
|||
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (users_is_admin($config['id_user']) === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access extensions list'
|
||||
|
|
|
@ -68,7 +68,7 @@ foreach ($layer_ids as $layer_id) {
|
|||
$layer_list[] = [
|
||||
'id' => (strpos($layer_id, 'new_') === false) ? (int) $layer_id : null,
|
||||
'layer_name' => $trimmed_name,
|
||||
'layer_visible' => ($layers[$layer_id]['visible'] === 'true'),
|
||||
'layer_visible' => ($layers[$layer_id]['visible'] == 'true' || $layers[$layer_id]['visible'] === '1'),
|
||||
'layer_group' => (int) $layers[$layer_id]['agents_from_group'],
|
||||
'layer_agent_list' => $layers[$layer_id]['agents'],
|
||||
'layer_group_list' => $layers[$layer_id]['groups'],
|
||||
|
@ -562,8 +562,6 @@ $table->data[9][1] = html_print_input_text('map_default_altitude', $map_default_
|
|||
|
||||
html_print_table($table);
|
||||
|
||||
$user_groups = users_get_groups($config['user'], 'AR', false);
|
||||
|
||||
echo '<fieldset class="margin-bottom-10"><legend>'.__('Layers').'</legend>';
|
||||
|
||||
$table->width = '100%';
|
||||
|
@ -589,7 +587,7 @@ $table->data[1][0] = '<div id="form_layer" class="invisible">
|
|||
</tr>
|
||||
<tr>
|
||||
<td>'.__('Show agents from group').':</td>
|
||||
<td colspan="3">'.html_print_select($user_groups, 'layer_group_form', '-1', '', __('none'), '-1', true).'</td>
|
||||
<td colspan="3">'.html_print_select_groups($config['id_user'], 'AR', true, 'layer_group_form', '', '', __('none'), '-1', true).'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><hr /></td>
|
||||
|
@ -923,11 +921,25 @@ function setLayerEditorData (data) {
|
|||
var $layerFormAgentsListItems = $("tr.agents_list_item");
|
||||
var $layerFormGroupsListItems = $("tr.groups_list_item");
|
||||
|
||||
$.ajax({
|
||||
url: 'ajax.php',
|
||||
data: {
|
||||
page: 'operation/gis_maps/ajax',
|
||||
opt: 'get_group_name',
|
||||
id_group: data.agentsFromGroup
|
||||
},
|
||||
type: 'POST',
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
success: function (name) {
|
||||
var newOption = new Option(name, data.agentsFromGroup, true, true);
|
||||
$layerFormAgentsFromGroupSelect.append(newOption).trigger('change');
|
||||
},
|
||||
});
|
||||
|
||||
$layerFormIdInput.val(data.id);
|
||||
$layerFormNameInput.val(data.name);
|
||||
$layerFormVisibleCheckbox.prop("checked", data.visible);
|
||||
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
|
||||
$(`#layer_group_form`).trigger('change');
|
||||
$layerFormAgentInput.val("");
|
||||
$layerFormAgentButton.prop("disabled", true);
|
||||
$layerFormAgentsListItems.remove();
|
||||
|
|
|
@ -46,6 +46,7 @@ require_once $config['homedir'].'/include/functions_alerts.php';
|
|||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_massive_operations.php';
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,12 +72,15 @@ function process_manage_delete($id_agents)
|
|||
$array_id = explode('|', $id_agent);
|
||||
try {
|
||||
$node = new Node((int) $array_id[0]);
|
||||
$node->connect();
|
||||
|
||||
$agent = new Agent((int) $array_id[1]);
|
||||
$success = $agent->delete();
|
||||
|
||||
$node->disconnect();
|
||||
$api_call_delete = $node->callApi(
|
||||
'delete_agent',
|
||||
'set',
|
||||
(int) $array_id[1],
|
||||
null,
|
||||
['2'],
|
||||
null,
|
||||
true
|
||||
);
|
||||
|
||||
$success = agent_delete_from_metaconsole(
|
||||
$array_id[1],
|
||||
|
|
|
@ -1529,7 +1529,7 @@ $array_os = [
|
|||
'windows' => __('Windows'),
|
||||
];
|
||||
$table->data[40][0] = html_print_label_input_block(
|
||||
__('rget OS'),
|
||||
__('Target OS'),
|
||||
html_print_select(
|
||||
$array_os,
|
||||
'custom_string_2',
|
||||
|
|
|
@ -770,11 +770,14 @@ $("#conf_wizard").click(function() {
|
|||
modal: {
|
||||
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||
ok: '<?php echo __('Close'); ?>'
|
||||
ok: '<?php echo __('Close wizard'); ?>',
|
||||
overlay: true,
|
||||
overlayExtraClass: 'welcome-overlay',
|
||||
},
|
||||
onshow: {
|
||||
page: 'include/ajax/welcome_window',
|
||||
method: 'loadWelcomeWindow',
|
||||
width: 1000,
|
||||
},
|
||||
oncancel: {
|
||||
page: 'include/ajax/welcome_window',
|
||||
|
@ -792,6 +795,34 @@ $("#conf_wizard").click(function() {
|
|||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onload: () => {
|
||||
$(document).ready(function () {
|
||||
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
|
||||
$(buttonpane).append(`
|
||||
<div class="welcome-wizard-buttons">
|
||||
<label>
|
||||
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
|
||||
<?php echo __('Do not show anymore'); ?>
|
||||
</label>
|
||||
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
|
||||
</div>
|
||||
`);
|
||||
|
||||
var closeWizard = $("button.close-wizard-button");
|
||||
|
||||
$(closeWizard).click(function (e) {
|
||||
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
|
||||
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
|
||||
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
|
||||
|
||||
if (checkbox === 1) {
|
||||
$(cancel).click();
|
||||
} else {
|
||||
$(close).click()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -394,11 +394,11 @@ html_print_action_buttons(
|
|||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
$(".custom_checkbox_input").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
$(".custom_checkbox_input").prop("checked", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ if (!$report_w && !$report_m) {
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
||||
ui_require_css_file('custom_graph');
|
||||
$editGraph = (bool) get_parameter('edit_graph', 0);
|
||||
$action = get_parameter('action', '');
|
||||
|
||||
|
@ -41,113 +41,6 @@ if (isset($_GET['get_agent'])) {
|
|||
}
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'sort_items':
|
||||
$resultOperationDB = null;
|
||||
$position_to_sort = (int) get_parameter('position_to_sort', 1);
|
||||
$ids_serialize = (string) get_parameter('ids_items_to_sort', '');
|
||||
$move_to = (string) get_parameter('move_to', 'after');
|
||||
|
||||
$countItems = db_get_sql(
|
||||
'
|
||||
SELECT COUNT(id_gs)
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$id_graph
|
||||
);
|
||||
|
||||
if (($countItems < $position_to_sort) || ($position_to_sort < 1)) {
|
||||
$resultOperationDB = false;
|
||||
} else if (!empty($ids_serialize)) {
|
||||
$ids = explode('|', $ids_serialize);
|
||||
$items = db_get_all_rows_sql(
|
||||
'SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$id_graph.'
|
||||
ORDER BY `field_order`'
|
||||
);
|
||||
|
||||
if ($items === false) {
|
||||
$items = [];
|
||||
}
|
||||
|
||||
|
||||
// Clean the repeated order values.
|
||||
$order_temp = 1;
|
||||
foreach ($items as $item) {
|
||||
db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['`field_order`' => $order_temp],
|
||||
['id_gs' => $item['id_rc']]
|
||||
);
|
||||
|
||||
$order_temp++;
|
||||
}
|
||||
|
||||
$items = db_get_all_rows_sql(
|
||||
'SELECT id_gs, `field_order`
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$id_graph.'
|
||||
ORDER BY `field_order`'
|
||||
);
|
||||
|
||||
if ($items === false) {
|
||||
$items = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$temp = [];
|
||||
|
||||
$temp = [];
|
||||
foreach ($items as $item) {
|
||||
// Remove the contents from the block to sort.
|
||||
if (array_search($item['id_gs'], $ids) === false) {
|
||||
$temp[$item['field_order']] = $item['id_gs'];
|
||||
}
|
||||
}
|
||||
|
||||
$items = $temp;
|
||||
|
||||
|
||||
|
||||
$sorted_items = [];
|
||||
foreach ($items as $pos => $id_unsort) {
|
||||
if ($pos == $position_to_sort) {
|
||||
if ($move_to == 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$sorted_items[] = $id;
|
||||
}
|
||||
|
||||
if ($move_to != 'after') {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
} else {
|
||||
$sorted_items[] = $id_unsort;
|
||||
}
|
||||
}
|
||||
|
||||
$items = $sorted_items;
|
||||
|
||||
|
||||
|
||||
foreach ($items as $order => $id) {
|
||||
db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['`field_order`' => ($order + 1)],
|
||||
['id_gs' => $id]
|
||||
);
|
||||
}
|
||||
|
||||
$resultOperationDB = true;
|
||||
} else {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($editGraph) {
|
||||
$graphRows = db_get_all_rows_sql(
|
||||
'SELECT t1.*,
|
||||
|
@ -257,41 +150,6 @@ $table->data[0][1] = html_print_label_input_block(
|
|||
);
|
||||
|
||||
|
||||
$SortItems = "<form action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=".$id_graph."' method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
|
||||
$SortItems .= html_print_table($table, true);
|
||||
$SortItems .= html_print_input_hidden('action', 'sort_items', true);
|
||||
$SortItems .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Sort'),
|
||||
'srcbutton',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini',
|
||||
'icon' => 'search',
|
||||
'mode' => 'secondary',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$SortItems .= '</form>';
|
||||
|
||||
ui_toggle(
|
||||
$SortItems,
|
||||
'<span class="subsection_header_title">'.__('Sort items').'</span>',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'white-box-content no_border',
|
||||
'filter-datatable-main box-flat white_table_graph max_floating_element_size'
|
||||
);
|
||||
|
||||
|
||||
// Configuration form.
|
||||
echo '<span id ="none_text" class="invisible">'.__('None').'</span>';
|
||||
echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
|
||||
|
@ -300,10 +158,11 @@ echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters
|
|||
echo '<tr>';
|
||||
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
|
||||
[
|
||||
'type' => 'select_multiple_modules_filtered',
|
||||
'uniqId' => 'modules',
|
||||
'class' => 'flex flex-row',
|
||||
'searchBar' => true,
|
||||
'type' => 'select_multiple_modules_filtered',
|
||||
'uniqId' => 'modules',
|
||||
'class' => 'flex flex-row',
|
||||
'searchBar' => false,
|
||||
'placeholderAgents' => __('Search agent name'),
|
||||
]
|
||||
).'</td>';
|
||||
echo '</tr><tr>';
|
||||
|
@ -340,6 +199,7 @@ echo '</form>';
|
|||
// Modules table.
|
||||
if ($count_module_array > 0) {
|
||||
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters info_table'>";
|
||||
echo '<thead>';
|
||||
echo '<tr>
|
||||
<th>'.__('P.').'</th>
|
||||
<th>'.__('Agent').'</th>
|
||||
|
@ -348,6 +208,8 @@ if ($count_module_array > 0) {
|
|||
<th>'.__('Weight').'</th>
|
||||
<th>'.__('Delete').'</th>
|
||||
<th>'.__('Sort').'</th>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
$color = 0;
|
||||
for ($a = 0; $a < $count_module_array; $a++) {
|
||||
// Calculate table line color.
|
||||
|
@ -359,7 +221,7 @@ if ($count_module_array > 0) {
|
|||
$color = 1;
|
||||
}
|
||||
|
||||
echo "<tr><td class='$tdcolor'>$position_array[$a]</td>";
|
||||
echo "<tr><td class='position $tdcolor'>$position_array[$a]</td>";
|
||||
echo "<td class='$tdcolor'>".$agent_array[$a].'</td>';
|
||||
echo "<td class='$tdcolor'>";
|
||||
echo modules_get_agentmodule_name($module_array[$a]).'</td>';
|
||||
|
@ -410,9 +272,30 @@ if ($count_module_array > 0) {
|
|||
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>';
|
||||
echo '<td style="display: grid;">';
|
||||
|
||||
echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true);
|
||||
echo html_print_input_image(
|
||||
'up',
|
||||
'images/arrow-up-white.png',
|
||||
'up',
|
||||
($config['style'] !== 'pandora_black') ? 'filter: invert(100%)' : '',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'onclick' => 'reorder(\'up\', \''.$idgs_array[$a].'\', this)',
|
||||
],
|
||||
);
|
||||
echo html_print_input_image(
|
||||
'down',
|
||||
'images/arrow-down-white.png',
|
||||
'down',
|
||||
($config['style'] !== 'pandora_black') ? 'filter: invert(100%)' : '',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'onclick' => 'reorder(\'down\', \''.$idgs_array[$a].'\', this)',
|
||||
]
|
||||
);
|
||||
|
||||
echo '</td>';
|
||||
|
||||
|
@ -420,6 +303,8 @@ if ($count_module_array > 0) {
|
|||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
|
@ -464,7 +349,7 @@ function added_ids_sorted_items_to_hidden_input() {
|
|||
var ids = '';
|
||||
var first = true;
|
||||
|
||||
$("input.selected_check:checked").each(function(i, val) {
|
||||
$("input.custom_checkbox_input:checked").each(function(i, val) {
|
||||
if (!first)
|
||||
ids = ids + '|';
|
||||
first = false;
|
||||
|
@ -482,4 +367,65 @@ function added_ids_sorted_items_to_hidden_input() {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reorder(action, idElement, element) {
|
||||
var tr = $(element).parent().parent();
|
||||
switch (action) {
|
||||
case "up":
|
||||
changePosition(action, idElement)
|
||||
.then((data) => {
|
||||
if(data.success) {
|
||||
$(tr).find('.position').html(parseInt($(tr).find('.position').html()) - 1);
|
||||
$($(tr).prev()).find('.position').html(parseInt($($(tr).prev()).find('.position').html()) + 1);
|
||||
$(tr).prev().insertAfter(tr);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
})
|
||||
break;
|
||||
|
||||
case "down":
|
||||
changePosition(action, idElement)
|
||||
.then((data) => {
|
||||
if(data.success) {
|
||||
$(tr).find('.position').html(parseInt($(tr).find('.position').html()) + 1);
|
||||
$($(tr).next()).find('.position').html(parseInt(($(tr).next()).find('.position').html()) - 1);
|
||||
$(tr).next().insertBefore(tr);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
})
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function changePosition(order, idElement) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "include/ajax/graph.ajax",
|
||||
sort_items: 1,
|
||||
order,
|
||||
id_graph: <?php echo $id_graph; ?>,
|
||||
id: idElement
|
||||
},
|
||||
success: function(data) {
|
||||
resolve(data);
|
||||
},
|
||||
error: function(error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -247,7 +247,7 @@ if ($add_module === true) {
|
|||
|
||||
$id_agent_modules = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
if (is_array($id_agent_modules) === true && count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
$sql_order = sprintf(
|
||||
'SELECT `field_order`
|
||||
FROM tgraph_source
|
||||
|
|
|
@ -1259,6 +1259,10 @@ switch ($action) {
|
|||
$reports_table .= html_print_table($table, true);
|
||||
$reports_table .= '<br></div>';
|
||||
echo $reports_table;
|
||||
$show_count = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$show_count = true;
|
||||
}
|
||||
|
||||
$tablePagination = ui_pagination(
|
||||
$total_reports,
|
||||
|
@ -1267,7 +1271,7 @@ switch ($action) {
|
|||
$pagination,
|
||||
true,
|
||||
'offset',
|
||||
false
|
||||
$show_count
|
||||
);
|
||||
} else {
|
||||
ui_print_info_message(
|
||||
|
|
|
@ -521,7 +521,7 @@ $(document).ready (function () {
|
|||
function (data) {
|
||||
$(".white-box-content").html(data);
|
||||
|
||||
$("#submit-add").click(function (e) {
|
||||
$("#button-add").click(function (e) {
|
||||
add_credential_boxes();
|
||||
});
|
||||
|
||||
|
@ -550,7 +550,7 @@ $(document).ready (function () {
|
|||
$(".white-box-content").html(data2);
|
||||
|
||||
// Insert credential
|
||||
$("#submit-add").click(function (e) {
|
||||
$("#button-add").click(function (e) {
|
||||
save_credential_boxes();
|
||||
})
|
||||
},
|
||||
|
@ -609,7 +609,7 @@ $(document).ready (function () {
|
|||
function (data) {
|
||||
$(".white-box-content").html(data);
|
||||
|
||||
$("#submit-update").click(function (e) {
|
||||
$("#button-update").click(function (e) {
|
||||
update_credential_boxes(datas);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -559,7 +559,7 @@ $table_cr_settings->data[4][0] = html_print_label_input_block(
|
|||
|
||||
// Print.
|
||||
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/itsm/">';
|
||||
html_print_image(
|
||||
'images/pandoraITSM_logo.png',
|
||||
false,
|
||||
|
@ -570,8 +570,8 @@ echo '<br />';
|
|||
echo '<div class="ITSM_title">';
|
||||
echo __('Pandora ITSM');
|
||||
echo '</div>';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
|
||||
echo 'https://pandorafms.com/es/itsm/';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/itsm/">';
|
||||
echo 'https://pandorafms.com/itsm/';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
|
||||
|
|
|
@ -527,9 +527,12 @@ $table->data[$i++][] = html_print_label_input_block(
|
|||
true
|
||||
)
|
||||
);
|
||||
|
||||
$help_tip = ui_print_help_tip(
|
||||
__('No events or alerts will be generated, but data will still be received.'),
|
||||
true
|
||||
);
|
||||
$table->data[$i][] = html_print_label_input_block(
|
||||
__('Event storm protection'),
|
||||
__('Event storm protection').$help_tip,
|
||||
html_print_checkbox_switch(
|
||||
'event_storm_protection',
|
||||
1,
|
||||
|
|
|
@ -424,10 +424,13 @@ if ($create_user === true) {
|
|||
$values['data_section'] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
|
||||
$values['data_section'] = $visual_console;
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER) {
|
||||
$values['data_section'] = get_parameter('data_section_other');
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section_external');
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section');
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$values['metaconsole_section'] = $values['section'];
|
||||
$values['metaconsole_data_section'] = $values['data_section'];
|
||||
}
|
||||
|
||||
// $values['section'] = $homeScreenValues[$values['section']];
|
||||
|
@ -724,10 +727,8 @@ if ($update_user) {
|
|||
$values['data_section'] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
|
||||
$values['data_section'] = $visual_console;
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER) {
|
||||
$values['data_section'] = get_parameter('data_section_other');
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section_external');
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section');
|
||||
}
|
||||
|
||||
// $values['section'] = $homeScreenValues[$values['section']];
|
||||
|
|
|
@ -689,7 +689,7 @@ foreach ($info as $user_id => $user_info) {
|
|||
// User profiles.
|
||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_sql(
|
||||
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5'
|
||||
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'"'
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
|
||||
|
@ -778,17 +778,25 @@ foreach ($info as $user_id => $user_info) {
|
|||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div class="text_end">';
|
||||
$data[4] .= '<div class="flex-column-start">';
|
||||
foreach ($user_profiles as $row) {
|
||||
$total_profile++;
|
||||
if ($total_profile > 5) {
|
||||
$data[4] .= "<div class='invisible checkhide_".str_replace(' ', '_', io_safe_output($row['id_usuario']))."'>";
|
||||
}
|
||||
|
||||
$data[4] .= "<div class='float-left'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div class='float-left pdd_l_5px'>";
|
||||
$data[4] .= ' / ';
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups(`'.$row['id_usuario'].'`)">'.html_print_image(
|
||||
if ($total_profile > 5) {
|
||||
$data[4] .= '</div>';
|
||||
}
|
||||
|
||||
if ($total_profile == 1 && count($user_profiles) > 5) {
|
||||
$data[4] .= '<span class="show-profiles" onclick="showGroups(`'.str_replace(' ', '_', io_safe_output($row['id_usuario'])).'`)">'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
|
@ -803,10 +811,6 @@ foreach ($info as $user_id => $user_info) {
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[4] .= '<br/>';
|
||||
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
if (isset($user_info['not_delete']) === true) {
|
||||
|
@ -1023,8 +1027,13 @@ foreach ($info as $user_id => $user_info) {
|
|||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
$show_count = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$show_count = true;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
$tablePagination = ui_pagination(count($info), false, 0, 0, true, 'offset', false, 'dataTables_paginate paging_simple_numbers');
|
||||
$tablePagination = ui_pagination(count($info), false, 0, 0, true, 'offset', $show_count, 'dataTables_paginate paging_simple_numbers');
|
||||
unset($table);
|
||||
if ($is_management_allowed === true) {
|
||||
if ($config['admin_can_add_user'] !== false) {
|
||||
|
@ -1052,43 +1061,13 @@ if ($is_management_allowed === true) {
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
function showGroups(id_user) {
|
||||
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') {
|
||||
var request = $.ajax({
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: 'godmode/users/user_list',
|
||||
get_user_profile_group: 1,
|
||||
id_user: id_user
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
let count = 1;
|
||||
data.forEach( function(valor, indice, array) {
|
||||
if (count >= 6) {
|
||||
let main_div = $(`#profiles_${id_user}`);
|
||||
main_div.append(
|
||||
`<div id="left_${id_user}_${count}" class='float-left'>${valor.id_perfil} / </div>`,
|
||||
`<div id="right_${id_user}_${count}" class='float-left pdd_l_5px'>${valor.id_grupo}</div>`,
|
||||
`<br/><br/>`
|
||||
);
|
||||
}
|
||||
count ++;
|
||||
});
|
||||
},
|
||||
error: function (e, textStatus) {
|
||||
console.error(textStatus);
|
||||
}
|
||||
});
|
||||
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||
$(`#profiles_${id_user}`).show();
|
||||
} else if ($(`#hidden-show_groups_${id_user}`).val() === '1') {
|
||||
$(`#hidden-show_groups_${id_user}`).val('0');
|
||||
$(`#profiles_${id_user}`).hide();
|
||||
} else {
|
||||
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||
$(`#profiles_${id_user}`).show();
|
||||
}
|
||||
$('.checkhide_'+id_user).each(function(){
|
||||
if ($(this).hasClass('invisible') === true) {
|
||||
$(this).removeClass('invisible');
|
||||
} else {
|
||||
$(this).addClass('invisible');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -84,8 +84,7 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
|
|||
// Home screen. Visual consoles.
|
||||
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
|
||||
// Home screen. External link and Other.
|
||||
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true);
|
||||
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true);
|
||||
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 400, true);
|
||||
|
||||
$layouts = visual_map_get_user_layouts($config['id_user'], true);
|
||||
$layouts_aux = [];
|
||||
|
@ -118,7 +117,7 @@ $customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
|
|||
$user_info['data_section'],
|
||||
'',
|
||||
60,
|
||||
255,
|
||||
999,
|
||||
true
|
||||
);
|
||||
$customHomeScreenDataField = '';
|
||||
|
@ -986,7 +985,7 @@ html_print_table($userManagementTable);
|
|||
|
||||
$vcard_data = [];
|
||||
$vcard_data['version'] = '3.0';
|
||||
$vcard_data['firstName'] = $user_info['fullname'];
|
||||
$vcard_data['firstName'] = io_safe_output($user_info['fullname']);
|
||||
$vcard_data['lastName'] = '';
|
||||
$vcard_data['middleName'] = '';
|
||||
$vcard_data['workPhone'] = $user_info['phone'];
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="12px" viewBox="0 0 16 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>F1630B1D-C694-489C-8C8F-E98AF57D4F04</title>
|
||||
<g id="Welcome-wizard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Pandora-FMS---Welcome-Wizard-2023---1a-Welcome-wizard" transform="translate(-905, -629)" fill="#FFFFFF">
|
||||
<g id="Popup" transform="translate(460, 200)">
|
||||
<g id="Content" transform="translate(20, 96)">
|
||||
<g id="Form" transform="translate(0, 292)">
|
||||
<g id="Principal-por-defecto" transform="translate(305, 26)">
|
||||
<g id="Group-2" transform="translate(38, 11)">
|
||||
<g id="check" transform="translate(82, 4)">
|
||||
<path d="M6,12 C5.5,12 5,11.8 4.6,11.4 L0.6,7.4 C-0.2,6.6 -0.2,5.4 0.6,4.6 C1.4,3.8 2.7,3.8 3.4,4.6 L6,7.2 L12.6,0.6 C13.4,-0.2 14.6,-0.2 15.4,0.6 C16.2,1.4 16.2,2.6 15.4,3.4 L7.4,11.4 C7,11.8 6.5,12 6,12 Z"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>F911E81E-C05E-4E17-B88A-07CFEEBD0229</title>
|
||||
<g id="Support" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Pandora-ITSM---Soporte---4d2-Contact-info-popup" transform="translate(-410, -34)">
|
||||
<g id="Content" transform="translate(10, 10)">
|
||||
<g id="popup-close" transform="translate(400, 24)">
|
||||
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
|
||||
<path d="M2.46745396,2.46745396 C3.09072592,1.84418201 4.10124942,1.84418201 4.72452137,2.46745396 L10,7.743 L15.2754786,2.46745396 C15.8987506,1.84418201 16.9092741,1.84418201 17.532546,2.46745396 C18.1168635,3.05177142 18.1533833,3.97644668 17.6421056,4.60330886 L17.532546,4.72452137 L12.257,10 L17.532546,15.2754786 L17.6421056,15.3966911 C18.1533833,16.0235533 18.1168635,16.9482286 17.532546,17.532546 C16.9092741,18.155818 15.8987506,18.155818 15.2754786,17.532546 L10,12.257 L4.72452137,17.532546 C4.10124942,18.155818 3.09072592,18.155818 2.46745396,17.532546 C1.88313651,16.9482286 1.84661667,16.0235533 2.35789444,15.3966911 L2.46745396,15.2754786 L7.743,10 L2.46745396,4.72452137 L2.35789444,4.60330886 C1.84661667,3.97644668 1.88313651,3.05177142 2.46745396,2.46745396 Z" id="Path-6" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon congrats</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#82B92E" offset="0%"></stop>
|
||||
<stop stop-color="#2EB9A2" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-congrats" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#DBEFBD"></path>
|
||||
<g id="Status-check" transform="translate(10, 10)">
|
||||
<mask id="mask-3" fill="white">
|
||||
<use xlink:href="#path-2"></use>
|
||||
</mask>
|
||||
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
|
||||
<path d="M18.7598238,0.82381606 C19.3047414,0.278898443 20.1882274,0.278898443 20.733145,0.82381606 C21.2562659,1.34693697 21.2771907,2.18208252 20.7959195,2.7301654 L20.733145,2.79713731 L9.36847673,14.1618056 C8.84535581,14.6849265 8.01021026,14.7058513 7.46212738,14.2245801 L7.39515548,14.1618056 L4.74907546,11.5157256 C4.20415784,10.9708079 4.20415784,10.0873219 4.74907546,9.54240432 C5.27219637,9.0192834 6.10734192,8.99835857 6.6554248,9.47962981 L6.72239671,9.54240432 L8.38186047,11.2018605 L18.7598238,0.82381606 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon disable</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#666666" offset="0%"></stop>
|
||||
<stop stop-color="#999999" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-disable" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
|
||||
<g id="Group">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#EAEAEA"></path>
|
||||
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
|
||||
</g>
|
||||
<rect id="Rectangle" fill="#FFFFFF" x="14" y="19" width="12" height="3" rx="1"></rect>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon error</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#F72222" offset="0%"></stop>
|
||||
<stop stop-color="#E12D81" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-error" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FBDADA"></path>
|
||||
<g id="Path" transform="translate(10, 10)">
|
||||
<mask id="mask-3" fill="white">
|
||||
<use xlink:href="#path-2"></use>
|
||||
</mask>
|
||||
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
|
||||
<path d="M8.29983345,6.3436419 L8.36636552,6.40600414 L10.0000673,8.03953994 L11.6336345,6.40600414 C12.1749733,5.86466529 13.052657,5.86466529 13.5939959,6.40600414 C14.1136812,6.92568943 14.1344686,7.75535013 13.6563581,8.29983345 L13.5939959,8.36636552 L11.9605948,10.0000673 L13.5939959,11.6336345 C14.1353347,12.1749733 14.1353347,13.052657 13.5939959,13.5939959 C13.0743106,14.1136812 12.2446499,14.1344686 11.7001665,13.6563581 L11.6336345,13.5939959 L10.0000673,11.9605948 L8.36636552,13.5939959 C7.82502667,14.1353347 6.94734298,14.1353347 6.40600414,13.5939959 C5.88631884,13.0743106 5.86553143,12.2446499 6.3436419,11.7001665 L6.40600414,11.6336345 L8.03953994,10.0000673 L6.40600414,8.36636552 C5.86466529,7.82502667 5.86466529,6.94734298 6.40600414,6.40600414 C6.90403588,5.9079724 7.68674989,5.86812986 8.23033079,6.28647652 L8.29983345,6.3436419 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon favorite</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#814CCB" offset="0%"></stop>
|
||||
<stop stop-color="#B66BD9" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-favorite" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
|
||||
<g id="Status-check" transform="translate(10, 10)">
|
||||
<mask id="mask-3" fill="white">
|
||||
<use xlink:href="#path-2"></use>
|
||||
</mask>
|
||||
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
|
||||
<path d="M14.2568899,6.39303483 C13.7790757,5.7960199 13.0840733,5.44776119 12.3890709,5.39800995 L12.3021956,5.39800995 C11.4334425,5.39800995 10.6515648,5.89552239 10.130313,6.69154229 C9.65249878,5.64676617 8.74030808,5 7.74124208,5 C7.74124208,5 7.69780443,5 7.69780443,5 C6.95936434,5 6.22092425,5.34825871 5.74311008,5.99502488 C5.22185825,6.5920398 4.96123233,7.43781095 5.00466999,8.28358209 C5.09154529,9.7761194 5.74311008,10.5223881 6.35123721,11.1691542 C7.04623964,11.9651741 7.69780443,12.6119403 7.48061617,14.5024876 C7.48061617,14.800995 7.61092912,15 7.82811739,15 C7.91499269,15 7.95843034,15 8.0887433,14.9502488 C12.6062591,13.358209 14.99533,11.2189055 14.99533,8.83084577 L14.99533,8.78109453 C15.0387677,7.8358209 14.7781418,7.039801 14.2568899,6.39303483 Z M7.82811739,14.7014925 L7.82811739,14.4527363 C7.82811739,14.4527363 7.82811739,14.4527363 7.82811739,14.4527363 L7.82811739,14.7014925 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon heads up</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#FAD961" offset="0%"></stop>
|
||||
<stop stop-color="#F5A623" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-heads-up" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FFEDCF"></path>
|
||||
<g id="Status-check" transform="translate(10, 10)">
|
||||
<mask id="mask-3" fill="white">
|
||||
<use xlink:href="#path-2"></use>
|
||||
</mask>
|
||||
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
|
||||
<path d="M8.00083253,4.5536125 L8.34039759,10.5036125 C8.3562818,10.7820375 8.59715418,11 8.88888351,11 L11.1111166,11 C11.402846,11 11.6437183,10.7820375 11.6596026,10.5036125 L11.9991676,4.5536125 C12.0163335,4.252875 11.7658025,4 11.4506817,4 L8.54927267,4 C8.2341519,4 7.98366659,4.252875 8.00083253,4.5536125 L8.00083253,4.5536125 Z M10,12 C8.89543478,12 8,12.8954348 8,14 C8,15.1045652 8.89543478,16 10,16 C11.1045652,16 12,15.1045652 12,14 C12,12.8954348 11.1045652,12 10,12 Z" id="Path-4" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon information</title>
|
||||
<defs>
|
||||
<linearGradient x1="0%" y1="50%" x2="100%" y2="0%" id="linearGradient-1">
|
||||
<stop stop-color="#0086FF" offset="0%"></stop>
|
||||
<stop stop-color="#004EFF" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-information" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#D6E2FF"></path>
|
||||
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
|
||||
<path d="M22.5713807,24.7563706 C22.5312282,24.8064951 21.5738418,26 19.9765248,26 C19.9125317,26 19.8472839,25.9986453 19.7832908,25.9945811 C19.1458697,25.9539397 18.618868,25.6491285 18.2963932,25.1356911 C17.9011419,24.5057481 17.847187,23.6278921 18.1445665,22.6633342 L18.6540015,21.0092259 C18.9363238,20.0839548 18.6665491,19.9362907 18.5209963,19.8577172 C18.4820985,19.8360417 18.420615,19.8238493 18.345329,19.8238493 C18.0303828,19.8238493 17.5962338,20.0243473 17.4569548,20.1029208 C17.3264591,20.1760755 17.1620848,20.1381434 17.0667225,20.0121548 C16.9751246,19.8834568 16.9776342,19.7046343 17.0755059,19.5813551 C17.1169132,19.5285212 18.163388,18.2334126 19.8648506,18.3431446 C20.4985074,18.3824313 21.0255091,18.6858877 21.3479839,19.1979704 C21.74449,19.8279134 21.7996997,20.7071242 21.5035749,21.6743915 L20.9941399,23.3284998 C20.7093081,24.2524162 20.9815923,24.401435 21.1271451,24.4800085 C21.1522405,24.4935557 21.2049406,24.511167 21.2990481,24.511167 C21.6177586,24.511167 22.0519076,24.310669 22.1924414,24.2334502 C22.3254466,24.1575861 22.4873114,24.1982276 22.5814189,24.3255709 C22.671762,24.4542689 22.6692525,24.6330914 22.5713807,24.7563706 Z M20.2693902,14 C21.2410593,14.0022763 22.0318205,14.7944306 22.0340961,15.7641368 C22.0340961,16.7349811 21.2433349,17.5271355 20.270528,17.5294118 C19.2988589,17.5271355 18.5069599,16.7349811 18.5046843,15.765275 C18.5046843,14.7921543 19.2965833,14 20.2693902,14 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon popular</title>
|
||||
<defs>
|
||||
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
|
||||
<stop stop-color="#E4EE3B" offset="0%"></stop>
|
||||
<stop stop-color="#DFAA1E" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-popular" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
|
||||
<g id="Group">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FFFAB8"></path>
|
||||
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
|
||||
<path d="M24.9626788,18.7571206 C24.8787507,18.5056935 24.6666091,18.3253374 24.4094678,18.2860519 L21.7991261,17.8949828 L20.6241331,15.4007119 C20.5073481,15.1535705 20.2684209,15 20.0002082,15 C19.7319955,15 19.4930684,15.1535705 19.3762834,15.4007119 L18.2184331,17.8860543 L15.5909487,18.2860519 C15.3338073,18.3253374 15.1220229,18.5056935 15.0377377,18.7571206 C14.9516667,19.0153333 15.0152378,19.2953317 15.2038081,19.4878305 L17.104154,21.432819 L16.6552281,24.1742313 C16.6105855,24.4481583 16.7212991,24.716371 16.9448692,24.87387 C17.1598679,25.0263691 17.4362949,25.041369 17.6662935,24.9145841 L19.9837798,23.620306 L22.334123,24.9145841 C22.5648359,25.041369 22.8405485,25.0256548 23.0555472,24.87387 C23.2791174,24.716371 23.3901881,24.4481583 23.3451884,24.1742313 L22.8955482,21.4292476 L24.7966084,19.4878305 C24.9851787,19.2953317 25.0487497,19.0153333 24.9626788,18.7571206 Z" id="XMLID_328_" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/40/Alert icon question</title>
|
||||
<defs>
|
||||
<linearGradient x1="0%" y1="50%" x2="100%" y2="0%" id="linearGradient-1">
|
||||
<stop stop-color="#3F5393" offset="0%"></stop>
|
||||
<stop stop-color="#1F76B7" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Icons/Dark/40/Alert-icon-question" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
|
||||
<g id="Group">
|
||||
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E2E7F3"></path>
|
||||
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
|
||||
<path d="M22.5458333,19.7352941 L20.6666667,20.9705882 L20.6666667,21.0588235 C20.6666667,21.6323529 20.2083333,22.1176471 19.6666667,22.1176471 C19.125,22.1176471 18.6666667,21.6323529 18.6666667,21.0588235 L18.6666667,20.3529412 C18.6666667,20 18.8333333,19.6470588 19.1666667,19.4264706 L21.5416667,17.9264706 C21.8333333,17.75 22,17.4411765 22,17.0882353 C22,16.5588235 21.5458333,16.1176471 21.0458333,16.1176471 L18.9166667,16.1176471 C18.3791667,16.1176471 18,16.5588235 18,17.0882353 C18,17.6617647 17.5416667,18.1470588 17,18.1470588 C16.4583333,18.1470588 16,17.6617647 16,17.0882353 C16,15.3676471 17.2916667,14 18.8791667,14 L21.0083333,14 C22.7083333,14 24,15.3676471 24,17.0882353 C24,18.1470588 23.4583333,19.1617647 22.5458333,19.7352941 Z M19.6666667,26 C18.9166667,26 18.3333333,25.3823529 18.3333333,24.5882353 C18.3333333,23.7941176 18.8791667,23.1764706 19.6666667,23.1764706 C20.3791667,23.1764706 21,23.7941176 21,24.5882353 C21,25.3823529 20.3791667,26 19.6666667,26 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 246 KiB |
|
@ -39,6 +39,7 @@ $get_agent_filters = get_parameter('get_agent_filters', 0);
|
|||
$save_agent_filter = get_parameter('save_agent_filter', 0);
|
||||
$update_agent_filter = get_parameter('update_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()) {
|
||||
header('Content-type: application/json');
|
||||
|
@ -1020,4 +1021,29 @@ $(document).ready(function() {
|
|||
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;
|
||||
|
|
|
@ -41,7 +41,20 @@ if ($method === 'draw') {
|
|||
$length = get_parameter('length', $config['block_size']);
|
||||
$orderBy = get_datatable_order(true);
|
||||
|
||||
$sort_field = $orderBy['field'];
|
||||
switch ($orderBy['field']) {
|
||||
case 'groups':
|
||||
$sort_field = 'nombre';
|
||||
break;
|
||||
|
||||
case 'favorite':
|
||||
$sort_field = 'active';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sort_field = $orderBy['field'];
|
||||
break;
|
||||
}
|
||||
|
||||
$order = $orderBy['direction'];
|
||||
|
||||
$pagination = '';
|
||||
|
@ -121,7 +134,7 @@ if ($method === 'draw') {
|
|||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination;
|
||||
$sql = 'SELECT * FROM tdashboard LEFT JOIN tgrupo ON tgrupo.id_grupo = tdashboard.id_group '.$where.' ORDER BY '.$sort_field.' '.$order.$pagination;
|
||||
$dashboards = db_get_all_rows_sql($sql);
|
||||
$count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where);
|
||||
foreach ($dashboards as $dashboard) {
|
||||
|
|
|
@ -98,6 +98,8 @@ $draw_events_graph = get_parameter('drawEventsGraph', false);
|
|||
// User private filter.
|
||||
$current_filter = get_parameter('current_filter', 0);
|
||||
$private_filter_event = get_parameter('private_filter_event', 0);
|
||||
// Asteroids.
|
||||
$playAsteroids = (bool) get_parameter('playAsteroids', false);
|
||||
|
||||
if ($get_comments === true) {
|
||||
global $config;
|
||||
|
@ -2763,6 +2765,17 @@ if ($draw_row_response_info === true) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Asteroids.
|
||||
if ($playAsteroids === true) {
|
||||
echo ui_require_css_file('asteroids', 'include/styles/', true);
|
||||
echo ui_require_javascript_file('asteroids', 'include/asteroids/', true);
|
||||
|
||||
$output = '<div id="asteroids">Asteroids game goes here!</div>';
|
||||
|
||||
echo $output;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($update_event_custom_id) {
|
||||
$event_custom_id = get_parameter('event_custom_id');
|
||||
$event_id = get_parameter('event_id');
|
||||
|
@ -2814,4 +2827,4 @@ if ((bool) $draw_events_graph === true) {
|
|||
$output = event_print_graph($filter);
|
||||
echo $output;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph');
|
|||
$print_custom_graph = (bool) get_parameter('print_custom_graph', false);
|
||||
$print_sparse_graph = (bool) get_parameter('print_sparse_graph');
|
||||
$get_graphs = (bool) get_parameter('get_graphs_container');
|
||||
$sort_items = (bool) get_parameter('sort_items');
|
||||
|
||||
$width = get_parameter('width', 0);
|
||||
$height = get_parameter('height', 0);
|
||||
|
||||
|
@ -337,3 +339,104 @@ if ($get_graphs) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($sort_items === true) {
|
||||
$order = (string) get_parameter('order');
|
||||
$id = (string) get_parameter('id', '');
|
||||
$idGraph = (string) get_parameter('id_graph', '');
|
||||
$total = db_get_num_rows('SELECT * FROM tgraph_source WHERE id_graph = '.$idGraph.'');
|
||||
$item = db_get_row_sql(
|
||||
'SELECT id_gs, field_order
|
||||
FROM tgraph_source
|
||||
WHERE id_gs = '.$id.'
|
||||
ORDER BY field_order'
|
||||
);
|
||||
|
||||
switch ($order) {
|
||||
case 'up':
|
||||
if (($item['field_order'] - 1) < 1) {
|
||||
echo json_encode(['success' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
$prevItem = db_get_row_sql(
|
||||
'SELECT id_gs, field_order
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$idGraph.'
|
||||
AND field_order = '.($item['field_order'] - 1).'
|
||||
ORDER BY field_order'
|
||||
);
|
||||
|
||||
db_process_sql_begin();
|
||||
|
||||
$resultItem = db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['field_order' => ($item['field_order'] - 1)],
|
||||
['id_gs' => $item['id_gs']],
|
||||
false
|
||||
);
|
||||
$resultPrevItem = db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['field_order' => ($prevItem['field_order'] + 1)],
|
||||
['id_gs' => $prevItem['id_gs']],
|
||||
false
|
||||
);
|
||||
|
||||
if ($resultItem !== false && $resultPrevItem !== false) {
|
||||
db_process_sql_commit();
|
||||
echo json_encode(['success' => true]);
|
||||
return;
|
||||
} else {
|
||||
db_process_sql_rollback();
|
||||
echo json_encode(['success' => false]);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
if (($item['field_order'] + 1) > $total) {
|
||||
echo json_encode(['success' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
$nextItem = db_get_row_sql(
|
||||
'SELECT id_gs, field_order
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = '.$idGraph.'
|
||||
AND field_order = '.($item['field_order'] + 1).'
|
||||
ORDER BY field_order'
|
||||
);
|
||||
|
||||
|
||||
db_process_sql_begin();
|
||||
|
||||
$resultItem = db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['field_order' => ($item['field_order'] + 1)],
|
||||
['id_gs' => $item['id_gs']],
|
||||
false
|
||||
);
|
||||
$resultNextItem = db_process_sql_update(
|
||||
'tgraph_source',
|
||||
['field_order' => ($nextItem['field_order'] - 1)],
|
||||
['id_gs' => $nextItem['id_gs']],
|
||||
false
|
||||
);
|
||||
|
||||
if ($resultItem !== false && $resultNextItem !== false) {
|
||||
db_process_sql_commit();
|
||||
echo json_encode(['success' => true]);
|
||||
return;
|
||||
} else {
|
||||
db_process_sql_rollback();
|
||||
echo json_encode(['success' => false]);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
echo json_encode(['success' => false]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
Copyright (c) 2023, James Socol <me@jamessocol.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
=========
|
||||
ASTEROIDS
|
||||
=========
|
||||
|
||||
Last week, at work, we joked about creating an Asteroids clone where every
|
||||
asteroid had a bug number in it, as a bit of a joke. (Ha ha, every bug you
|
||||
kill spawns two more!)
|
||||
|
||||
I was bored this afternoon, so here's a port of Asteroids to JS/Canvas.
|
||||
|
||||
Now all I need to do is hook in the bug numbers.
|
||||
|
||||
|
||||
Gameplay
|
||||
========
|
||||
|
||||
You're the triangle in the middle. You want to destroy the circles. You have
|
||||
a gun (spacebar), some thrusters to turn (left and right arrow keys) and an
|
||||
engine (up arrow key).
|
||||
|
||||
Remember, it's kill or be killed out there.
|
||||
|
||||
|
||||
Rights
|
||||
======
|
||||
|
||||
The name *Asteroids* is, as far as I know, still property of Atari. I mean no
|
||||
ill-will towards Atari by releasing this code. Frankly, it's a poor
|
||||
substitute for anything resembling a real game. I just wanted to see if I
|
||||
could do it.
|
||||
|
||||
If anyone from Atari asks, I will gladly rename and/or remove this code. But
|
||||
since there are so many *Asteroids* clones as it is, and the original was
|
||||
released in 1979, and it was kind of a copy of *Spacewar!*, I doubt they'll
|
||||
mind too much.
|
||||
|
||||
|
||||
Strikes me as funny...
|
||||
======================
|
||||
|
||||
The original *Spacewar!*, one of the earliest (if not the original) computer
|
||||
games, took `200 hours to code <http://en.wikipedia.org/wiki/Spacewar!>`_.
|
||||
|
||||
This probably took me 6.
|
||||
|
||||
I am so glad we've moved past the PDP-1.
|
|
@ -0,0 +1,840 @@
|
|||
// Asteroids.js
|
||||
// Copyright (c) 2010–2023 James Socol <me@jamessocol.com>
|
||||
// See LICENSE.txt for license terms.
|
||||
|
||||
// Game settings
|
||||
GAME_HEIGHT = 480;
|
||||
GAME_WIDTH = 640;
|
||||
FRAME_PERIOD = 60; // 1 frame / x frames/sec
|
||||
LEVEL_TIMEOUT = 2000; // How long to wait after clearing a level.
|
||||
|
||||
// Player settings
|
||||
ROTATE_SPEED = Math.PI / 10; // How fast do players turn? (radians)
|
||||
MAX_SPEED = 15; // Maximum player speed
|
||||
THRUST_ACCEL = 1;
|
||||
DEATH_TIMEOUT = 2000; // milliseconds
|
||||
INVINCIBLE_TIMEOUT = 1500; // How long to stay invincible after resurrecting?
|
||||
PLAYER_LIVES = 3;
|
||||
POINTS_PER_SHOT = 1; // How many points does a shot cost? (Should be >= 0.)
|
||||
POINTS_TO_EXTRA_LIFE = 1000; // How many points to get a 1-up?
|
||||
|
||||
// Bullet settings
|
||||
BULLET_SPEED = 20;
|
||||
MAX_BULLETS = 3;
|
||||
MAX_BULLET_AGE = 25;
|
||||
|
||||
// Asteroid settings
|
||||
ASTEROID_COUNT = 2; // This + current level = number of asteroids.
|
||||
ASTEROID_GENERATIONS = 3; // How many times to they split before dying?
|
||||
ASTEROID_CHILDREN = 2; // How many does each death create?
|
||||
ASTEROID_SPEED = 3;
|
||||
ASTEROID_SCORE = 10; // How many points is each one worth?
|
||||
|
||||
var Asteroids = function(home) {
|
||||
// Constructor
|
||||
// Order matters.
|
||||
|
||||
// Set up logging.
|
||||
this.log_level = Asteroids.LOG_DEBUG;
|
||||
this.log = Asteroids.logger(this);
|
||||
|
||||
// Create the info pane, player, and playfield.
|
||||
home.innerHTML = "";
|
||||
this.info = Asteroids.infoPane(this, home);
|
||||
this.playfield = Asteroids.playfield(this, home);
|
||||
this.player = Asteroids.player(this);
|
||||
|
||||
// Set up the event listeners.
|
||||
this.keyState = Asteroids.keyState(this);
|
||||
this.listen = Asteroids.listen(this);
|
||||
|
||||
// Useful functions.
|
||||
this.asteroids = Asteroids.asteroids(this);
|
||||
this.overlays = Asteroids.overlays(this);
|
||||
this.highScores = Asteroids.highScores(this);
|
||||
this.level = Asteroids.level(this);
|
||||
this.gameOver = Asteroids.gameOver(this);
|
||||
|
||||
// Play the game.
|
||||
Asteroids.play(this);
|
||||
return this;
|
||||
};
|
||||
|
||||
Asteroids.infoPane = function(game, home) {
|
||||
var pane = document.createElement("div");
|
||||
pane.innerHTML = "ASTEROIDS";
|
||||
|
||||
var lives = document.createElement("span");
|
||||
lives.className = "lives";
|
||||
lives.innerHTML = "LIVES: " + PLAYER_LIVES;
|
||||
|
||||
var score = document.createElement("span");
|
||||
score.className = "score";
|
||||
score.innerHTML = "SCORE: 0";
|
||||
|
||||
var level = document.createElement("span");
|
||||
level.className = "level";
|
||||
level.innerHTML = "LEVEL: 1";
|
||||
|
||||
pane.appendChild(lives);
|
||||
pane.appendChild(score);
|
||||
pane.appendChild(level);
|
||||
home.appendChild(pane);
|
||||
|
||||
return {
|
||||
setLives: function(game, l) {
|
||||
lives.innerHTML = "LIVES: " + l;
|
||||
},
|
||||
setScore: function(game, s) {
|
||||
score.innerHTML = "SCORE: " + s;
|
||||
},
|
||||
setLevel: function(game, _level) {
|
||||
level.innerHTML = "LEVEL: " + _level;
|
||||
},
|
||||
getPane: function() {
|
||||
return pane;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.playfield = function(game, home) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = GAME_WIDTH;
|
||||
canvas.height = GAME_HEIGHT;
|
||||
home.appendChild(canvas);
|
||||
return canvas;
|
||||
};
|
||||
|
||||
Asteroids.logger = function(game) {
|
||||
if (typeof console != "undefined" && typeof console.log != "undefined") {
|
||||
return {
|
||||
info: function(msg) {
|
||||
if (game.log_level <= Asteroids.LOG_INFO) console.log(msg);
|
||||
},
|
||||
debug: function(msg) {
|
||||
if (game.log_level <= Asteroids.LOG_DEBUG) console.log(msg);
|
||||
},
|
||||
warning: function(msg) {
|
||||
if (game.log_level <= Asteroids.LOG_WARNING) console.log(msg);
|
||||
},
|
||||
error: function(msg) {
|
||||
if (game.log_level <= Asteroids.LOG_ERROR) console.log(msg);
|
||||
},
|
||||
critical: function(msg) {
|
||||
if (game.log_level <= Asteroids.LOG_CRITICAL) console.log(msg);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
info: function(msg) {},
|
||||
debug: function(msg) {},
|
||||
warning: function(msg) {},
|
||||
error: function(msg) {},
|
||||
critical: function(msg) {}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Asteroids.asteroids = function(game) {
|
||||
var asteroids = [];
|
||||
|
||||
return {
|
||||
push: function(obj) {
|
||||
return asteroids.push(obj);
|
||||
},
|
||||
pop: function() {
|
||||
return asteroids.pop();
|
||||
},
|
||||
splice: function(i, j) {
|
||||
return asteroids.splice(i, j);
|
||||
},
|
||||
get length() {
|
||||
return asteroids.length;
|
||||
},
|
||||
getIterator: function() {
|
||||
return asteroids;
|
||||
},
|
||||
generationCount: function(_gen) {
|
||||
var total = 0;
|
||||
for (var i = 0; i < asteroids.length; i++) {
|
||||
if (asteroids[i].getGeneration() == _gen) total++;
|
||||
}
|
||||
game.log.debug("Found " + total + " asteroids in generation " + _gen);
|
||||
return total;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an overlays controller.
|
||||
*/
|
||||
Asteroids.overlays = function(game) {
|
||||
var overlays = [];
|
||||
|
||||
return {
|
||||
draw: function(ctx) {
|
||||
for (var i = 0; i < overlays.length; i++) {
|
||||
overlays[i].draw(ctx);
|
||||
}
|
||||
},
|
||||
add: function(obj) {
|
||||
if (-1 == overlays.indexOf(obj) && typeof obj.draw != "undefined") {
|
||||
overlays.push(obj);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
remove: function(obj) {
|
||||
var i = overlays.indexOf(obj);
|
||||
if (-1 != i) {
|
||||
overlays.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a player object.
|
||||
*/
|
||||
Asteroids.player = function(game) {
|
||||
// implements IScreenObject
|
||||
var position = [GAME_WIDTH / 2, GAME_HEIGHT / 2],
|
||||
velocity = [0, 0],
|
||||
direction = -Math.PI / 2,
|
||||
dead = false,
|
||||
invincible = false,
|
||||
lastRez = null,
|
||||
lives = PLAYER_LIVES,
|
||||
score = 0,
|
||||
radius = 3,
|
||||
path = [
|
||||
[10, 0],
|
||||
[-5, 5],
|
||||
[-5, -5],
|
||||
[10, 0]
|
||||
];
|
||||
|
||||
return {
|
||||
getPosition: function() {
|
||||
return position;
|
||||
},
|
||||
getVelocity: function() {
|
||||
return velocity;
|
||||
},
|
||||
getSpeed: function() {
|
||||
return Math.sqrt(Math.pow(velocity[0], 2) + Math.pow(velocity[1], 2));
|
||||
},
|
||||
getDirection: function() {
|
||||
return direction;
|
||||
},
|
||||
getRadius: function() {
|
||||
return radius;
|
||||
},
|
||||
getScore: function() {
|
||||
return score;
|
||||
},
|
||||
addScore: function(pts) {
|
||||
score += pts;
|
||||
},
|
||||
lowerScore: function(pts) {
|
||||
score -= pts;
|
||||
if (score < 0) {
|
||||
score = 0;
|
||||
}
|
||||
},
|
||||
getLives: function() {
|
||||
return lives;
|
||||
},
|
||||
rotate: function(rad) {
|
||||
if (!dead) {
|
||||
direction += rad;
|
||||
game.log.info(direction);
|
||||
}
|
||||
},
|
||||
thrust: function(force) {
|
||||
if (!dead) {
|
||||
velocity[0] += force * Math.cos(direction);
|
||||
velocity[1] += force * Math.sin(direction);
|
||||
|
||||
if (this.getSpeed() > MAX_SPEED) {
|
||||
velocity[0] = MAX_SPEED * Math.cos(direction);
|
||||
velocity[1] = MAX_SPEED * Math.sin(direction);
|
||||
}
|
||||
|
||||
game.log.info(velocity);
|
||||
}
|
||||
},
|
||||
move: function() {
|
||||
Asteroids.move(position, velocity);
|
||||
},
|
||||
draw: function(ctx) {
|
||||
let color = "#fff";
|
||||
if (invincible) {
|
||||
const dt = (new Date() - lastRez) / 200;
|
||||
const c = Math.floor(Math.cos(dt) * 16).toString(16);
|
||||
color = `#${c}${c}${c}`;
|
||||
}
|
||||
Asteroids.drawPath(ctx, position, direction, 1, path, color);
|
||||
},
|
||||
isDead: function() {
|
||||
return dead;
|
||||
},
|
||||
isInvincible: function() {
|
||||
return invincible;
|
||||
},
|
||||
extraLife: function(game) {
|
||||
game.log.debug("Woo, extra life!");
|
||||
lives++;
|
||||
},
|
||||
die: function(game) {
|
||||
if (!dead) {
|
||||
game.log.info("You died!");
|
||||
dead = true;
|
||||
invincible = true;
|
||||
lives--;
|
||||
position = [GAME_WIDTH / 2, GAME_HEIGHT / 2];
|
||||
velocity = [0, 0];
|
||||
direction = -Math.PI / 2;
|
||||
if (lives > 0) {
|
||||
setTimeout(
|
||||
(function(player, _game) {
|
||||
return function() {
|
||||
player.resurrect(_game);
|
||||
};
|
||||
})(this, game),
|
||||
DEATH_TIMEOUT
|
||||
);
|
||||
} else {
|
||||
game.gameOver();
|
||||
}
|
||||
}
|
||||
},
|
||||
resurrect: function(game) {
|
||||
if (dead) {
|
||||
dead = false;
|
||||
invincible = true;
|
||||
lastRez = new Date();
|
||||
setTimeout(function() {
|
||||
invincible = false;
|
||||
game.log.debug("No longer invincible!");
|
||||
}, INVINCIBLE_TIMEOUT);
|
||||
game.log.debug("You ressurrected!");
|
||||
}
|
||||
},
|
||||
fire: function(game) {
|
||||
if (!dead) {
|
||||
game.log.debug("You fired!");
|
||||
var _pos = [position[0], position[1]],
|
||||
_dir = direction;
|
||||
|
||||
this.lowerScore(POINTS_PER_SHOT);
|
||||
|
||||
return Asteroids.bullet(game, _pos, _dir);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.bullet = function(game, _pos, _dir) {
|
||||
// implements IScreenObject
|
||||
var position = [_pos[0], _pos[1]],
|
||||
velocity = [0, 0],
|
||||
direction = _dir,
|
||||
age = 0,
|
||||
radius = 1,
|
||||
path = [
|
||||
[0, 0],
|
||||
[-4, 0]
|
||||
];
|
||||
|
||||
velocity[0] = BULLET_SPEED * Math.cos(_dir);
|
||||
velocity[1] = BULLET_SPEED * Math.sin(_dir);
|
||||
|
||||
return {
|
||||
getPosition: function() {
|
||||
return position;
|
||||
},
|
||||
getVelocity: function() {
|
||||
return velocity;
|
||||
},
|
||||
getSpeed: function() {
|
||||
return Math.sqrt(Math.pow(velocity[0], 2) + Math.pow(velocity[1], 2));
|
||||
},
|
||||
getRadius: function() {
|
||||
return radius;
|
||||
},
|
||||
getAge: function() {
|
||||
return age;
|
||||
},
|
||||
birthday: function() {
|
||||
age++;
|
||||
},
|
||||
move: function() {
|
||||
Asteroids.move(position, velocity);
|
||||
},
|
||||
draw: function(ctx) {
|
||||
Asteroids.drawPath(ctx, position, direction, 1, path);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.keyState = function(_) {
|
||||
var state = {
|
||||
[Asteroids.LEFT]: false,
|
||||
[Asteroids.UP]: false,
|
||||
[Asteroids.RIGHT]: false,
|
||||
[Asteroids.DOWN]: false,
|
||||
[Asteroids.FIRE]: false
|
||||
};
|
||||
|
||||
return {
|
||||
on: function(key) {
|
||||
state[key] = true;
|
||||
},
|
||||
off: function(key) {
|
||||
state[key] = false;
|
||||
},
|
||||
getState: function(key) {
|
||||
if (typeof state[key] != "undefined") return state[key];
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.listen = function(game) {
|
||||
const keyMap = {
|
||||
ArrowLeft: Asteroids.LEFT,
|
||||
KeyA: Asteroids.LEFT,
|
||||
ArrowRight: Asteroids.RIGHT,
|
||||
KeyD: Asteroids.RIGHT,
|
||||
ArrowUp: Asteroids.UP,
|
||||
KeyW: Asteroids.UP,
|
||||
Space: Asteroids.FIRE
|
||||
};
|
||||
|
||||
window.addEventListener(
|
||||
"keydown",
|
||||
function(e) {
|
||||
const state = keyMap[e.code];
|
||||
if (state) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
game.keyState.on(state);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
window.addEventListener(
|
||||
"keyup",
|
||||
function(e) {
|
||||
const state = keyMap[e.code];
|
||||
if (state) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
game.keyState.off(state);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
Asteroids.asteroid = function(game, _gen) {
|
||||
// implements IScreenObject
|
||||
var position = [0, 0],
|
||||
velocity = [0, 0],
|
||||
direction = 0,
|
||||
generation = _gen,
|
||||
radius = 7,
|
||||
path = [
|
||||
[1, 7],
|
||||
[5, 5],
|
||||
[7, 1],
|
||||
[5, -3],
|
||||
[7, -7],
|
||||
[3, -9],
|
||||
[-1, -5],
|
||||
[-4, -2],
|
||||
[-8, -1],
|
||||
[-9, 3],
|
||||
[-5, 5],
|
||||
[-1, 3],
|
||||
[1, 7]
|
||||
];
|
||||
|
||||
return {
|
||||
getPosition: function() {
|
||||
return position;
|
||||
},
|
||||
setPosition: function(pos) {
|
||||
position = pos;
|
||||
},
|
||||
getVelocity: function() {
|
||||
return velocity;
|
||||
},
|
||||
setVelocity: function(vel) {
|
||||
velocity = vel;
|
||||
direction = Math.atan2(vel[1], vel[0]);
|
||||
},
|
||||
getSpeed: function() {
|
||||
return Math.sqrt(Math.pow(velocity[0], 2) + Math.pow(velocity[1], 2));
|
||||
},
|
||||
getRadius: function() {
|
||||
return radius * generation;
|
||||
},
|
||||
getGeneration: function() {
|
||||
return generation;
|
||||
},
|
||||
move: function() {
|
||||
Asteroids.move(position, velocity);
|
||||
},
|
||||
draw: function(ctx) {
|
||||
Asteroids.drawPath(ctx, position, direction, generation, path);
|
||||
// ctx.setTransform(1, 0, 0, 1, position[0], position[1]);
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(0, 0, radius*generation, 0, Math.PI*2, false);
|
||||
// ctx.stroke();
|
||||
// ctx.closePath();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.collision = function(a, b) {
|
||||
// if a.getPosition() inside b.getBounds?
|
||||
var a_pos = a.getPosition(),
|
||||
b_pos = b.getPosition();
|
||||
|
||||
function sq(x) {
|
||||
return Math.pow(x, 2);
|
||||
}
|
||||
|
||||
var distance = Math.sqrt(sq(a_pos[0] - b_pos[0]) + sq(a_pos[1] - b_pos[1]));
|
||||
|
||||
if (distance <= a.getRadius() + b.getRadius()) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
Asteroids.level = function(game) {
|
||||
var level = 0,
|
||||
speed = ASTEROID_SPEED,
|
||||
hspeed = ASTEROID_SPEED / 2;
|
||||
|
||||
return {
|
||||
getLevel: function() {
|
||||
return level;
|
||||
},
|
||||
levelUp: function(game) {
|
||||
level++;
|
||||
game.log.debug("Congrats! On to level " + level);
|
||||
while (
|
||||
game.asteroids.generationCount(ASTEROID_GENERATIONS) <
|
||||
level + ASTEROID_COUNT
|
||||
) {
|
||||
var a = Asteroids.asteroid(game, ASTEROID_GENERATIONS);
|
||||
a.setPosition([
|
||||
Math.random() * GAME_WIDTH,
|
||||
Math.random() * GAME_HEIGHT
|
||||
]);
|
||||
a.setVelocity([
|
||||
Math.random() * speed - hspeed,
|
||||
Math.random() * speed - hspeed
|
||||
]);
|
||||
game.asteroids.push(a);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.gameOver = function(game) {
|
||||
return function() {
|
||||
game.log.debug("Game over!");
|
||||
|
||||
if (game.player.getScore() > 0) {
|
||||
game.highScores.addScore("Player", game.player.getScore());
|
||||
}
|
||||
|
||||
game.overlays.add({
|
||||
// implements IOverlay
|
||||
draw: function(ctx) {
|
||||
ctx.font = "30px System, monospace";
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.fillText("GAME OVER", GAME_WIDTH / 2, GAME_HEIGHT / 2);
|
||||
|
||||
var scores = game.highScores.getScores();
|
||||
ctx.font = "12px System, monospace";
|
||||
for (var i = 0; i < scores.length; i++) {
|
||||
ctx.fillText(
|
||||
scores[i].name + " " + scores[i].score,
|
||||
GAME_WIDTH / 2,
|
||||
GAME_HEIGHT / 2 + 20 + 14 * i
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.highScores = function(game) {
|
||||
var scores = [];
|
||||
|
||||
if ((t = localStorage.getItem("high-scores"))) {
|
||||
scores = JSON.parse(t);
|
||||
}
|
||||
|
||||
return {
|
||||
getScores: function() {
|
||||
return scores;
|
||||
},
|
||||
addScore: function(_name, _score) {
|
||||
scores.push({ name: _name, score: _score });
|
||||
scores.sort(function(a, b) {
|
||||
return b.score - a.score;
|
||||
});
|
||||
if (scores.length > 10) {
|
||||
scores.length = 10;
|
||||
}
|
||||
game.log.debug("Saving high scores.");
|
||||
var str = JSON.stringify(scores);
|
||||
localStorage.setItem("high-scores", str);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.drawPath = function(ctx, position, direction, scale, path, color) {
|
||||
if (!color) {
|
||||
color = "#fff";
|
||||
}
|
||||
ctx.strokeStyle = color;
|
||||
ctx.setTransform(
|
||||
Math.cos(direction) * scale,
|
||||
Math.sin(direction) * scale,
|
||||
-Math.sin(direction) * scale,
|
||||
Math.cos(direction) * scale,
|
||||
position[0],
|
||||
position[1]
|
||||
);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(path[0][0], path[0][1]);
|
||||
for (i = 1; i < path.length; i++) {
|
||||
ctx.lineTo(path[i][0], path[i][1]);
|
||||
}
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
ctx.strokeStyle = "#fff";
|
||||
};
|
||||
|
||||
Asteroids.move = function(position, velocity) {
|
||||
position[0] += velocity[0];
|
||||
if (position[0] < 0) position[0] = GAME_WIDTH + position[0];
|
||||
else if (position[0] > GAME_WIDTH) position[0] -= GAME_WIDTH;
|
||||
|
||||
position[1] += velocity[1];
|
||||
if (position[1] < 0) position[1] = GAME_HEIGHT + position[1];
|
||||
else if (position[1] > GAME_HEIGHT) position[1] -= GAME_HEIGHT;
|
||||
};
|
||||
|
||||
Asteroids.stars = function() {
|
||||
var stars = [];
|
||||
for (var i = 0; i < 50; i++) {
|
||||
stars.push([Math.random() * GAME_WIDTH, Math.random() * GAME_HEIGHT]);
|
||||
}
|
||||
|
||||
return {
|
||||
draw: function(ctx) {
|
||||
var ii = stars.length;
|
||||
for (var i = 0; i < ii; i++) {
|
||||
ctx.fillRect(stars[i][0], stars[i][1], 1, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asteroids.play = function(game) {
|
||||
var ctx = game.playfield.getContext("2d");
|
||||
ctx.fillStyle = "white";
|
||||
ctx.strokeStyle = "white";
|
||||
|
||||
var speed = ASTEROID_SPEED,
|
||||
hspeed = ASTEROID_SPEED / 2;
|
||||
|
||||
game.level.levelUp(game);
|
||||
|
||||
var bullets = [],
|
||||
last_fire_state = false,
|
||||
last_asteroid_count = 0;
|
||||
|
||||
var extra_lives = 0;
|
||||
|
||||
// Add a star field.
|
||||
game.overlays.add(Asteroids.stars());
|
||||
|
||||
game.pulse = setInterval(function() {
|
||||
var kill_asteroids = [],
|
||||
new_asteroids = [],
|
||||
kill_bullets = [];
|
||||
|
||||
ctx.save();
|
||||
ctx.clearRect(0, 0, GAME_WIDTH, GAME_HEIGHT);
|
||||
|
||||
// Be nice and award extra lives first.
|
||||
var t_extra_lives = game.player.getScore() / POINTS_TO_EXTRA_LIFE;
|
||||
t_extra_lives = Math.floor(t_extra_lives);
|
||||
if (t_extra_lives > extra_lives) {
|
||||
game.player.extraLife(game);
|
||||
}
|
||||
extra_lives = t_extra_lives;
|
||||
|
||||
if (game.keyState.getState(Asteroids.UP)) {
|
||||
game.player.thrust(THRUST_ACCEL);
|
||||
}
|
||||
|
||||
if (game.keyState.getState(Asteroids.LEFT)) {
|
||||
game.player.rotate(-ROTATE_SPEED);
|
||||
}
|
||||
|
||||
if (game.keyState.getState(Asteroids.RIGHT)) {
|
||||
game.player.rotate(ROTATE_SPEED);
|
||||
}
|
||||
|
||||
var fire_state = game.keyState.getState(Asteroids.FIRE);
|
||||
if (
|
||||
fire_state &&
|
||||
fire_state != last_fire_state &&
|
||||
bullets.length < MAX_BULLETS
|
||||
) {
|
||||
var b = game.player.fire(game);
|
||||
bullets.push(b);
|
||||
}
|
||||
last_fire_state = fire_state;
|
||||
|
||||
if (!game.player.isDead()) {
|
||||
game.player.move();
|
||||
game.player.draw(ctx);
|
||||
}
|
||||
|
||||
for (var k = 0; k < bullets.length; k++) {
|
||||
if (!bullets[k]) continue;
|
||||
|
||||
if (bullets[k].getAge() > MAX_BULLET_AGE) {
|
||||
kill_bullets.push(k);
|
||||
continue;
|
||||
}
|
||||
bullets[k].birthday();
|
||||
bullets[k].move();
|
||||
bullets[k].draw(ctx);
|
||||
}
|
||||
|
||||
for (var r = kill_bullets.length - 1; r >= 0; r--) {
|
||||
bullets.splice(r, 1);
|
||||
}
|
||||
|
||||
var asteroids = game.asteroids.getIterator();
|
||||
for (var i = 0; i < game.asteroids.length; i++) {
|
||||
var killit = false;
|
||||
asteroids[i].move();
|
||||
asteroids[i].draw(ctx);
|
||||
|
||||
// Destroy the asteroid
|
||||
for (var j = 0; j < bullets.length; j++) {
|
||||
if (!bullets[j]) continue;
|
||||
if (Asteroids.collision(bullets[j], asteroids[i])) {
|
||||
game.log.debug("You shot an asteroid!");
|
||||
// Destroy the bullet.
|
||||
bullets.splice(j, 1);
|
||||
killit = true; // JS doesn't have "continue 2;"
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Kill the asteroid?
|
||||
if (killit) {
|
||||
var _gen = asteroids[i].getGeneration() - 1;
|
||||
if (_gen > 0) {
|
||||
// Create children ;)
|
||||
for (var n = 0; n < ASTEROID_CHILDREN; n++) {
|
||||
var a = Asteroids.asteroid(game, _gen);
|
||||
var _pos = [
|
||||
asteroids[i].getPosition()[0],
|
||||
asteroids[i].getPosition()[1]
|
||||
];
|
||||
a.setPosition(_pos);
|
||||
a.setVelocity([
|
||||
Math.random() * speed - hspeed,
|
||||
Math.random() * speed - hspeed
|
||||
]);
|
||||
new_asteroids.push(a);
|
||||
}
|
||||
}
|
||||
game.player.addScore(ASTEROID_SCORE);
|
||||
kill_asteroids.push(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Kill the player?
|
||||
if (
|
||||
!game.player.isDead() &&
|
||||
!game.player.isInvincible() &&
|
||||
Asteroids.collision(game.player, asteroids[i])
|
||||
) {
|
||||
game.player.die(game);
|
||||
}
|
||||
}
|
||||
|
||||
kill_asteroids.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
for (var m = kill_asteroids.length - 1; m >= 0; m--) {
|
||||
game.asteroids.splice(kill_asteroids[m], 1);
|
||||
}
|
||||
|
||||
for (var o = 0; o < new_asteroids.length; o++) {
|
||||
game.asteroids.push(new_asteroids[o]);
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
|
||||
// Do we need to level up?
|
||||
if (0 == game.asteroids.length && last_asteroid_count != 0) {
|
||||
setTimeout(function() {
|
||||
game.level.levelUp(game);
|
||||
}, LEVEL_TIMEOUT);
|
||||
}
|
||||
|
||||
last_asteroid_count = game.asteroids.length;
|
||||
|
||||
// Draw overlays.
|
||||
game.overlays.draw(ctx);
|
||||
|
||||
// Update the info pane.
|
||||
game.info.setLives(game, game.player.getLives());
|
||||
game.info.setScore(game, game.player.getScore());
|
||||
game.info.setLevel(game, game.level.getLevel());
|
||||
}, FRAME_PERIOD);
|
||||
};
|
||||
|
||||
// Some boring constants.
|
||||
Asteroids.LOG_ALL = 0;
|
||||
Asteroids.LOG_INFO = 1;
|
||||
Asteroids.LOG_DEBUG = 2;
|
||||
Asteroids.LOG_WARNING = 3;
|
||||
Asteroids.LOG_ERROR = 4;
|
||||
Asteroids.LOG_CRITICAL = 5;
|
||||
Asteroids.LOG_NONE = 6;
|
||||
|
||||
Asteroids.LEFT = 37;
|
||||
Asteroids.UP = 38;
|
||||
Asteroids.RIGHT = 39;
|
||||
Asteroids.DOWN = 40;
|
||||
Asteroids.FIRE = 32;
|
||||
|
||||
// Load it up!
|
||||
window.onload = Asteroids(document.getElementById("asteroids"));
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
|
||||
<title>Asteroids</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="asteroids">Asteroids game goes here!</div>
|
||||
|
||||
<script src="asteroids.js" type="text/ecmascript"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,46 @@
|
|||
/* Style for Asteroids.js
|
||||
* Copyright (c) 2010 James Socol <me@jamessocol.com>
|
||||
* See LICENSE.txt for license.
|
||||
*/
|
||||
|
||||
body {
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-family: "Calibri", "System", monospace;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
div#asteroids {
|
||||
margin: 50px auto;
|
||||
width: 640px;
|
||||
border: 1px solid #fff;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div#asteroids > * {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div#asteroids > div {
|
||||
font-family: "System", monospace;
|
||||
font-size: 11px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
div#asteroids > div > span {
|
||||
float: right;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
div#instructions {
|
||||
width: 640px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
}
|
|
@ -816,8 +816,6 @@ function update_user(string $id_user, array $values)
|
|||
$values['metaconsole_data_section'] = $values['data_section'];
|
||||
$values['metaconsole_default_event_filter'] = $values['default_event_filter'];
|
||||
unset($values['id_skin']);
|
||||
unset($values['section']);
|
||||
unset($values['data_section']);
|
||||
unset($values['default_event_filter']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class AuditLog extends HTML
|
|||
],
|
||||
[
|
||||
'text' => 'action',
|
||||
'class' => 'w80px table_action_buttons show_extended_info',
|
||||
'class' => 'w80px show_extended_info',
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -187,7 +187,7 @@ class AuditLog extends HTML
|
|||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'date',
|
||||
'direction' => 'asc',
|
||||
'direction' => 'desc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
|
@ -441,7 +441,7 @@ class AuditLog extends HTML
|
|||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||
$(document).on('click', '#audit_logs tbody tr:has(td.show_extended_info)', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||
var row = table.row(tr);
|
||||
|
|
|
@ -58,6 +58,18 @@ class ConsoleSupervisor
|
|||
*/
|
||||
public const MIN_SYNC_QUEUE_LENGTH = 200;
|
||||
|
||||
/**
|
||||
* Icons for notifications.
|
||||
*/
|
||||
public const ICON_CONGRATS = 'images/notification/congrats.svg';
|
||||
public const ICON_DISABLE = 'images/notification/disable.svg';
|
||||
public const ICON_ERROR = 'images/notification/error.svg';
|
||||
public const ICON_FAVORITE = 'images/notification/favorite.svg';
|
||||
public const ICON_HEADSUP = 'images/notification/headsup.svg';
|
||||
public const ICON_INFORMATION = 'images/notification/information.svg';
|
||||
public const ICON_POPULAR = 'images/notification/popular.svg';
|
||||
public const ICON_QUESTION = 'images/notification/question.svg';
|
||||
|
||||
/**
|
||||
* Show if console supervisor is enabled or not.
|
||||
*
|
||||
|
@ -289,6 +301,18 @@ class ConsoleSupervisor
|
|||
*/
|
||||
|
||||
$this->checkLogAlerts();
|
||||
|
||||
/*
|
||||
* Check total modules in system
|
||||
*/
|
||||
|
||||
$this->checkTotalModules();
|
||||
|
||||
/*
|
||||
* Check total modules by agent
|
||||
*/
|
||||
|
||||
$this->checkTotalModulesByAgent();
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,8 +603,21 @@ class ConsoleSupervisor
|
|||
* Check MYSQL Support Version
|
||||
*
|
||||
*/
|
||||
|
||||
$this->checkMYSQLSettings();
|
||||
|
||||
/*
|
||||
* Check total modules in system
|
||||
*/
|
||||
|
||||
$this->checkTotalModules();
|
||||
|
||||
/*
|
||||
* Check total modules by agent
|
||||
*/
|
||||
|
||||
$this->checkTotalModulesByAgent();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -666,14 +703,15 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
|
||||
'title' => __('Incorrect config value'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
|
||||
'title' => __('Incorrect config value'),
|
||||
'message' => __(
|
||||
$message,
|
||||
$names[$variable],
|
||||
$limit_value
|
||||
),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -710,12 +748,13 @@ class ConsoleSupervisor
|
|||
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
|
||||
'title' => __('Access statistics performance'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
|
||||
'title' => __('Access statistics performance'),
|
||||
'message' => __(
|
||||
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -928,7 +967,9 @@ class ConsoleSupervisor
|
|||
false
|
||||
);
|
||||
|
||||
if ($prev !== false
|
||||
if ($data['type'] === 'NOTIF.LOG.ALERT' && $prev !== false) {
|
||||
return;
|
||||
} else if ($prev !== false
|
||||
&& (time() - $prev['timestamp']) > $max_age
|
||||
) {
|
||||
// Clean previous notification.
|
||||
|
@ -960,6 +1001,9 @@ class ConsoleSupervisor
|
|||
$notification['subject'] = io_safe_input($data['title']);
|
||||
$notification['subtype'] = $data['type'];
|
||||
$notification['url'] = io_safe_input($data['url']);
|
||||
if (isset($data['icon_notification']) === true) {
|
||||
$notification['icon_notification'] = $data['icon_notification'];
|
||||
}
|
||||
|
||||
$id = db_process_sql_insert('tmensajes', $notification);
|
||||
|
||||
|
@ -1053,13 +1097,14 @@ class ConsoleSupervisor
|
|||
// Warn user if license is going to expire in 15 days or less.
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => __(
|
||||
$msg,
|
||||
$days_to_expiry
|
||||
),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else if (($days_to_expiry <= 0) && ((is_user_admin($config['id_user'])) || (check_acl($config['id_user'], 0, 'PM')))) {
|
||||
|
@ -1074,10 +1119,11 @@ class ConsoleSupervisor
|
|||
// Warn user, license has expired.
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => $msg,
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => $msg,
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
return false;
|
||||
|
@ -1148,13 +1194,14 @@ class ConsoleSupervisor
|
|||
if (is_writable($config['attachment_store']) !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.WRITABLE.ATTACHMENT',
|
||||
'title' => __('Attachment directory is not writable'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.WRITABLE.ATTACHMENT',
|
||||
'title' => __('Attachment directory is not writable'),
|
||||
'message' => __(
|
||||
'Directory %s is not writable. Please, configure corresponding permissions.',
|
||||
$config['attachment_store']
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -1204,13 +1251,14 @@ class ConsoleSupervisor
|
|||
if (is_readable($remote_config_dir) !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
||||
'title' => __('Remote configuration directory is not readable'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
||||
'title' => __('Remote configuration directory is not readable'),
|
||||
'message' => __(
|
||||
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -1223,13 +1271,14 @@ class ConsoleSupervisor
|
|||
if (is_writable($remote_config_dir.'/conf') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
||||
'title' => __('Remote configuration directory is not writable'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
||||
'title' => __('Remote configuration directory is not writable'),
|
||||
'message' => __(
|
||||
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/conf'
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1241,13 +1290,14 @@ class ConsoleSupervisor
|
|||
if (is_writable($remote_config_dir.'/collections') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
||||
'title' => __('Remote collections directory is not writable'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
||||
'title' => __('Remote collections directory is not writable'),
|
||||
'message' => __(
|
||||
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/collections'
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1259,13 +1309,14 @@ class ConsoleSupervisor
|
|||
if (is_writable($remote_config_dir.'/md5') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
||||
'title' => __('Remote md5 directory is not writable'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
||||
'title' => __('Remote md5 directory is not writable'),
|
||||
'message' => __(
|
||||
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/md5'
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1289,14 +1340,15 @@ class ConsoleSupervisor
|
|||
if ($filecount > $MAX_FILES_DATA_IN) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.FILES.DATAIN',
|
||||
'title' => __('There are too much files in spool').'.',
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.FILES.DATAIN',
|
||||
'title' => __('There are too much files in spool').'.',
|
||||
'message' => __(
|
||||
'There are more than %d files in %s. Consider checking DataServer performance',
|
||||
$MAX_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1312,14 +1364,15 @@ class ConsoleSupervisor
|
|||
if ($filecount > $MAX_BADXML_FILES_DATA_IN) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.FILES.DATAIN.BADXML',
|
||||
'title' => __('There are too many BADXML files in spool'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.FILES.DATAIN.BADXML',
|
||||
'title' => __('There are too many BADXML files in spool'),
|
||||
'message' => __(
|
||||
'There are more than %d files in %s. Consider checking software agents.',
|
||||
$MAX_BADXML_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1400,18 +1453,19 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.QUEUE.'.$key,
|
||||
'title' => __(
|
||||
'type' => 'NOTIF.SERVER.QUEUE.'.$key,
|
||||
'title' => __(
|
||||
'%s (%s) is lacking performance.',
|
||||
servers_get_server_string_name($type),
|
||||
$queue['name']
|
||||
),
|
||||
'message' => __(
|
||||
'message' => __(
|
||||
$msg,
|
||||
$modules_queued,
|
||||
$queue['queued_modules']
|
||||
),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1469,10 +1523,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.STATUS',
|
||||
'title' => __('No servers available.'),
|
||||
'message' => __('There are no servers registered in this console. Please, check installation guide.'),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.SERVER.STATUS',
|
||||
'title' => __('No servers available.'),
|
||||
'message' => __('There are no servers registered in this console. Please, check installation guide.'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1513,6 +1568,7 @@ class ConsoleSupervisor
|
|||
}
|
||||
}
|
||||
|
||||
$icon_notification = self::ICON_QUESTION;
|
||||
if ($server['status'] == 1) {
|
||||
// Fatal error. Component has die.
|
||||
$msg = __(
|
||||
|
@ -1526,6 +1582,8 @@ class ConsoleSupervisor
|
|||
servers_get_server_string_name($server['server_type']),
|
||||
$server['name']
|
||||
);
|
||||
|
||||
$icon_notification = self::ICON_ERROR;
|
||||
} else {
|
||||
// Non-fatal error. Controlated exit. Component is not running.
|
||||
$msg = __(
|
||||
|
@ -1542,10 +1600,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
|
||||
'title' => $msg,
|
||||
'message' => $description,
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
|
||||
'title' => $msg,
|
||||
'message' => $description,
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
'icon_notification' => $icon_notification,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1585,10 +1644,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MASTER',
|
||||
'title' => __('No master servers found.'),
|
||||
'message' => __('At least one server must be defined to run as master. Please, check documentation.'),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.SERVER.MASTER',
|
||||
'title' => __('No master servers found.'),
|
||||
'message' => __('At least one server must be defined to run as master. Please, check documentation.'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1641,10 +1701,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.SAFE_MODE',
|
||||
'title' => __('PHP safe mode is enabled. Some features may not work properly'),
|
||||
'message' => __('To disable it, go to your PHP configuration file (php.ini) and put safe_mode = Off (Do not forget to restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.PHP.SAFE_MODE',
|
||||
'title' => __('PHP safe mode is enabled. Some features may not work properly'),
|
||||
'message' => __('To disable it, go to your PHP configuration file (php.ini) and put safe_mode = Off (Do not forget to restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1659,16 +1720,17 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.INPUT_TIME',
|
||||
'title' => sprintf(
|
||||
'type' => 'NOTIF.PHP.INPUT_TIME',
|
||||
'title' => sprintf(
|
||||
__('%s value in PHP configuration is not recommended'),
|
||||
'max_input_time'
|
||||
),
|
||||
'message' => sprintf(
|
||||
'message' => sprintf(
|
||||
__('Recommended value is %s'),
|
||||
'-1 ('.__('Unlimited').')'
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1683,16 +1745,17 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.EXECUTION_TIME',
|
||||
'title' => sprintf(
|
||||
'type' => 'NOTIF.PHP.EXECUTION_TIME',
|
||||
'title' => sprintf(
|
||||
__("Not recommended '%s' value in PHP configuration"),
|
||||
'max_execution_time'
|
||||
),
|
||||
'message' => sprintf(
|
||||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
'0 ('.__('Unlimited').')'
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1707,16 +1770,17 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
||||
'title' => sprintf(
|
||||
'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
||||
'title' => sprintf(
|
||||
__("Not recommended '%s' value in PHP configuration"),
|
||||
'upload_max_filesize'
|
||||
),
|
||||
'message' => sprintf(
|
||||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf(__('%s or greater'), '800M')
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1736,16 +1800,17 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.MEMORY_LIMIT',
|
||||
'title' => sprintf(
|
||||
'type' => 'NOTIF.PHP.MEMORY_LIMIT',
|
||||
'title' => sprintf(
|
||||
__("Not recommended '%s' value in PHP configuration"),
|
||||
'memory_limit'
|
||||
),
|
||||
'message' => sprintf(
|
||||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf(__('%s or greater'), $recommended_memory)
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1760,10 +1825,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS',
|
||||
'title' => __('Problems with disable_functions in php.ini'),
|
||||
'message' => __('The variable disable_functions contains functions system() or exec() in PHP configuration file (php.ini)').'<br /><br />'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS',
|
||||
'title' => __('Problems with disable_functions in php.ini'),
|
||||
'message' => __('The variable disable_functions contains functions system() or exec() in PHP configuration file (php.ini)').'<br /><br />'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1777,10 +1843,11 @@ class ConsoleSupervisor
|
|||
// }
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.CHROMIUM',
|
||||
'title' => __('chromium is not installed'),
|
||||
'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.PHP.CHROMIUM',
|
||||
'title' => __('chromium is not installed'),
|
||||
'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1838,10 +1905,11 @@ class ConsoleSupervisor
|
|||
$url = 'https://www.php.net/supported-versions.php';
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.VERSION.SUPPORT',
|
||||
'title' => __('PHP UPDATE REQUIRED'),
|
||||
'message' => __('You should update your PHP version because it will be out of official support').'<br>'.__('Current PHP version: ').PHP_VERSION,
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.PHP.VERSION.SUPPORT',
|
||||
'title' => __('PHP UPDATE REQUIRED'),
|
||||
'message' => __('You should update your PHP version because it will be out of official support').'<br>'.__('Current PHP version: ').PHP_VERSION,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1864,10 +1932,11 @@ class ConsoleSupervisor
|
|||
$url = 'https://www.mysql.com/support/eol-notice.html';
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.MYSQL.VERSION',
|
||||
'title' => __('MYSQL UPDATE REQUIRED'),
|
||||
'message' => __('You should update your MYSQL version because it will be out of official support').'<br>'.__('Current MYSQL version: ').$mysql_version,
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.MYSQL.VERSION',
|
||||
'title' => __('MYSQL UPDATE REQUIRED'),
|
||||
'message' => __('You should update your MYSQL version because it will be out of official support').'<br>'.__('Current MYSQL version: ').$mysql_version,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1906,10 +1975,11 @@ class ConsoleSupervisor
|
|||
if ($config['history_db_connection'] === false) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.HISTORYDB',
|
||||
'title' => __('Historical database not available'),
|
||||
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
'type' => 'NOTIF.HISTORYDB',
|
||||
'title' => __('Historical database not available'),
|
||||
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
'icon_notification' => self::ICON_QUESTION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1950,13 +2020,14 @@ class ConsoleSupervisor
|
|||
if ($last_maintance > 172800) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PANDORADB',
|
||||
'title' => __('Database maintenance problem'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.PANDORADB',
|
||||
'title' => __('Database maintenance problem'),
|
||||
'message' => __(
|
||||
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
|
||||
io_safe_output(get_product_name())
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2011,12 +2082,13 @@ class ConsoleSupervisor
|
|||
if ($last_maintance > 172800) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PANDORADB.HISTORY',
|
||||
'title' => __(
|
||||
'type' => 'NOTIF.PANDORADB.HISTORY',
|
||||
'title' => __(
|
||||
'Historical database maintenance problem.'
|
||||
),
|
||||
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2052,10 +2124,11 @@ class ConsoleSupervisor
|
|||
if ($mrh_version != $config['MR']) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.HISTORYDB.MR',
|
||||
'title' => __('Historical database MR mismatch'),
|
||||
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
'type' => 'NOTIF.HISTORYDB.MR',
|
||||
'title' => __('Historical database MR mismatch'),
|
||||
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
'icon_notification' => self::ICON_QUESTION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2093,10 +2166,11 @@ class ConsoleSupervisor
|
|||
if ($elasticsearch === false) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
||||
'title' => __('Log collector cannot connect to OpenSearch'),
|
||||
'message' => __('OpenSearch is not available using current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
||||
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
||||
'title' => __('Log collector cannot connect to OpenSearch'),
|
||||
'message' => __('OpenSearch is not available using current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2163,10 +2237,11 @@ class ConsoleSupervisor
|
|||
} else {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
||||
'title' => __('Metaconsole DB is not available.'),
|
||||
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
||||
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
||||
'title' => __('Metaconsole DB is not available.'),
|
||||
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2382,10 +2457,11 @@ class ConsoleSupervisor
|
|||
if (update_manager_verify_registration() === false) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||
'title' => __('This instance is not registered in the Warp Update section'),
|
||||
'message' => __('Click here to start the registration process'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||
'title' => __('This instance is not registered in the Warp Update section'),
|
||||
'message' => __('Click here to start the registration process'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'icon_notification' => self::ICON_QUESTION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2412,9 +2488,10 @@ class ConsoleSupervisor
|
|||
if (update_manager_verify_api() === false) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.API.ACCESS',
|
||||
'title' => __('Cannot access the Pandora FMS API '),
|
||||
'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'),
|
||||
'type' => 'NOTIF.API.ACCESS',
|
||||
'title' => __('Cannot access the Pandora FMS API '),
|
||||
'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'),
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2445,10 +2522,11 @@ class ConsoleSupervisor
|
|||
if ($admin_with_default_pass > 0) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
||||
'title' => __('Default password for "Admin" user has not been changed'),
|
||||
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
|
||||
'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
||||
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
||||
'title' => __('Default password for "Admin" user has not been changed'),
|
||||
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
|
||||
'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2560,10 +2638,11 @@ class ConsoleSupervisor
|
|||
foreach ($_SESSION['return_installation_open']['text'] as $message) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
||||
'title' => __('Failed to retrieve updates, please configure utility'),
|
||||
'message' => $message,
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
||||
'title' => __('Failed to retrieve updates, please configure utility'),
|
||||
'message' => $message,
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2577,13 +2656,14 @@ class ConsoleSupervisor
|
|||
if ($_SESSION['new_update'] == 'new') {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.UPDATE',
|
||||
'title' => __(
|
||||
'type' => 'NOTIF.UPDATEMANAGER.UPDATE',
|
||||
'title' => __(
|
||||
'New %s Console update',
|
||||
get_product_name()
|
||||
),
|
||||
'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'icon_notification' => self::ICON_CONGRATS,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2615,13 +2695,14 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.MINOR',
|
||||
'title' => __('Minor release/s available'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.UPDATEMANAGER.MINOR',
|
||||
'title' => __('Minor release/s available'),
|
||||
'message' => __(
|
||||
'There is one or more minor releases available. <a id="aviable_updates" target="blank" href="%s">.About minor release update</a>.',
|
||||
$url
|
||||
),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'icon_notification' => self::ICON_CONGRATS,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2678,10 +2759,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||
'message' => __($message_conf_cron),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||
'message' => __($message_conf_cron),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_QUESTION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2780,10 +2862,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -2836,10 +2919,11 @@ class ConsoleSupervisor
|
|||
$is_none = true;
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
|
||||
'title' => __('AllowOverride is disabled'),
|
||||
'message' => __($message),
|
||||
'url' => '__url__/index.php',
|
||||
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
|
||||
'title' => __('AllowOverride is disabled'),
|
||||
'message' => __($message),
|
||||
'url' => '__url__/index.php',
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2882,10 +2966,11 @@ class ConsoleSupervisor
|
|||
if ((int) $db_master !== (int) $cluster_master) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.HAMASTER.MESSAGE',
|
||||
'title' => __('Desynchronized operation on the node '.$node['host']),
|
||||
'message' => __($message),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
|
||||
'type' => 'NOTIF.HAMASTER.MESSAGE',
|
||||
'title' => __('Desynchronized operation on the node '.$node['host']),
|
||||
'message' => __($message),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2922,10 +3007,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD',
|
||||
'title' => __($title_pandoraconsole_old_log),
|
||||
'message' => __($message_pandoraconsole_old_log),
|
||||
'url' => $url,
|
||||
'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD',
|
||||
'title' => __($title_pandoraconsole_old_log),
|
||||
'message' => __($message_pandoraconsole_old_log),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_QUESTION,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -3006,15 +3092,16 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SYNCQUEUE.LENGTH.'.$node_id,
|
||||
'title' => __('Node %s sync queue length exceeded, ', $node->server_name()),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.SYNCQUEUE.LENGTH.'.$node_id,
|
||||
'title' => __('Node %s sync queue length exceeded, ', $node->server_name()),
|
||||
'message' => __(
|
||||
'Synchronization queue lenght for node %s is %d items, this value should be 0 or lower than %d, please check the queue status.',
|
||||
$node->server_name(),
|
||||
$count,
|
||||
$items_min
|
||||
),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
|
@ -3061,14 +3148,15 @@ class ConsoleSupervisor
|
|||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SYNCQUEUE.STATUS.'.$node_id,
|
||||
'title' => __('Node %s sync queue failed, ', $node->server_name()),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.SYNCQUEUE.STATUS.'.$node_id,
|
||||
'title' => __('Node %s sync queue failed, ', $node->server_name()),
|
||||
'message' => __(
|
||||
'Node %s cannot process synchronization queue due %s, please check the queue status.',
|
||||
$node->server_name(),
|
||||
$item->error()
|
||||
),
|
||||
'url' => $url,
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
|
@ -3094,13 +3182,14 @@ class ConsoleSupervisor
|
|||
if ($error_dependecies > 0) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.AGENT.LIBRARY',
|
||||
'title' => __('Agent dependency error'),
|
||||
'message' => __(
|
||||
'type' => 'NOTIF.AGENT.LIBRARY',
|
||||
'title' => __('Agent dependency error'),
|
||||
'message' => __(
|
||||
'There are omnishell agents with dependency errors',
|
||||
),
|
||||
|
||||
'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell',
|
||||
'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell',
|
||||
'icon_notification' => self::ICON_ERROR,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -3135,4 +3224,65 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the total number of modules in Pandora is greater than 80000.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTotalModules()
|
||||
{
|
||||
$total_modules = db_get_num_rows('select * from tagente_modulo');
|
||||
if ($total_modules > 80000) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.MODULES.ALERT',
|
||||
'title' => __('Your system has a total of %s modules', $total_modules),
|
||||
'message' => __('This is higher than the recommended maximum 80,000 modules per node. This may result in poor performance of your system.'),
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.MODULES.ALERT');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the total number of modules by agent is greater than 200
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTotalModulesByAgent()
|
||||
{
|
||||
$modules_by_agent = db_process_sql(
|
||||
'SELECT count(*) AS modules_by_agent
|
||||
FROM tagente a
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
GROUP BY m.id_agente'
|
||||
);
|
||||
|
||||
$show_warning = false;
|
||||
foreach ($modules_by_agent as $key => $total_modules) {
|
||||
if ($total_modules['modules_by_agent'] > 200) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.MODULES_AGENT.ALERT',
|
||||
'title' => __('Your system has an average of %s modules per agent', $total_modules['modules_by_agent']),
|
||||
'message' => __('This is higher than the recommended maximum (200). This may result in poor performance of your system.'),
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||
]
|
||||
);
|
||||
$show_warning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_warning === false) {
|
||||
$this->cleanNotifications('NOTIF.MODULES_AGENT.ALERT');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -388,26 +388,40 @@ class SatelliteAgent extends HTML
|
|||
$tmp->actions = '';
|
||||
|
||||
if ($delete === false) {
|
||||
$tmp->actions .= html_print_image(
|
||||
($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png',
|
||||
true,
|
||||
$tmp->actions .= html_print_anchor(
|
||||
[
|
||||
'border' => '0',
|
||||
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
||||
'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')',
|
||||
]
|
||||
'href' => '#',
|
||||
'content' => html_print_image(
|
||||
($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) {
|
||||
$tmp->actions .= html_print_image(
|
||||
($delete === true) ? 'images/add.png' : 'images/delete.svg',
|
||||
true,
|
||||
$tmp->actions .= html_print_anchor(
|
||||
[
|
||||
'border' => '0',
|
||||
'class' => 'main_menu_icon mrgn_lft_05em invert_filter',
|
||||
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')',
|
||||
]
|
||||
'href' => '#',
|
||||
'content' => html_print_image(
|
||||
($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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -995,6 +995,11 @@ class Tree
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Quiet name on agent.
|
||||
if (isset($agent['quiet']) && $agent['quiet']) {
|
||||
$agent['alias'] .= ' '.__('(Quiet)');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ class WebServerModuleDebug extends Wizard
|
|||
);
|
||||
// Set execution timeout.
|
||||
$executionForPerform .= sprintf(
|
||||
$executionForPerform.' -m %d',
|
||||
' -m %d',
|
||||
$this->requestTimeout
|
||||
);
|
||||
|
||||
|
|
|
@ -156,11 +156,14 @@ class WelcomeWindow extends Wizard
|
|||
modal: {
|
||||
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||
ok: '<?php echo __('Close'); ?>'
|
||||
ok: '<?php echo __('Close wizard'); ?>',
|
||||
overlay: true,
|
||||
overlayExtraClass: 'welcome-overlay',
|
||||
},
|
||||
onshow: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
method: 'loadWelcomeWindow',
|
||||
width: 1000,
|
||||
},
|
||||
oncancel: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
|
@ -178,6 +181,34 @@ class WelcomeWindow extends Wizard
|
|||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onload: () => {
|
||||
$(document).ready(function () {
|
||||
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
|
||||
$(buttonpane).append(`
|
||||
<div class="welcome-wizard-buttons">
|
||||
<label>
|
||||
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
|
||||
<?php echo __('Do not show anymore'); ?>
|
||||
</label>
|
||||
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
|
||||
</div>
|
||||
`);
|
||||
|
||||
var closeWizard = $("button.close-wizard-button");
|
||||
|
||||
$(closeWizard).click(function (e) {
|
||||
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
|
||||
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
|
||||
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
|
||||
|
||||
if (checkbox === 1) {
|
||||
$(cancel).click();
|
||||
} else {
|
||||
$(close).click()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -412,11 +443,11 @@ class WelcomeWindow extends Wizard
|
|||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_diagnosis',
|
||||
'class' => 'flex-row flex-items-center w98p ',
|
||||
'class' => 'flex-row flex-items-center ',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Post-installation status diagnostic'),
|
||||
'label' => __('This is your post-installation status diagnostic:'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_diagnosis',
|
||||
|
@ -434,7 +465,7 @@ class WelcomeWindow extends Wizard
|
|||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Warp Update registration'),
|
||||
'label' => '<span class="status"></span>'.__('Warp Update registration'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_update_manager',
|
||||
|
@ -443,7 +474,7 @@ class WelcomeWindow extends Wizard
|
|||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'label' => __('Cancel'),
|
||||
'type' => 'button',
|
||||
'attributes' => [
|
||||
'class' => (empty($btn_update_manager_class) === false) ? $btn_update_manager_class : 'invisible_important',
|
||||
|
@ -462,7 +493,7 @@ class WelcomeWindow extends Wizard
|
|||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Default mail to send alerts'),
|
||||
'label' => '<span class="status"></span>'.__('Default mail to send alerts'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_create_agent',
|
||||
|
@ -471,7 +502,7 @@ class WelcomeWindow extends Wizard
|
|||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'label' => __('Cancel'),
|
||||
'type' => 'button',
|
||||
'attributes' => [
|
||||
'class' => (empty($btn_configure_mail_class) === false) ? $btn_configure_mail_class : 'invisible_important',
|
||||
|
@ -490,7 +521,7 @@ class WelcomeWindow extends Wizard
|
|||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('All servers running'),
|
||||
'label' => '<span class="status"></span>'.__('All servers running'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_servers_up',
|
||||
|
@ -499,7 +530,7 @@ class WelcomeWindow extends Wizard
|
|||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'label' => __('Cancel'),
|
||||
'type' => 'button',
|
||||
'attributes' => [
|
||||
'class' => (empty($btn_servers_up_class) === false) ? $btn_servers_up_class : 'invisible_important',
|
||||
|
@ -518,7 +549,7 @@ class WelcomeWindow extends Wizard
|
|||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Enterprise licence valid'),
|
||||
'label' => '<span class="status"></span>'.__('Enterprise licence valid'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_license_valid',
|
||||
|
@ -527,7 +558,7 @@ class WelcomeWindow extends Wizard
|
|||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'label' => __('Cancel'),
|
||||
'type' => 'button',
|
||||
'attributes' => [
|
||||
'class' => (empty($btn_license_valid_class) === false) ? $btn_license_valid_class : 'invisible_important',
|
||||
|
@ -567,7 +598,7 @@ class WelcomeWindow extends Wizard
|
|||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_task_todo',
|
||||
'class' => 'flex-row flex-items-center w98p',
|
||||
'class' => 'flex-row flex-items-center',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
|
@ -591,7 +622,7 @@ class WelcomeWindow extends Wizard
|
|||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_wizard_agent',
|
||||
'class' => 'flex space-between w98p',
|
||||
'class' => 'flex space-between',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
|
@ -599,7 +630,7 @@ class WelcomeWindow extends Wizard
|
|||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'task_to_perform',
|
||||
'selected' => '',
|
||||
'selected' => 'check_net',
|
||||
'return' => true,
|
||||
'nothing' => \__('Please select one'),
|
||||
'nothing_value' => '',
|
||||
|
@ -630,6 +661,24 @@ class WelcomeWindow extends Wizard
|
|||
|
||||
$output .= $this->loadJS($flag_task);
|
||||
echo $output;
|
||||
|
||||
echo '
|
||||
<div class="welcome-wizard-right-content">
|
||||
<ul class="welcome-circles">
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
</ul>
|
||||
<img src="images/welcome-wizard-image.png" />
|
||||
</div>
|
||||
';
|
||||
?>
|
||||
<div id="dialog_goliat" class="invisible">
|
||||
<?php
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC240112';
|
||||
$build_version = 'PC240123';
|
||||
$pandora_version = 'v7.0NG.775';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -2016,7 +2016,7 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false,
|
|||
}
|
||||
|
||||
returnError('No agent alias specified');
|
||||
} else if (agents_get_agent_id($nombre_agente)) {
|
||||
} else if (agents_get_agent_id($agent->nombre())) {
|
||||
if ($message === true) {
|
||||
return 'The agent name already exists in DB.';
|
||||
}
|
||||
|
@ -2064,7 +2064,7 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false,
|
|||
}
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
if ($return !== true) {
|
||||
returnData(
|
||||
'string',
|
||||
[
|
||||
|
@ -2266,9 +2266,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
|
|||
}
|
||||
|
||||
$agent_by_alias = false;
|
||||
$agent_by_id = false;
|
||||
|
||||
if ($other['data'][0] === '1') {
|
||||
$agent_by_alias = true;
|
||||
} else if ($other['data'][0] === '2') {
|
||||
$agent_by_id = true;
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
|
@ -2331,7 +2334,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$idAgent = agents_get_agent_id($id, false);
|
||||
if ($agent_by_id === true) {
|
||||
$idAgent = $id;
|
||||
} else {
|
||||
$idAgent = agents_get_agent_id($id, false);
|
||||
}
|
||||
|
||||
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
|
||||
return;
|
||||
}
|
||||
|
@ -13174,6 +13182,12 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
$values['id_extra'] = '';
|
||||
}
|
||||
|
||||
if ($other['data'][21] != '') {
|
||||
$values['event_custom_id'] = $other['data'][21];
|
||||
}else{
|
||||
$values['event_custom_id'] = '';
|
||||
}
|
||||
|
||||
$custom_data = base64_decode($values['custom_data']);
|
||||
$custom_data = mysql_escape_string_sql($custom_data);
|
||||
|
||||
|
@ -13196,7 +13210,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
$values['server_id'],
|
||||
$values['id_extra'],
|
||||
$ack_utimestamp,
|
||||
$values['event_custom_id'] ?? null
|
||||
$values['event_custom_id']
|
||||
);
|
||||
|
||||
if ($other['data'][12] != '') {
|
||||
|
|
|
@ -383,6 +383,13 @@ function cron_task_run(
|
|||
$nameday = strtolower($datetime->format('l'));
|
||||
}
|
||||
}
|
||||
} else if (empty($old_args['first_execution']) === false) {
|
||||
$datetime = new DateTime();
|
||||
$datetime->setTimestamp($old_args['first_execution']);
|
||||
$datetime->modify('+7 day');
|
||||
$weekly_date = $datetime->format('Y-m-d');
|
||||
$weekly_time = $datetime->format('H:i:s');
|
||||
$old_args['first_execution'] = strtotime($weekly_date.' '.$weekly_time);
|
||||
}
|
||||
} else {
|
||||
// Add it to next execution.
|
||||
|
|
|
@ -1318,7 +1318,7 @@ function events_get_all(
|
|||
if ($tags[0] === $id_tag) {
|
||||
$_tmp .= ' AND (( ';
|
||||
} else {
|
||||
$_tmp .= ' OR ( ';
|
||||
$_tmp .= ' AND ( ';
|
||||
}
|
||||
|
||||
$_tmp .= sprintf(
|
||||
|
@ -1969,7 +1969,7 @@ function events_get_all(
|
|||
// -1 For pagination 'All'.
|
||||
((int) $limit === -1)
|
||||
? $end = count($data)
|
||||
: $end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
|
||||
: $end = $limit;
|
||||
$finally = array_slice($data, $offset, $end, true);
|
||||
$return = [
|
||||
'buffers' => $buffers,
|
||||
|
|
|
@ -5261,7 +5261,8 @@ function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true,
|
|||
FROM tagente a
|
||||
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
|
||||
LEFT JOIN tconfig_os os ON a.id_os = os.id_os
|
||||
WHERE a.id_grupo IN (%s) OR g.id_group IN (%s)
|
||||
WHERE (a.id_grupo IN (%s) OR g.id_group IN (%s))
|
||||
AND a.disabled = 0
|
||||
GROUP BY os.id_os',
|
||||
implode(',', $id_groups),
|
||||
implode(',', $id_groups)
|
||||
|
@ -5351,13 +5352,14 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
|
|||
// with it and then the number of times it occured. GROUP BY statement
|
||||
// is required if both DISTINCT() and COUNT() are in the statement.
|
||||
$sql = sprintf(
|
||||
'SELECT DISTINCT(id_agente) AS id_agente,
|
||||
COUNT(id_agente) AS count
|
||||
'SELECT DISTINCT(te.id_agente) AS id_agente,
|
||||
COUNT(te.id_agente) AS count
|
||||
FROM tevento te
|
||||
LEFT JOIN tagente a ON a.id_agente = te.id_agente
|
||||
LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente
|
||||
WHERE 1=1 AND estado = 0
|
||||
%s %s
|
||||
GROUP BY id_agente
|
||||
%s %s AND a.disabled = 0
|
||||
GROUP BY te.id_agente
|
||||
ORDER BY count DESC LIMIT 8',
|
||||
$tags_condition,
|
||||
$filter_groups
|
||||
|
|
|
@ -2503,7 +2503,8 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
|
|||
|
||||
$sql = 'SELECT * FROM tagente a
|
||||
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
|
||||
WHERE a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).')';
|
||||
WHERE (a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).'))
|
||||
AND a.disabled = 0';
|
||||
|
||||
$all_agents = db_get_all_rows_sql($sql);
|
||||
if (empty($all_agents)) {
|
||||
|
|
|
@ -774,7 +774,8 @@ function html_print_select(
|
|||
$select2_multiple_enable_all=false,
|
||||
$form='',
|
||||
$order=false,
|
||||
$custom_id=null
|
||||
$custom_id=null,
|
||||
$placeholder='',
|
||||
) {
|
||||
$output = "\n";
|
||||
|
||||
|
@ -1013,7 +1014,8 @@ function html_print_select(
|
|||
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= '$("#'.$id.'").select2({
|
||||
closeOnSelect: '.(($select2_multiple_enable === true) ? 'false' : 'true').'
|
||||
closeOnSelect: '.(($select2_multiple_enable === true) ? 'false' : 'true').',
|
||||
placeholder: "'.$placeholder.'",
|
||||
});';
|
||||
|
||||
if ($required !== false) {
|
||||
|
@ -1758,6 +1760,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1773,6 +1776,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1888,7 +1892,8 @@ function html_print_select_from_sql(
|
|||
$size=false,
|
||||
$truncate_size=GENERIC_SIZE_TEXT,
|
||||
$class='',
|
||||
$required=false
|
||||
$required=false,
|
||||
$placeholder='',
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -1931,7 +1936,12 @@ function html_print_select_from_sql(
|
|||
$required,
|
||||
$truncate_size,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
null,
|
||||
$placeholder
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5680,7 +5690,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['select2_multiple_enable']) === true) ? $data['select2_multiple_enable'] : false),
|
||||
((isset($data['select2_multiple_enable_all']) === true) ? $data['select2_multiple_enable_all'] : false),
|
||||
((isset($data['form']) === true) ? $data['form'] : ''),
|
||||
((isset($data['order']) === true) ? $data['order'] : false)
|
||||
((isset($data['order']) === true) ? $data['order'] : false),
|
||||
((isset($data['custom_id']) === true) ? $data['custom_id'] : null),
|
||||
((isset($data['placeholder']) === true) ? $data['placeholder'] : null),
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -5700,7 +5712,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['required']) === true) ? $data['required'] : false)
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['placeholder']) === true) ? $data['placeholder'] : null),
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -153,6 +153,12 @@ function menu_print_menu(&$menu)
|
|||
if (empty($operation) === false) {
|
||||
$sec2 = $sec2.'&operation='.$operation;
|
||||
}
|
||||
} else if ($sec2 === 'godmode/users/configure_user') {
|
||||
$sec2 = 'godmode/users/user_list';
|
||||
} else if ($sec2 === 'godmode/groups/configure_group') {
|
||||
$sec2 = 'godmode/groups/group_list';
|
||||
} else if ($sec2 === 'godmode/users/configure_profile') {
|
||||
$sec2 = 'godmode/users/profile_list';
|
||||
} else {
|
||||
$sec2 = (string) get_parameter('sec2');
|
||||
}
|
||||
|
@ -923,40 +929,7 @@ if (is_ajax()) {
|
|||
);
|
||||
}
|
||||
|
||||
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false);
|
||||
if (enterprise_installed() === false) {
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
} else {
|
||||
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
|
||||
$image_about = 'images/custom_logo/'.$config['custom_logo'];
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
|
||||
$image_about = ENTERPRISE_DIR.'/'.$image_about;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$image_about = ui_get_full_url('/enterprise/images/custom_logo/pandoraFMS_metaconsole_full.svg', false, false, false);
|
||||
|
||||
if ($config['meta_custom_logo'] === 'pandoraFMS_metaconsole_full.svg') {
|
||||
$image_about = 'images/custom_logo/'.$config['meta_custom_logo'];
|
||||
} else {
|
||||
$image_about = '../images/custom_logo/'.$config['meta_custom_logo'];
|
||||
}
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
|
||||
$image_about = $image_about;
|
||||
}
|
||||
}
|
||||
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms-collapsed.svg', false, false, false);
|
||||
|
||||
$dialog = '
|
||||
<div id="about-tabs" class="invisible overflow-hidden">
|
||||
|
@ -977,8 +950,8 @@ if (is_ajax()) {
|
|||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 40%; border: 0px;">
|
||||
<a href="https://pandorafms.com/" target="_blank">
|
||||
<img src="'.$image_about.'" alt="logo" width="70%">
|
||||
<a href="https://pandorafms.com/" target="_blank" class="header_center">
|
||||
<img src="'.$image_about.'" alt="logo" width="50%">
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 60%; text-align: left; border: 0px;">
|
||||
|
@ -1290,42 +1263,7 @@ if (is_ajax()) {
|
|||
$lts_name = ' <i>'.$config['lts_name'].'</i>';
|
||||
}
|
||||
|
||||
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false);
|
||||
if (enterprise_installed() === false) {
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
} else {
|
||||
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
|
||||
$image_about = 'images/custom_logo/'.$config['custom_logo'];
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
|
||||
$image_about = ENTERPRISE_DIR.'/'.$image_about;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$image_about = ui_get_full_url('/enterprise/images/custom_logo/pandoraFMS_metaconsole_full.svg', false, false, false);
|
||||
|
||||
if ($config['meta_custom_logo'] === 'pandoraFMS_metaconsole_full.svg') {
|
||||
$image_about = 'images/custom_logo/'.$config['meta_custom_logo'];
|
||||
} else {
|
||||
$image_about = '../images/custom_logo/'.$config['meta_custom_logo'];
|
||||
}
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
|
||||
$image_about = $image_about;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms-collapsed.svg', false, false, false);
|
||||
$dialog = '
|
||||
<div id="about-tabs" class="invisible overflow-hidden">
|
||||
<ul>
|
||||
|
@ -1339,7 +1277,7 @@ if (is_ajax()) {
|
|||
<tr>
|
||||
<th style="width: 40%; border: 0px;">
|
||||
<a href="javascript:christmas_click('.$config['eastern_eggs_disabled'].')">
|
||||
<img src="'.$image_about.'" alt="logo" width="70%">
|
||||
<img src="'.$image_about.'" alt="logo" width="50%">
|
||||
<input id="count_click" type="hidden" value="0" />
|
||||
</a>
|
||||
</th>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
require_once $config['homedir'].'/include/functions_messages.php';
|
||||
require_once __DIR__.'/class/ConsoleSupervisor.php';
|
||||
|
||||
define('NOTIFICATIONS_POSTPONE_FOREVER', -1);
|
||||
|
||||
|
@ -636,13 +637,15 @@ function notifications_get_user_label_status($source, $user, $label)
|
|||
);
|
||||
|
||||
// Clean default common groups error for mesagges.
|
||||
$group_enable = true;
|
||||
if ($common_groups[0] === 0) {
|
||||
unset($common_groups[0]);
|
||||
$group_enable = false;
|
||||
}
|
||||
|
||||
// No group found, return no permissions.
|
||||
$value = empty($common_groups) ? false : $source[$label];
|
||||
return notifications_build_user_enable_return($value, false);
|
||||
return notifications_build_user_enable_return($value, $group_enable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -674,14 +677,34 @@ function notifications_set_user_label_status($source, $user, $label, $value)
|
|||
return false;
|
||||
}
|
||||
|
||||
return (bool) db_process_sql_update(
|
||||
'tnotification_source_user',
|
||||
[$label => $value],
|
||||
[
|
||||
'id_user' => $user,
|
||||
'id_source' => $source,
|
||||
]
|
||||
);
|
||||
$exists = db_process_sql(sprintf('SELECT * FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source));
|
||||
if (empty($exists['enabled']) && empty($exists['also_mail'])) {
|
||||
$sql = sprintf('DELETE FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source);
|
||||
db_process_sql($sql);
|
||||
$exists = false;
|
||||
}
|
||||
|
||||
if ($exists === false) {
|
||||
db_process_sql_insert(
|
||||
'tnotification_source_user',
|
||||
[
|
||||
'id_user' => $user,
|
||||
'id_source' => $source,
|
||||
'enabled' => '1',
|
||||
'also_mail' => '1',
|
||||
]
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return (bool) db_process_sql_update(
|
||||
'tnotification_source_user',
|
||||
[$label => $value],
|
||||
[
|
||||
'id_user' => $user,
|
||||
'id_source' => $source,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1137,6 +1160,15 @@ function notifications_print_dropdown()
|
|||
$mess = [];
|
||||
}
|
||||
|
||||
$redirection_notifications = html_print_menu_button(
|
||||
[
|
||||
'href' => 'javascript:',
|
||||
'class' => 'notification_menu_actions',
|
||||
'text' => __('View all messages'),
|
||||
'onClick' => "window.location='".ui_get_full_url('index.php?sec=message_list&sec2=operation/messages/message_list')."'",
|
||||
],
|
||||
true
|
||||
);
|
||||
$notification_menu = html_print_menu_button(
|
||||
[
|
||||
'href' => 'javascript:',
|
||||
|
@ -1154,6 +1186,7 @@ function notifications_print_dropdown()
|
|||
<div class='notificaion_menu_container'>
|
||||
<div class='menu_tab filter_notification'>%s</div>
|
||||
<div class='menu_tab notification_menu'>%s</div>
|
||||
<div class='menu_tab notification_menu'>%s</div>
|
||||
</div>
|
||||
%s
|
||||
</div>
|
||||
|
@ -1166,6 +1199,7 @@ function notifications_print_dropdown()
|
|||
",
|
||||
$notification_filter,
|
||||
$notification_menu,
|
||||
$redirection_notifications,
|
||||
array_reduce(
|
||||
$mess,
|
||||
function ($carry, $message) {
|
||||
|
@ -1232,6 +1266,12 @@ function notifications_print_dropdown_element($message_info)
|
|||
$body_preview .= __('. Read More...');
|
||||
}
|
||||
|
||||
$icon_notification = ConsoleSupervisor::ICON_INFORMATION;
|
||||
|
||||
if (isset($message_info['icon_notification']) === true && empty($message_info['icon_notification']) === false) {
|
||||
$icon_notification = $message_info['icon_notification'];
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
"<a
|
||||
class='notification-item'
|
||||
|
@ -1256,7 +1296,7 @@ function notifications_print_dropdown_element($message_info)
|
|||
$type,
|
||||
messages_get_url($message_info['id_mensaje']),
|
||||
$target,
|
||||
html_print_image('images/info.svg', true, ['style' => 'height: 40px;margin-left: -20px;margin-top: -40px;']),
|
||||
html_print_image($icon_notification, true, ['style' => 'height: 56px; padding: 0px;']),
|
||||
io_safe_output($message_info['subject']),
|
||||
$body_preview
|
||||
);
|
||||
|
|
|
@ -293,7 +293,7 @@ function show_configuration_wizard() {
|
|||
buttons: [
|
||||
{
|
||||
"text": "No",
|
||||
"class": 'submit-cancel',
|
||||
"class": 'submit-cancel secondaryButton',
|
||||
"click" : function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ function ui_print_truncate_text(
|
|||
$showTextInTitle=true,
|
||||
$suffix='…',
|
||||
$style=false,
|
||||
$forced_title=false
|
||||
$forced_title=false,
|
||||
$text_title=''
|
||||
) {
|
||||
global $config;
|
||||
$truncate_at_end = false;
|
||||
|
@ -211,7 +212,11 @@ function ui_print_truncate_text(
|
|||
}
|
||||
|
||||
if ($forced_title === true) {
|
||||
$truncateText = '<span class="forced_title" style="'.$style.'" data-title="'.$text.'" data-use_title_for_force_title="1>'.$truncateText.'</span>';
|
||||
if ($text_title !== '') {
|
||||
$truncateText = '<span class="forced_title" style="'.$style.'" data-title="'.$text_title.'" data-use_title_for_force_title="1">'.$truncateText.'</span>';
|
||||
} else {
|
||||
$truncateText = '<span class="forced_title" style="'.$style.'" data-title="'.$text.'" data-use_title_for_force_title="1">'.$truncateText.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($return == true) {
|
||||
|
|
|
@ -806,6 +806,10 @@ function edit_node(data_node, dblClick) {
|
|||
var flag_edit_node = true;
|
||||
var edit_node = null;
|
||||
|
||||
if (networkmap_write === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Only select one node
|
||||
var selection = d3_nm.selectAll(".node_selected");
|
||||
var id;
|
||||
|
@ -1950,6 +1954,10 @@ function init_minimap() {
|
|||
// Context menu
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function show_menu(item, data) {
|
||||
if (networkmap_write === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mouse = [];
|
||||
mouse[0] = d3_nm.event.pageX;
|
||||
mouse[1] = d3_nm.event.pageY;
|
||||
|
@ -2819,6 +2827,10 @@ function cancel_set_parent() {
|
|||
// OWN CODE FOR TO DRAG
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function init_drag_and_drop() {
|
||||
if (networkmap_write === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
window.dragables = svg.selectAll(".dragable_node");
|
||||
|
||||
window.drag_start = [0, 0];
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* global $ */
|
||||
// Droppable options.
|
||||
var droppableOptions = {
|
||||
accept: ".draggable",
|
||||
|
@ -422,12 +423,38 @@ $("[data-button=new]").click(function(e) {
|
|||
});
|
||||
});
|
||||
|
||||
function updateSelect(element, fields, selected) {
|
||||
if (typeof fields === "object") {
|
||||
$(element)
|
||||
.find("select option[value!=0]")
|
||||
.remove();
|
||||
$(element)
|
||||
.find(".select2-container .select2-selection__rendered")
|
||||
.empty();
|
||||
Object.keys(fields).forEach(function(key) {
|
||||
if (key === selected) {
|
||||
$(element)
|
||||
.find(".select2-container .select2-selection__rendered")
|
||||
.append(`${fields[key]}`);
|
||||
$(element)
|
||||
.find("select")
|
||||
.append(`<option value="${key}" selected>${fields[key]}</option>`);
|
||||
} else {
|
||||
$(element)
|
||||
.find("select")
|
||||
.append(`<option value="${key}">${fields[key]}</option>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Save graps modal.
|
||||
$("[data-button=save]").click(function(e) {
|
||||
// Filter save mode selector
|
||||
$("#save_filter_row1").show();
|
||||
$("#save_filter_row2").show();
|
||||
$("#update_filter_row1").hide();
|
||||
$("#delete_filter_row2").hide();
|
||||
$("#radiobtn0002").prop("checked", false);
|
||||
$("#radiobtn0001").prop("checked", true);
|
||||
$("#text-id_name").val("");
|
||||
|
@ -438,20 +465,43 @@ $("[data-button=save]").click(function(e) {
|
|||
$("#save_filter_row2").show();
|
||||
$("#submit-save_filter").show();
|
||||
$("#update_filter_row1").hide();
|
||||
} else {
|
||||
$("#delete_filter_row2").hide();
|
||||
} else if ($(this).val() == "update") {
|
||||
$("#save_filter_row1").hide();
|
||||
$("#save_filter_row2").hide();
|
||||
$("#update_filter_row1").show();
|
||||
$("#submit-save_filter").hide();
|
||||
$("#delete_filter_row2").hide();
|
||||
} else {
|
||||
$("#save_filter_row1").hide();
|
||||
$("#save_filter_row2").hide();
|
||||
$("#update_filter_row1").hide();
|
||||
$("#submit-save_filter").hide();
|
||||
$("#delete_filter_row2").show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#save-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 350
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_list_filters: 1
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
updateSelect("#save_filter_form", data, 0);
|
||||
$("#save-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 350,
|
||||
title: titleModalActions
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -535,14 +585,67 @@ function save_update_filter() {
|
|||
});
|
||||
}
|
||||
|
||||
// Delete filter.
|
||||
function delete_filter() {
|
||||
confirmDialog({
|
||||
title: titleDelete,
|
||||
message: messageDelete,
|
||||
onAccept: function() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
delete_filter: $("#delete_filter").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data == "deleted") {
|
||||
confirmDialog({
|
||||
title: titleDeleteConfirm,
|
||||
message: messageDeleteConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: titleDeleteError,
|
||||
message: messageDeleteError,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Load graps modal.
|
||||
$("[data-button=load]").click(function(e) {
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_list_filters: 1
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
updateSelect("#load_filter_form", data, 0);
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -618,12 +721,26 @@ function loadFilter(url, filterId, homeurl, id) {
|
|||
|
||||
// Share button.
|
||||
$("[data-button=share]").click(function(e) {
|
||||
$("#share-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_list_filters: 1
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
updateSelect("#share_form-0-0", data, 0);
|
||||
$("#share-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -643,13 +760,27 @@ $("#button-share-modal").click(function(e) {
|
|||
|
||||
// Export button.
|
||||
$("[data-button=export]").click(function(e) {
|
||||
$("#export-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto",
|
||||
title: titleExport
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_list_filters: 1
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
updateSelect("#export_form-0-0", data, 0);
|
||||
$("#export-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto",
|
||||
title: titleExport
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -669,10 +800,10 @@ function exportCustomGraph() {
|
|||
group
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
if (data === "created") {
|
||||
confirmDialog({
|
||||
title: titleExportConfirm,
|
||||
message: data + " " + messageExportConfirm,
|
||||
message: messageExportConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
|
|
|
@ -2366,7 +2366,7 @@ $(document).ready(function() {
|
|||
// Hidden tips modal.
|
||||
$(".window").css("display", "none");
|
||||
|
||||
var type_about = "about_operation";
|
||||
var type_about = "about";
|
||||
if ($(this).attr("id") === "icon_about") {
|
||||
type_about = "about";
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ function show_option_dialog(settings) {
|
|||
modal: {
|
||||
title: settings.title,
|
||||
cancel: settings.btn_cancel,
|
||||
ok: settings.btn_text
|
||||
ok: settings.btn_text,
|
||||
overlay: true
|
||||
},
|
||||
onshow: {
|
||||
page: settings.url,
|
||||
|
@ -22,6 +23,12 @@ function show_option_dialog(settings) {
|
|||
method: "updateDashboard",
|
||||
dataType: "json"
|
||||
},
|
||||
oncancel: {
|
||||
reload: true
|
||||
},
|
||||
onclose: {
|
||||
reload: true
|
||||
},
|
||||
ajax_callback: update_dashboard
|
||||
});
|
||||
}
|
||||
|
@ -43,14 +50,14 @@ function update_dashboard(data) {
|
|||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function showGroup() {
|
||||
$("#li-group").removeClass("hidden");
|
||||
$("#li-group_form").removeClass("hidden");
|
||||
var private = $("#private").prop("checked");
|
||||
if (private) {
|
||||
$("#id_group").removeAttr("required");
|
||||
$("#li-group").hide();
|
||||
$("#li-group_form").hide();
|
||||
} else {
|
||||
$("#id_group").attr("required", true);
|
||||
$("#li-group").show();
|
||||
$("#li-group_form").show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,6 +465,12 @@ function initialiceLayout(data) {
|
|||
}*/
|
||||
|
||||
function configurationWidget(cellId, widgetId, size) {
|
||||
var reload = 0;
|
||||
var overlay = false;
|
||||
if (widgetId == 46) {
|
||||
reload = 1;
|
||||
overlay = true;
|
||||
}
|
||||
title = $("#hidden-widget_name_" + cellId).val();
|
||||
load_modal({
|
||||
target: $("#modal-config-widget"),
|
||||
|
@ -466,7 +479,8 @@ function initialiceLayout(data) {
|
|||
modal: {
|
||||
title: "Configure widget " + title,
|
||||
cancel: "Cancel",
|
||||
ok: "Ok"
|
||||
ok: "Ok",
|
||||
overlay: overlay
|
||||
},
|
||||
onshow: {
|
||||
page: data.page,
|
||||
|
@ -484,8 +498,12 @@ function initialiceLayout(data) {
|
|||
method: "saveWidgetIntoCell",
|
||||
dataType: "json"
|
||||
},
|
||||
oncancel: {
|
||||
reload: reload
|
||||
},
|
||||
ajax_callback: update_widget_to_cell,
|
||||
onsubmitClose: 1
|
||||
onsubmitClose: 1,
|
||||
onsubmitReload: reload
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -528,7 +546,7 @@ function initialiceLayout(data) {
|
|||
$(".add-widget").show();
|
||||
$(".new-widget-message").hide();
|
||||
$("#container-layout").addClass("container-layout");
|
||||
$("#add-widget").removeClass("invisible");
|
||||
$("#add-widget").removeClass("invisible_important");
|
||||
} else {
|
||||
grid.movable(".grid-stack-item", false);
|
||||
grid.resizable(".grid-stack-item", false);
|
||||
|
@ -537,7 +555,7 @@ function initialiceLayout(data) {
|
|||
$(".add-widget").hide();
|
||||
$(".new-widget-message").show();
|
||||
$("#container-layout").removeClass("container-layout");
|
||||
$("#add-widget").addClass("invisible");
|
||||
$("#add-widget").addClass("invisible_important");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -948,6 +966,11 @@ function processTreeSearch(settings) {
|
|||
recipient: $("div#tree-controller-recipient_" + settings.cellId),
|
||||
detailRecipient: {
|
||||
render: function(element, data) {
|
||||
let title = "Module information";
|
||||
if ($(data).find("#tree_view_agent_detail-name").length > 0) {
|
||||
title = "Agent information";
|
||||
}
|
||||
|
||||
return {
|
||||
open: function() {
|
||||
$("#module_details_window")
|
||||
|
@ -958,7 +981,7 @@ function processTreeSearch(settings) {
|
|||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: "Info module",
|
||||
title: title,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
|
|
|
@ -1783,3 +1783,49 @@ function openEvents(severity) {
|
|||
$('input[name="filter[severity]"]').val(severity);
|
||||
$("#event_redirect").submit();
|
||||
}
|
||||
|
||||
// Load Asteroids game.
|
||||
$(window).on("load", function() {
|
||||
let counter = 0;
|
||||
$("#button-sound_events_button")
|
||||
.off("click")
|
||||
.on("click", function(e) {
|
||||
counter++;
|
||||
let flagEasternEgg = $("#flagEasternEgg").val();
|
||||
if (counter == 12 && flagEasternEgg == true) {
|
||||
$("#modal-asteroids")
|
||||
.dialog({
|
||||
title: "Asteroids",
|
||||
resizable: true,
|
||||
modal: true,
|
||||
width: 900,
|
||||
height: 700,
|
||||
open: function() {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: getUrlAjax(),
|
||||
data: {
|
||||
page: "include/ajax/events",
|
||||
playAsteroids: 1
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#modal-asteroids").html(data);
|
||||
$(".ui-widget-content").css("background", "#222");
|
||||
$(".ui-dialog-title").css("color", "#fff");
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
counter = 0;
|
||||
$(".ui-widget-content").css("background", "#fff");
|
||||
$(".ui-dialog-title").css("color", "rgb(51, 51, 51)");
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -160,6 +160,7 @@ function configure_modules_form() {
|
|||
}
|
||||
|
||||
$("#id_module_group").val(data["id_module_group"]);
|
||||
$("#id_module_group").trigger("change");
|
||||
|
||||
if (data["history_data"]) $("#checkbox-history_data").check();
|
||||
else $("#checkbox-history_data").uncheck();
|
||||
|
|
|
@ -105,7 +105,16 @@ function load_modal(settings) {
|
|||
}
|
||||
|
||||
if (settings.modal.overlay === true) {
|
||||
$("body").append("<div id='modal_overlay'class='ui-widget-overlay'></div>");
|
||||
var extraClass = "";
|
||||
if (typeof settings.modal.overlayExtraClass !== "undefined") {
|
||||
extraClass = " " + settings.modal.overlayExtraClass;
|
||||
}
|
||||
|
||||
$("body").append(
|
||||
"<div id='modal_overlay'class='ui-widget-overlay" +
|
||||
extraClass +
|
||||
"'></div>"
|
||||
);
|
||||
}
|
||||
|
||||
if (settings.beforeClose == undefined) {
|
||||
|
@ -157,7 +166,7 @@ function load_modal(settings) {
|
|||
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel secondaryButton",
|
||||
id: settings.modal.cancel_button_id,
|
||||
text: settings.modal.cancel,
|
||||
click: function() {
|
||||
|
@ -165,6 +174,8 @@ function load_modal(settings) {
|
|||
if (typeof settings.oncancel.confirm == "function") {
|
||||
//receive function
|
||||
settings.oncancel.confirm(cancelModal);
|
||||
} else if (settings.oncancel.reload == true) {
|
||||
location.reload();
|
||||
} else if (settings.oncancel != undefined) {
|
||||
cancelModal();
|
||||
}
|
||||
|
@ -344,6 +355,13 @@ function load_modal(settings) {
|
|||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
|
||||
if (
|
||||
settings.onsubmitReload != undefined &&
|
||||
settings.onsubmitReload == true
|
||||
) {
|
||||
location.reload();
|
||||
}
|
||||
} else {
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
|
@ -574,7 +592,7 @@ function confirmDialog(settings, idDialog = uniqId()) {
|
|||
: settings.strCancelButton,
|
||||
class:
|
||||
hideCancelButton +
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel secondaryButton",
|
||||
click: function() {
|
||||
if (typeof settings.notCloseOnDeny == "undefined") {
|
||||
$(this).dialog("close");
|
||||
|
|
|
@ -2413,22 +2413,11 @@ date: 2018-05-14 15:05:04
|
|||
});
|
||||
}
|
||||
|
||||
console.log(vCard);
|
||||
formattedVCardString +=
|
||||
"FN" + encodingPrefix + ":" + e(formattedName) + nl();
|
||||
formattedVCardString +=
|
||||
"N" +
|
||||
encodingPrefix +
|
||||
":" +
|
||||
e(vCard.lastName) +
|
||||
";" +
|
||||
e(vCard.firstName) +
|
||||
";" +
|
||||
e(vCard.middleName) +
|
||||
";" +
|
||||
e(vCard.namePrefix) +
|
||||
";" +
|
||||
e(vCard.nameSuffix) +
|
||||
nl();
|
||||
"N" + encodingPrefix + ":" + e(vCard.firstName) + nl();
|
||||
|
||||
if (vCard.nickname && majorVersion >= 3) {
|
||||
formattedVCardString +=
|
||||
|
|
|
@ -1056,6 +1056,7 @@ class Manager implements PublicLogin
|
|||
'name' => $name,
|
||||
'id_user' => $id_user,
|
||||
'id_group' => $id_group,
|
||||
'cells' => 1,
|
||||
'cells_slideshow' => $slideshow,
|
||||
'active' => $favourite,
|
||||
'date_range' => $dateRange,
|
||||
|
@ -1367,6 +1368,7 @@ class Manager implements PublicLogin
|
|||
global $config;
|
||||
|
||||
$items = \get_parameter('items', []);
|
||||
$totalCells = 0;
|
||||
|
||||
// Class Dashboard.
|
||||
if (empty($items) === false) {
|
||||
|
@ -1398,8 +1400,15 @@ class Manager implements PublicLogin
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($items) === true) {
|
||||
$totalCells = count($items);
|
||||
}
|
||||
}
|
||||
|
||||
$values = ['cells' => $totalCells];
|
||||
$this->put($values);
|
||||
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,10 @@ class EventsListWidget extends Widget
|
|||
$values['groupRecursion'] = $decoder['groupRecursion'];
|
||||
}
|
||||
|
||||
if (isset($decoder['secondaryGroup']) === true) {
|
||||
$values['secondaryGroup'] = $decoder['secondaryGroup'];
|
||||
}
|
||||
|
||||
if (isset($decoder['customFilter']) === true) {
|
||||
$values['customFilter'] = $decoder['customFilter'];
|
||||
}
|
||||
|
@ -456,6 +460,18 @@ class EventsListWidget extends Widget
|
|||
],
|
||||
];
|
||||
|
||||
// Secondary group.
|
||||
$inputs['inputs']['row2'][] = [
|
||||
'label' => \__('Secondary group'),
|
||||
'arguments' => [
|
||||
'type' => 'switch',
|
||||
'name' => 'secondaryGroup',
|
||||
'class' => 'event-widget-input',
|
||||
'value' => $values['secondaryGroup'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Group recursion.
|
||||
$inputs['inputs']['row2'][] = [
|
||||
'label' => \__('Group recursion'),
|
||||
|
@ -537,6 +553,7 @@ class EventsListWidget extends Widget
|
|||
$values['groupId'] = \get_parameter_switch('groupId', []);
|
||||
$values['tagsId'] = \get_parameter_switch('tagsId', []);
|
||||
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
|
||||
$values['secondaryGroup'] = \get_parameter('secondaryGroup', 0);
|
||||
$values['customFilter'] = \get_parameter('customFilter', -1);
|
||||
$values['columns_events_widget'] = \get_parameter('columns_events_widget', []);
|
||||
|
||||
|
@ -721,6 +738,7 @@ class EventsListWidget extends Widget
|
|||
$this->values['limit'] = $config['block_size'];
|
||||
}
|
||||
|
||||
$filter['search_secondary_groups'] = $this->values['secondaryGroup'];
|
||||
// Print datatable.
|
||||
$output .= ui_print_datatable(
|
||||
[
|
||||
|
|
|
@ -293,6 +293,8 @@ class GroupsStatusWidget extends Widget
|
|||
(bool) $this->values['groupRecursion']
|
||||
);
|
||||
|
||||
$style = 'min-width:200px; min-height:460px;';
|
||||
|
||||
$data = '<div class="widget-groups-status"><span>';
|
||||
$data .= ui_print_group_icon(
|
||||
$this->values['groupId'],
|
||||
|
@ -541,9 +543,9 @@ class GroupsStatusWidget extends Widget
|
|||
$table->data[1][0] = __('Not agents in this group');
|
||||
$data .= html_print_table($table, true);
|
||||
$data .= '</div>';
|
||||
$style .= 'justify-content: start; margin-top: 20px';
|
||||
}
|
||||
|
||||
$style = 'min-width:200px; min-height:460px;';
|
||||
$output = '<div class="container-center" style="'.$style.'">';
|
||||
$output .= $data;
|
||||
$output .= '</div>';
|
||||
|
|
|
@ -177,6 +177,9 @@ class InventoryWidget extends Widget
|
|||
|
||||
// Must be configured before using.
|
||||
$this->configurationRequired = false;
|
||||
if (isset($this->values['idGroup']) === false) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,9 +299,12 @@ class InventoryWidget extends Widget
|
|||
];
|
||||
|
||||
$fields = [];
|
||||
|
||||
array_unshift($fields, __('All'));
|
||||
|
||||
if (isset($values['inventoryModuleId']) === false) {
|
||||
$values['inventoryModuleId'] = 0;
|
||||
}
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Module'),
|
||||
'arguments' => [
|
||||
|
@ -316,31 +322,6 @@ class InventoryWidget extends Widget
|
|||
],
|
||||
];
|
||||
|
||||
// Agent select.
|
||||
if ($is_metaconsole === false) {
|
||||
$agents = [];
|
||||
$sql = 'SELECT id_agente, nombre FROM tagente';
|
||||
if ($inventory_id_group > 0) {
|
||||
$sql .= ' WHERE id_grupo = '.$inventory_id_group;
|
||||
} else {
|
||||
$user_groups = implode(',', array_keys(users_get_groups($config['id_user'])));
|
||||
|
||||
// Avoid errors if there are no groups.
|
||||
if (empty($user_groups) === true) {
|
||||
$user_groups = '"0"';
|
||||
}
|
||||
|
||||
$sql .= ' WHERE id_grupo IN ('.$user_groups.')';
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if ($result) {
|
||||
foreach ($result as $row) {
|
||||
$agents[$row['id_agente']] = $row['nombre'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Date filter.
|
||||
if (is_metaconsole() === false) {
|
||||
$inputs[] = [
|
||||
|
|
|
@ -252,7 +252,7 @@ class SecurityHardening extends Widget
|
|||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Ingore skipped'),
|
||||
'label' => __('Ignore skipped'),
|
||||
'id' => 'row_ignore_skipped',
|
||||
'class' => 'row_input',
|
||||
'arguments' => [
|
||||
|
@ -274,9 +274,9 @@ class SecurityHardening extends Widget
|
|||
'name' => 'range',
|
||||
'type' => 'date_range',
|
||||
'selected' => 'chose_range',
|
||||
'date_init' => date('Y-m-d', $values['date_init']),
|
||||
'date_init' => date('Y/m/d', $values['date_init']),
|
||||
'time_init' => date('H:i:s', $values['date_init']),
|
||||
'date_end' => date('Y-m-d', $values['date_end']),
|
||||
'date_end' => date('Y/m/d', $values['date_end']),
|
||||
'time_end' => date('H:i:s', $values['date_end']),
|
||||
'return' => true,
|
||||
],
|
||||
|
|
|
@ -352,6 +352,7 @@ class Agents extends Element
|
|||
*/
|
||||
public function getStatusGraph():string
|
||||
{
|
||||
$data = [];
|
||||
$agents = agents_get_agents(
|
||||
false,
|
||||
[
|
||||
|
@ -436,12 +437,16 @@ class Agents extends Element
|
|||
$percentages = [];
|
||||
$total = array_sum($data);
|
||||
foreach ($data as $key => $value) {
|
||||
$percentage = (($value / $total) * 100);
|
||||
if ($percentage < 1 && $percentage > 0) {
|
||||
$percentage = 1;
|
||||
}
|
||||
if ($total > 0) {
|
||||
$percentage = (($value / $total) * 100);
|
||||
if ($percentage < 1 && $percentage > 0) {
|
||||
$percentage = 1;
|
||||
}
|
||||
|
||||
$percentages[$key] = format_numeric($percentage, 0);
|
||||
$percentages[$key] = format_numeric($percentage, 0);
|
||||
} else {
|
||||
$percentages[$key] = '0%';
|
||||
}
|
||||
}
|
||||
|
||||
$data = $percentages;
|
||||
|
|
|
@ -45,6 +45,7 @@ class Groups extends Element
|
|||
parent::__construct();
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
include_once $config['homedir'].'/include/functions_groupview.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
$this->ajaxMethods = ['getStatusHeatMap'];
|
||||
ui_require_css_file('heatmap');
|
||||
$this->title = __('Groups');
|
||||
|
@ -113,116 +114,119 @@ class Groups extends Element
|
|||
$id_groups = implode(',', $id_groups);
|
||||
|
||||
$modules = modules_get_modules_in_group($id_groups);
|
||||
$total_groups = count($modules);
|
||||
if ($total_groups === 0) {
|
||||
return graph_nodata_image(['width' => '400']);
|
||||
}
|
||||
|
||||
// Best square.
|
||||
$high = (float) max($width, $height);
|
||||
$low = 0.0;
|
||||
|
||||
while (abs($high - $low) > 0.000001) {
|
||||
$mid = (($high + $low) / 2.0);
|
||||
$midval = (floor($width / $mid) * floor($height / $mid));
|
||||
if ($midval >= $total_groups) {
|
||||
$low = $mid;
|
||||
} else {
|
||||
$high = $mid;
|
||||
}
|
||||
}
|
||||
|
||||
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
|
||||
// Print starmap.
|
||||
$heatmap = sprintf(
|
||||
'<svg id="svg" style="width: %spx; height: %spx;">',
|
||||
$width,
|
||||
$height
|
||||
);
|
||||
|
||||
$heatmap .= '<g>';
|
||||
$row = 0;
|
||||
$column = 0;
|
||||
$x = 0;
|
||||
$y = 0;
|
||||
$cont = 1;
|
||||
foreach ($modules as $key => $value) {
|
||||
$module_id = $value['id_agente_modulo'];
|
||||
$module_status = db_get_row(
|
||||
'tagente_estado',
|
||||
'id_agente_modulo',
|
||||
$module_id,
|
||||
);
|
||||
|
||||
$module_value = modules_get_last_value($module_id);
|
||||
$status = '';
|
||||
$title = '';
|
||||
modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
|
||||
switch ($status) {
|
||||
case STATUS_MODULE_NO_DATA:
|
||||
// Not init status.
|
||||
$status = 'notinit';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_CRITICAL:
|
||||
// Critical status.
|
||||
$status = 'critical';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_WARNING:
|
||||
// Warning status.
|
||||
$status = 'warning';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_OK:
|
||||
// Normal status.
|
||||
$status = 'normal';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case -1:
|
||||
default:
|
||||
// Unknown status.
|
||||
$status = 'unknown';
|
||||
break;
|
||||
$heatmap = '';
|
||||
if (is_array($modules) === true) {
|
||||
$total_groups = count($modules);
|
||||
if ($total_groups === 0) {
|
||||
return graph_nodata_image(['width' => '400']);
|
||||
}
|
||||
|
||||
$redirect = '';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
|
||||
// Best square.
|
||||
$high = (float) max($width, $height);
|
||||
$low = 0.0;
|
||||
|
||||
while (abs($high - $low) > 0.000001) {
|
||||
$mid = (($high + $low) / 2.0);
|
||||
$midval = (floor($width / $mid) * floor($height / $mid));
|
||||
if ($midval >= $total_groups) {
|
||||
$low = $mid;
|
||||
} else {
|
||||
$high = $mid;
|
||||
}
|
||||
}
|
||||
|
||||
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
|
||||
// Print starmap.
|
||||
$heatmap .= sprintf(
|
||||
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
|
||||
'rect_'.$cont,
|
||||
$x,
|
||||
$value['nombre'],
|
||||
$y,
|
||||
$row,
|
||||
$column,
|
||||
$square_length,
|
||||
$square_length,
|
||||
$status,
|
||||
random_int(1, 10)
|
||||
'<svg id="svg" style="width: %spx; height: %spx;">',
|
||||
$width,
|
||||
$height
|
||||
);
|
||||
|
||||
$y += $square_length;
|
||||
$row++;
|
||||
if ((int) ($y + $square_length) > (int) $height) {
|
||||
$y = 0;
|
||||
$x += $square_length;
|
||||
$row = 0;
|
||||
$column++;
|
||||
}
|
||||
$heatmap .= '<g>';
|
||||
$row = 0;
|
||||
$column = 0;
|
||||
$x = 0;
|
||||
$y = 0;
|
||||
$cont = 1;
|
||||
foreach ($modules as $key => $value) {
|
||||
$module_id = $value['id_agente_modulo'];
|
||||
$module_status = db_get_row(
|
||||
'tagente_estado',
|
||||
'id_agente_modulo',
|
||||
$module_id,
|
||||
);
|
||||
|
||||
$module_value = modules_get_last_value($module_id);
|
||||
$status = '';
|
||||
$title = '';
|
||||
modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
|
||||
switch ($status) {
|
||||
case STATUS_MODULE_NO_DATA:
|
||||
// Not init status.
|
||||
$status = 'notinit';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_CRITICAL:
|
||||
// Critical status.
|
||||
$status = 'critical';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_WARNING:
|
||||
// Warning status.
|
||||
$status = 'warning';
|
||||
break;
|
||||
|
||||
case STATUS_MODULE_OK:
|
||||
// Normal status.
|
||||
$status = 'normal';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case -1:
|
||||
default:
|
||||
// Unknown status.
|
||||
$status = 'unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$redirect = '';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
|
||||
}
|
||||
|
||||
$heatmap .= sprintf(
|
||||
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
|
||||
'rect_'.$cont,
|
||||
$x,
|
||||
$value['nombre'],
|
||||
$y,
|
||||
$row,
|
||||
$column,
|
||||
$square_length,
|
||||
$square_length,
|
||||
$status,
|
||||
random_int(1, 10)
|
||||
);
|
||||
|
||||
if ((int) ($x + $square_length) > (int) $width) {
|
||||
$x = 0;
|
||||
$y += $square_length;
|
||||
$column = 0;
|
||||
$row++;
|
||||
}
|
||||
if ((int) ($y + $square_length) > (int) $height) {
|
||||
$y = 0;
|
||||
$x += $square_length;
|
||||
$row = 0;
|
||||
$column++;
|
||||
}
|
||||
|
||||
$cont++;
|
||||
if ((int) ($x + $square_length) > (int) $width) {
|
||||
$x = 0;
|
||||
$y += $square_length;
|
||||
$column = 0;
|
||||
$row++;
|
||||
}
|
||||
|
||||
$cont++;
|
||||
}
|
||||
}
|
||||
|
||||
$heatmap .= '<script type="text/javascript">
|
||||
|
@ -289,7 +293,8 @@ class Groups extends Element
|
|||
|
||||
$sql = 'SELECT * FROM tagente a
|
||||
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
|
||||
WHERE g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.')';
|
||||
WHERE (g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.'))
|
||||
AND a.disabled = 0';
|
||||
$all_agents = db_get_all_rows_sql($sql);
|
||||
if (empty($all_agents)) {
|
||||
return null;
|
||||
|
@ -484,7 +489,7 @@ class Groups extends Element
|
|||
$y = 0;
|
||||
$cont = 1;
|
||||
foreach ($groups as $key => $value) {
|
||||
if ($value['_name_'] === 'All') {
|
||||
if ($value['_name_'] === __('All')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,13 +156,15 @@ class ScheduledDowntime extends Element
|
|||
'cron_interval_from',
|
||||
'cron_interval_to',
|
||||
];
|
||||
|
||||
$groups = implode(',', array_keys(users_get_groups($config['user'])));
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tplanned_downtime
|
||||
WHERE id_group IN (%s)
|
||||
%s %s',
|
||||
$columns_str,
|
||||
$groups,
|
||||
$order,
|
||||
$pagination,
|
||||
);
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
*
|
||||
* Name: Default theme
|
||||
* Pandora Stylesheet
|
||||
*
|
||||
* @category Stylesheet
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
div#asteroids {
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
margin: 50px auto;
|
||||
width: 640px;
|
||||
border: 1px solid #fff;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div#asteroids > * {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div#asteroids > div {
|
||||
font-family: "System", monospace;
|
||||
font-size: 11px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
div#asteroids > div > span {
|
||||
float: right;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
div#instructions {
|
||||
width: 640px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#div-filtered-module-group-modules,
|
||||
#div-filtered-module-module-group-modules,
|
||||
#div-filtered-module-agents-modules,
|
||||
#div-filtered-module-modules-modules {
|
||||
width: 37% !important;
|
||||
}
|
||||
#div-filtered-module-modules-modules select {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
#select_multiple_modules_filtered > div > div > .select2 {
|
||||
width: 100% !important;
|
||||
}
|
||||
#select_multiple_modules_filtered > div {
|
||||
flex-wrap: nowrap !important;
|
||||
}
|