diff --git a/pandora_console/include/javascript/elasticsearch_queryResult.js b/pandora_console/include/javascript/elasticsearch_queryResult.js index 82b63217b1..6a57e266bc 100644 --- a/pandora_console/include/javascript/elasticsearch_queryResult.js +++ b/pandora_console/include/javascript/elasticsearch_queryResult.js @@ -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 ( diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index de6461ccec..eb1c21af14 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -30,7 +30,7 @@ if (!$agents || !$searchAgents) { echo "
".__('Zero results found')."
\n"; } } else { - $table = new StdClass(); + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_alerts.php b/pandora_console/operation/search_alerts.php index 90e55a963e..5d47db9ff5 100755 --- a/pandora_console/operation/search_alerts.php +++ b/pandora_console/operation/search_alerts.php @@ -23,6 +23,7 @@ $searchAlerts = check_acl($config['id_user'], 0, 'AR'); if ($alerts === false || $totalAlerts == 0 || !$searchAlerts) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_graphs.php b/pandora_console/operation/search_graphs.php index 0150d2f56c..3c7dd64ec2 100755 --- a/pandora_console/operation/search_graphs.php +++ b/pandora_console/operation/search_graphs.php @@ -20,6 +20,7 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR'); if ($graphs === false || !$searchGraphs) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_helps.php b/pandora_console/operation/search_helps.php index adabd579e7..7e9c67a3ae 100644 --- a/pandora_console/operation/search_helps.php +++ b/pandora_console/operation/search_helps.php @@ -19,6 +19,7 @@ if ($helps === false || !$searchHelps) { 'https://pandorafms.com/manual/start?do=search&id=start&q='.$config['search_keywords'] )."\n"; } else { + $table = new stdClass(); $table->width = '98%'; $table->class = 'databox'; diff --git a/pandora_console/operation/search_maps.getdata.php b/pandora_console/operation/search_maps.getdata.php index e96113cbb3..e0fd9a4bdb 100644 --- a/pandora_console/operation/search_maps.getdata.php +++ b/pandora_console/operation/search_maps.getdata.php @@ -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); diff --git a/pandora_console/operation/search_maps.php b/pandora_console/operation/search_maps.php index 6b6aeeb423..c1cc98611f 100755 --- a/pandora_console/operation/search_maps.php +++ b/pandora_console/operation/search_maps.php @@ -18,6 +18,7 @@ $searchMaps = check_acl($config['id_user'], 0, 'VR'); if ($maps === false || !$searchMaps) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_modules.php b/pandora_console/operation/search_modules.php index 83c6c0edd6..17b37d7d4e 100644 --- a/pandora_console/operation/search_modules.php +++ b/pandora_console/operation/search_modules.php @@ -29,8 +29,8 @@ if (!$modules || !$searchModules) { $table->class = 'databox'; $table->head = []; - $table->head[0] = __('Module').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).''; - $table->head[1] = __('Agent').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).''; + $table->head[0] = __('Module').' '.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).''.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).''; + $table->head[1] = __('Agent').' '.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).''.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).''; $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 = ''.html_print_image('images/chart_curve.png', true, ['border' => 0, 'alt' => '']).''; - $graphCell .= ' '."".html_print_image( + $graphCell .= ' '."".html_print_image( 'images/binary.png', true, [ diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index 615280cce9..3d2590462c 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -21,6 +21,7 @@ $searchpolicies = check_acl($config['id_user'], 0, 'AW'); if (!$policies || !$searchpolicies) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_reports.php b/pandora_console/operation/search_reports.php index e16507a624..6d581ada0a 100755 --- a/pandora_console/operation/search_reports.php +++ b/pandora_console/operation/search_reports.php @@ -24,6 +24,7 @@ $linkReport = true; if ($reports === false || !$searchReports) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%'; diff --git a/pandora_console/operation/search_users.php b/pandora_console/operation/search_users.php index ead204915d..17e31bcbc1 100755 --- a/pandora_console/operation/search_users.php +++ b/pandora_console/operation/search_users.php @@ -22,6 +22,7 @@ $searchUsers = check_acl($config['id_user'], 0, 'UM'); if (!$users || !$searchUsers) { echo "
".__('Zero results found')."
\n"; } else { + $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '98%';