#12695 wip removing warnings

This commit is contained in:
Jonathan 2024-02-14 17:43:20 +01:00
parent da2bef45f2
commit 42975c7967
27 changed files with 157 additions and 106 deletions

View File

@ -109,7 +109,7 @@ if (is_ajax()) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_description = $fields_descriptions[($i - 1)];
$field_value = $fields_values[($i - 1)];
$field_hidden = $fields_hidden_checked[($i - 1)];
$field_hidden = (isset($fields_hidden_checked[($i - 1)]) === true) ? $fields_hidden_checked[($i - 1)] : '';
if (!empty($field_description)) {

View File

@ -253,7 +253,7 @@ if (is_metaconsole() === true) {
echo '<br>';
}
if (!$id_cluster) {
if (isset($id_cluster) === false) {
ui_toggle(
$form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>',
@ -1115,7 +1115,7 @@ if (isset($dont_display_alert_create_bttn)) {
}
}
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && isset($id_cluster) === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
$actionButtons = html_print_submit_button(
__('Create'),

View File

@ -242,6 +242,7 @@ if (empty($result) === false) {
html_print_table($table);
$tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false);
} else {
$tablePagination = '';
// No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
}

View File

@ -195,13 +195,13 @@ foreach ($extensions as $file => $extension) {
$data[] = '<i class="grey">'.$file.'</i>';
// Get version of this extensions
if ($config['extensions'][$file]['operation_menu']) {
if (isset($config['extensions'][$file]['operation_menu']) === true) {
$data[] = $config['extensions'][$file]['operation_menu']['version'];
} else if ($config['extensions'][$file]['godmode_menu']) {
} else if (isset($config['extensions'][$file]['godmode_menu']) === true) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if ($config['extensions'][$file]['extension_ope_tab']) {
} else if (isset($config['extensions'][$file]['extension_ope_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) {
} else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else {
$data[] = __('N/A');
@ -216,7 +216,7 @@ foreach ($extensions as $file => $extension) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) {
} else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else {
$data[] = __('N/A');

View File

@ -1183,9 +1183,9 @@ $tab = 'group_edition';
<script type="text/javascript">
let show_full_hirearchy = "<?php echo $show_full_hirearchy; ?>";
let show_not_init_agents = "<?php echo $show_not_init_agents; ?>";
let show_not_init_modules = "<?php echo $show_not_init_modules; ?>";
let show_full_hirearchy = "<?php echo (isset($show_full_hirearchy) === true) ? $show_full_hirearchy : ''; ?>";
let show_not_init_agents = "<?php echo (isset($show_not_init_agents) === true) ? $show_not_init_agents : ''; ?>";
let show_not_init_modules = "<?php echo (isset($show_not_init_modules) === true) ? $show_not_init_modules : ''; ?>";
$('#checkbox-show_full_hirearchy').on("change", function() {
if (show_full_hirearchy == 1) {

View File

@ -686,6 +686,12 @@ $table->data[0][] = html_print_label_input_block(
)
);
if (isset($component) === false) {
$component = [];
$component['id'] = '';
$component['id_nc'] = '';
}
$filter_action_url = 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&search_string='.urlencode(io_safe_output($search_string)).'&search_id_group'.$search_id_group.'&pure='.$pure;
$toggleFilters = '<form class="filters_form" method="POST" action="'.$filter_action_url.'">';
$toggleFilters .= html_print_table($table, true);
@ -824,7 +830,7 @@ foreach ($components as $component) {
$data[0] = io_safe_output($component['name']);
}
$data[1] .= ui_print_servertype_icon((int) $component['id_modulo']);
$data[1] = ui_print_servertype_icon((int) $component['id_modulo']);
$data[2] = ui_print_moduletype_icon($component['type'], true);
$data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';

View File

@ -496,8 +496,8 @@ if (isset($_GET['server']) === true) {
<script language="javascript" type="text/javascript">
$(document).ready (function () {
var id_server = '<?php echo $id_server; ?>';
var server_type = '<?php echo $row['server_type']; ?>';
var id_server = '<?php echo ($id_server ?? ''); ?>';
var server_type = '<?php echo ($row['server_type'] ?? ''); ?>';
$("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif");

View File

@ -1172,6 +1172,10 @@ if (empty($create) === false || empty($view) === false) {
}
ui_require_javascript_file('pandora_modules');
if (isset($locked) === false) {
$locked = '';
}
?>
<script type="text/javascript">

View File

@ -523,27 +523,29 @@ if ($error === null) {
}
}
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
if (isset($uploaded_filename) === true) {
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
}
}

View File

@ -146,9 +146,9 @@ foreach ($servers as $server) {
// Type.
$data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['server_name'];
if ($server['master'] == $master) {
$data[3] .= __('Yes', true);
$data[3] = __('Yes', true);
} else {
$data[3] .= __('-');
$data[3] = __('-');
}
if ((int) $server['exec_proxy'] === 1) {

View File

@ -70,6 +70,10 @@ if (isset($config['filemanager']['message']) === true) {
// Add custom directories here.
$fallback_directory = 'images';
// Get directory.
if (isset($text) === false) {
$text = '';
}
$directory = (string) get_parameter('directory');
$directory = str_replace('&lt;', '', $text);
$directory = str_replace('&gt;', '', $text);
@ -90,7 +94,12 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
// Remove double dot in filename path.
$file_name = $_FILES['file']['name'];
if (isset($_FILES['file']) === true) {
$file_name = $_FILES['file']['name'];
} else {
$file_name = '';
}
$path_parts = explode('/', $file_name);
$stripped_parts = array_filter(

View File

@ -399,7 +399,7 @@ $table->data[0][0] = html_print_label_input_block(
__('Total Agents'),
html_print_input_text(
'total_agents',
$total_agents,
($total_agents ?? ''),
'',
30,
255,
@ -412,7 +412,7 @@ $table->data[0][1] = html_print_label_input_block(
__('Network & other devices'),
html_print_input_text(
'type_network',
$network_others,
($network_others ?? ''),
'',
30,
255,
@ -425,7 +425,7 @@ $table->data[1][0] = html_print_label_input_block(
__('Workstations'),
html_print_input_text(
'type_workstation',
$workstations,
($workstations ?? ''),
'',
30,
255,
@ -438,7 +438,7 @@ $table->data[1][1] = html_print_label_input_block(
__('Servers'),
html_print_input_text(
'type_server',
$servers,
($servers ?? ''),
'',
30,
255,

View File

@ -389,6 +389,10 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo '<td>'.__('No').'</b></td>';
}
if (isset($tdcolor) === false) {
$tdcolor = '';
}
echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['border' => '0', 'class' => 'invert_filter main_menu_icon']).'</a></td></tr>';
}

View File

@ -164,9 +164,8 @@ if (is_metaconsole() === true) {
html_print_action_buttons(
$buttons,
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
'type' => 'data_table',
'class' => 'fixed_action_buttons',
]
);

View File

@ -2087,7 +2087,7 @@ if ($create_alert || $update_alert) {
FROM talert_actions
ORDER BY name',
'alert_type',
$alert_type,
($alert_type ?? ''),
'',
'',
0,
@ -2100,26 +2100,26 @@ if ($create_alert || $update_alert) {
echo '</tr>';
$al = [
'al_field1' => $al_field1,
'al_field2' => $al_field2,
'al_field3' => $al_field3,
'al_field4' => $al_field4,
'al_field5' => $al_field5,
'al_field6' => $al_field6,
'al_field7' => $al_field7,
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
'al_field1' => ($al_field1 ?? ''),
'al_field2' => ($al_field2 ?? ''),
'al_field3' => ($al_field3 ?? ''),
'al_field4' => ($al_field4 ?? ''),
'al_field5' => ($al_field5 ?? ''),
'al_field6' => ($al_field6 ?? ''),
'al_field7' => ($al_field7 ?? ''),
'al_field8' => ($al_field8 ?? ''),
'al_field9' => ($al_field9 ?? ''),
'al_field10' => ($al_field10 ?? ''),
'al_field11' => ($al_field11 ?? ''),
'al_field12' => ($al_field12 ?? ''),
'al_field13' => ($al_field13 ?? ''),
'al_field14' => ($al_field14 ?? ''),
'al_field15' => ($al_field15 ?? ''),
'al_field16' => ($al_field16 ?? ''),
'al_field17' => ($al_field17 ?? ''),
'al_field18' => ($al_field18 ?? ''),
'al_field19' => ($al_field19 ?? ''),
'al_field20' => ($al_field20 ?? ''),
];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -2287,7 +2287,7 @@ $(document).ready (function () {
});
values.push({
name: "content_type",
value: "<?php echo $al_field4; ?>"
value: "<?php echo ($al_field4 ?? ''); ?>"
})
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,

View File

@ -99,7 +99,7 @@ if (!$action_update_url_update_manager) {
);
$allow_offline_patches = get_parameter_switch(
'allow_offline_patches',
$config['allow_offline_patches']
($config['allow_offline_patches'] ?? '')
);
$lts_updates = get_parameter_switch(
'lts_updates',

View File

@ -321,7 +321,7 @@ class Cloud extends Wizard
ui_print_error_message($this->msg);
}
if ($empty_account === true) {
if (isset($empty_account) === true) {
ui_print_error_message($this->msg);
}
@ -357,7 +357,7 @@ class Cloud extends Wizard
'name' => 'account_identifier',
'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier,
'selected' => (isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '',
'return' => true,
],
],
@ -419,7 +419,7 @@ class Cloud extends Wizard
return false;
}
if ($this->keyIdentifier === null) {
if (isset($this->keyIdentifier) === false) {
// Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list');
$this->status = null;
@ -496,7 +496,7 @@ class Cloud extends Wizard
*/
public function getCredentials()
{
return CredentialStore::getKey($this->keyIdentifier);
return CredentialStore::getKey((isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '');
}

View File

@ -71,7 +71,7 @@ if ($get_all_datatables_formatted === true) {
// Datatables format: RecordsTotal && recordsfiltered.
echo json_encode(
[
'data' => $data,
'data' => ($data ?? ''),
'recordsTotal' => $count,
'recordsFiltered' => $count,
]

View File

@ -410,7 +410,7 @@ class Diagnostics extends Wizard
],
];
$return .= '<div class="title-self-monitoring">';
$return = '<div class="title-self-monitoring">';
$return .= __(
'Graphs modules that represent the self-monitoring system'
);
@ -423,7 +423,7 @@ class Diagnostics extends Wizard
$return .= '</div>';
}
return $return;
return ($return ?? '');
}
@ -1848,6 +1848,10 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
if (isset($config['thousand_separator']) === false) {
$config['thousand_separator'] = '';
}
$value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs');
$status = 0;

View File

@ -427,30 +427,32 @@ class EventSound extends HTML
);
$data = db_get_all_rows_sql($sql);
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$action = __('Enable sound');
$new_action = 1;
if ($data !== false) {
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$action = __('Enable sound');
$new_action = 1;
}
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
}
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
}
echo json_encode(

View File

@ -417,7 +417,10 @@ class ExtensionsDiscovery extends Wizard
public function loadIni()
{
global $config;
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED);
$iniFile = false;
if (file_exists($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini') === true) {
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED);
}
return $iniFile;
}

View File

@ -218,6 +218,10 @@ class HTML
$class = '';
}
if (isset($url['link']) === false) {
$url['link'] = '';
}
$bc[$i] = '';
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label'];

View File

@ -780,8 +780,13 @@ class ModuleTemplates extends HTML
private function setNetworkProfile()
{
$profileInfo = db_get_row('tnetwork_profile', 'id_np', $this->id_np);
$this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
if ($profileInfo !== false) {
$this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
} else {
$this->name = '';
$this->description = '';
}
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
$penList = [];

View File

@ -526,8 +526,10 @@ function filemanager_file_explorer(
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
$allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true;
if ($options['denyCreateText'] === true) {
$allowCreateText = false;
if (isset($options['denyCreateText']) === true) {
if ($options['denyCreateText'] === true) {
$allowCreateText = false;
}
}
if ($homedir_filemanager === false) {

View File

@ -5578,7 +5578,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_image(
((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'],
$data['value'],
($data['value'] ?? ''),
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
@ -5818,7 +5818,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'checkbox':
$output .= html_print_checkbox(
$data['name'],
((isset($data['name']) === true) ? $data['name'] : ''),
($data['value'] ?? null),
((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false),

View File

@ -699,9 +699,9 @@ function menu_get_sec($with_categories=false)
}
$sec_array[$k]['optgroup'] = $category;
$sec_array[$k]['name'] = $v['text'];
$sec_array[$k]['name'] = (isset($v['text']) === true) ? $v['text'] : '';
} else {
$sec_array[$k] = $v['text'];
$sec_array[$k] = (isset($v['text']) === true) ? $v['text'] : '';
}
}

View File

@ -70,7 +70,12 @@ $agents = agents_get_agents(
['nombre LIKE "'.$agentName.'"'],
['id_agente']
);
$agent = $agents[0]['id_agente'];
if ($agents !== false) {
$agent = $agents[0]['id_agente'];
} else {
$agent = '';
}
$module = (array) get_parameter_post('module_arr', []);
$start_date = get_parameter_post('start_date', 0);
@ -292,7 +297,8 @@ if (empty($export_btn) || $show_form) {
break;
default:
continue;
// Nothing.
break;
}
$i++;