diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index e947fc83f5..66e995fd2c 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -1,24 +1,39 @@ headstyle[1] = 'text-align:center'; $table->headstyle[3] = 'text-align:center'; $table->headstyle[8] = 'text-align:right;width: 120px;'; -// $table->title = __('Tactical server information'); $table->titleclass = 'tabletitle'; $table->titlestyle = 'text-transform:uppercase;'; @@ -69,11 +83,11 @@ $table->head[3] = __('Version'); $table->head[4] = __('Modules'); $table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true); $table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true); -// This will have a column of data such as "6 hours" +// This will have a column of data such as "6 hours". $table->head[7] = __('Updated'); -// Only Pandora Administrator can delete servers -if (check_acl($config['id_user'], 0, 'PM')) { +// Only Pandora Administrator can delete servers. +if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { $table->head[8] = ''.__('Op.').''; } @@ -89,14 +103,14 @@ foreach ($servers as $server) { foreach ($servers as $server) { $data = []; - // $table->cellclass[][3] = 'progress_bar'; + $table->cellclass[] = [ 3 => 'progress_bar', 8 => 'action_buttons', ]; $data[0] = ''.strip_tags($server['name']).''; - // Status + // Status. $data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true); if ($server['status'] == -1) { $data[1] = ui_print_status_image( @@ -104,7 +118,7 @@ foreach ($servers as $server) { __('Server has crashed.'), true ); - } else if (($server['status'] == 0) + } else if ((int) ($server['status'] === 0) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2) ) { $data[1] = ui_print_status_image( @@ -114,13 +128,13 @@ foreach ($servers as $server) { ); } - // Type + // Type. $data[2] = ''.$server['img']; if ($server['master'] == $master) { $data[2] .= ui_print_help_tip(__('This is a master server'), true); } - if ($server['exec_proxy'] == 1) { + if ((int) $server['exec_proxy'] === 1) { $data[2] .= html_print_image('images/star.png', true, ['title' => __('Exec server enabled')]); } @@ -169,11 +183,11 @@ foreach ($servers as $server) { } } - // Only Pandora Administrator can delete servers - if (check_acl($config['id_user'], 0, 'PM')) { + // Only Pandora Administrator can delete servers. + if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { $data[8] = ''; - if ($server['type'] == 'recon') { + if ($server['type'] === 'recon') { $data[8] .= ''; $data[8] .= html_print_image( 'images/first_task/icono_grande_reconserver.png', @@ -188,7 +202,7 @@ foreach ($servers as $server) { $data[8] .= ''; } - if ($server['type'] == 'data') { + if ($server['type'] === 'data') { $data[8] .= ''; $data[8] .= html_print_image( 'images/target.png', @@ -199,7 +213,7 @@ foreach ($servers as $server) { ] ); $data[8] .= ''; - } else if ($server['type'] == 'enterprise snmp') { + } else if ($server['type'] === 'enterprise snmp') { $data[8] .= ''; $data[8] .= html_print_image( 'images/target.png', @@ -223,7 +237,7 @@ foreach ($servers as $server) { ); $data[8] .= ''; - if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) { + if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) { $data[8] .= ''; $data[8] .= html_print_image( 'images/remote_configuration.png',