php8 incompatibility fixes

This commit is contained in:
fbsanchez 2022-02-07 13:48:25 +01:00
parent ef01e19de9
commit 331f8e8906
11 changed files with 29 additions and 45 deletions

View File

@ -11,6 +11,7 @@ view.setShowPrintMargin(false);
$("#submit-execute_query").click(function() {
view.setValue("");
let text;
let selectText = editor.getSelectedText();
if (selectText === "") {
let allText = editor.getValue();
@ -20,11 +21,11 @@ $("#submit-execute_query").click(function() {
allText = allText.split("\n").join("");
allText = allText.concat("\n");
var text = allText.match("(GET|PUT|POST)(.*?)({.*?}.*?)?(GET|POST|PUT|\n)");
text = allText.match("(GET|PUT|POST)(.*?)({.*?}.*?)?(GET|POST|PUT|\n)");
} else {
selectText = selectText.split("\n").join("");
selectText = selectText.concat("\n");
var text = selectText.match("(GET|PUT|POST)(.*?)({.*?}.*?)?(\n)");
text = selectText.match("(GET|PUT|POST)(.*?)({.*?}.*?)?(\n)");
}
if (

View File

@ -30,7 +30,7 @@ if (!$agents || !$searchAgents) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
}
} else {
$table = new StdClass();
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -23,6 +23,7 @@ $searchAlerts = check_acl($config['id_user'], 0, 'AR');
if ($alerts === false || $totalAlerts == 0 || !$searchAlerts) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -20,6 +20,7 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR');
if ($graphs === false || !$searchGraphs) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -19,6 +19,7 @@ if ($helps === false || !$searchHelps) {
'https://pandorafms.com/manual/start?do=search&id=start&q='.$config['search_keywords']
)."</div>\n";
} else {
$table = new stdClass();
$table->width = '98%';
$table->class = 'databox';

View File

@ -18,53 +18,29 @@ $searchMaps = check_acl($config['id_user'], 0, 'VR');
$maps = false;
$totalMaps = 0;
if ($searchMaps) {
if ((bool) $searchMaps === true) {
$user_groups = users_get_groups($config['id_user'], 'AR', true);
$id_user_groups = array_keys($user_groups);
$id_user_groups_str = implode(',', $id_user_groups);
if (empty($id_user_groups)) {
if (empty($id_user_groups) === true) {
return;
}
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$sql = "SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE tl.name LIKE '%$stringSearchSQL%'
AND tl.id_group IN ($id_user_groups_str)
GROUP BY tl.id, tl.name, tl.id_group";
break;
case 'oracle':
$sql = "SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE upper(tl.name) LIKE '%".strtolower($stringSearchSQL)."%'
AND tl.id_group IN ($id_user_groups_str)
GROUP BY tl.id, tl.name, tl.id_group";
break;
}
$sql = sprintf(
'SELECT tl.id, tl.name, tl.id_group, COUNT(tld.id_layout) AS count
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE tl.name LIKE "%%%s%%"
AND tl.id_group IN (%s)
GROUP BY tl.id, tl.name, tl.id_group',
$stringSearchSQL,
$id_user_groups_str
);
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
break;
case 'oracle':
$set = [];
$set['limit'] = $config['block_size'];
$set['offset'] = (int) get_parameter('offset');
$sql = oracle_recode_query($sql, $set);
break;
}
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
$maps = db_process_sql($sql);

View File

@ -18,6 +18,7 @@ $searchMaps = check_acl($config['id_user'], 0, 'VR');
if ($maps === false || !$searchMaps) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -29,8 +29,8 @@ if (!$modules || !$searchModules) {
$table->class = 'databox';
$table->head = [];
$table->head[0] = __('Module').' '.'<a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).'</a>'.'<a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).'</a>';
$table->head[1] = __('Agent').' '.'<a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).'</a>'.'<a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).'</a>';
$table->head[0] = __('Module').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).'</a>';
$table->head[1] = __('Agent').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).'</a>';
$table->head[2] = __('Type');
$table->head[3] = __('Interval');
$table->head[4] = __('Status');
@ -170,10 +170,10 @@ if (!$modules || !$searchModules) {
$url = 'include/procesos.php?agente='.$module['id_agente_modulo'];
$win_handle = dechex(crc32($module['id_agente_modulo'].$module['module_name']));
$link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module['id_agente_modulo'].'&'.'refresh='.SECONDS_10MINUTES."', "."'day_".$win_handle."')";
$link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES."', "."'day_".$win_handle."')";
$graphCell = '<a href="javascript:'.$link.'">'.html_print_image('images/chart_curve.png', true, ['border' => 0, 'alt' => '']).'</a>';
$graphCell .= '&nbsp;'."<a href='index.php?".'sec=estado&amp;'.'sec2=operation/agentes/ver_agente&amp;'.'id_agente='.$module['id_agente'].'&amp;'.'tab=data_view&'.'period='.SECONDS_1DAY.'&amp;'.'id='.$module['id_agente_modulo']."'>".html_print_image(
$graphCell .= '&nbsp;'."<a href='index.php?".'sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$module['id_agente'].'&amp;tab=data_view&period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo']."'>".html_print_image(
'images/binary.png',
true,
[

View File

@ -21,6 +21,7 @@ $searchpolicies = check_acl($config['id_user'], 0, 'AW');
if (!$policies || !$searchpolicies) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -24,6 +24,7 @@ $linkReport = true;
if ($reports === false || !$searchReports) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';

View File

@ -22,6 +22,7 @@ $searchUsers = check_acl($config['id_user'], 0, 'UM');
if (!$users || !$searchUsers) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';