From 862d16ccf92fab4949efb6586fe948dd5ab94890 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 31 Jul 2014 14:27:43 +0000 Subject: [PATCH] 2014-07-31 Miguel de Dios * include/functions_networkmap.php, include/functions_graph.php, include/db/postgresql.php, include/db/oracle.php, include/functions_api.php, extensions/agents_alerts.php, operation/search_main.php, operation/search_agents.getdata.php, operation/agentes/status_monitor.php, operation/agentes/networkmap.topology.php, operation/agentes/ver_agente.php, operation/search_modules.getdata.php, operation/search_results.php, operation/events/events_list.php, godmode/alerts/alert_list.builder.php, godmode/alerts/configure_alert_template.php, godmode/modules/manage_network_components_form.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php: tiny fixes for the improve the support of postgreSQL databases. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10368 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 18 +++++ pandora_console/extensions/agents_alerts.php | 4 + .../godmode/alerts/alert_list.builder.php | 12 ++- .../alerts/configure_alert_template.php | 59 +++++++++------ .../manage_network_components_form.php | 2 +- .../godmode/reporting/map_builder.php | 2 +- .../godmode/reporting/reporting_builder.php | 75 ++++++++++++------- pandora_console/include/db/oracle.php | 22 ++++-- pandora_console/include/db/postgresql.php | 1 + pandora_console/include/functions_api.php | 2 +- pandora_console/include/functions_graph.php | 2 +- .../include/functions_networkmap.php | 4 +- .../operation/agentes/networkmap.topology.php | 13 +++- .../operation/agentes/status_monitor.php | 2 +- .../operation/agentes/ver_agente.php | 2 +- .../operation/events/events_list.php | 16 +++- .../operation/search_agents.getdata.php | 2 +- pandora_console/operation/search_main.php | 1 + .../operation/search_modules.getdata.php | 2 +- pandora_console/operation/search_results.php | 33 ++++++-- 20 files changed, 192 insertions(+), 82 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7b10dd4c06..0d7c364793 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2014-07-31 Miguel de Dios + + * include/functions_networkmap.php, include/functions_graph.php, + include/db/postgresql.php, include/db/oracle.php, + include/functions_api.php, extensions/agents_alerts.php, + operation/search_main.php, operation/search_agents.getdata.php, + operation/agentes/status_monitor.php, + operation/agentes/networkmap.topology.php, + operation/agentes/ver_agente.php, + operation/search_modules.getdata.php, operation/search_results.php, + operation/events/events_list.php, + godmode/alerts/alert_list.builder.php, + godmode/alerts/configure_alert_template.php, + godmode/modules/manage_network_components_form.php, + godmode/reporting/reporting_builder.php, + godmode/reporting/map_builder.php: tiny fixes for the improve the + support of postgreSQL databases. + 2014-07-30 Miguel de Dios * include/ajax/module.php: tiny fixes for the improve the support of diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 4b654ec498..fb2ec74d45 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -172,6 +172,7 @@ function mainAgentsAlerts() { echo "".html_print_image("images/darrowleft.png",true, array('title' => __('Previous templates')))." "; } + $templates_raw = array(); if (!empty($templates)) { $sql = sprintf('SELECT id, name FROM talert_templates @@ -180,6 +181,9 @@ function mainAgentsAlerts() { $templates_raw = db_get_all_rows_sql($sql); } + if (empty($templates_raw)) + $templates_raw = array(); + $alerts = array(); $ntemplates = 0; foreach ($templates_raw as $temp) { diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index f9686c49e7..623caee7b2 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -80,7 +80,7 @@ $table->data[1][0] = __('Template'); $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $templates = alerts_get_alert_templates (false, array ('id', 'name')); -else{ +else { $usr_groups = users_get_groups($config['id_user'], 'LW', true); $filter_groups = ''; $filter_groups = implode(',', array_keys($usr_groups)); @@ -107,13 +107,17 @@ if (!empty($groups_user)) { $actions = db_get_all_rows_sql($sql); } $table->data[2][1] = '
'; -$table->data[2][1] .= html_print_select(index_array ($actions, 'id', 'name'),'action_select','','',__('Default action'),'0',true, '', true, '', false, 'width: 250px;'); +$table->data[2][1] .= html_print_select( + index_array($actions, 'id', 'name'), 'action_select', '', '', + __('Default action'), '0', true, '', true, '', false, + 'width: 250px;'); $table->data[2][1] .= ''; $table->data[2][1] .= '
'; if (check_acl ($config['id_user'], 0, "LM")) { diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 9317cbdedf..592e728bad 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -394,11 +394,15 @@ if ($create_template) { } if ($result) { //db_pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values)); - db_pandora_audit("Template alert management", "Create alert template #" . $result, false, false, json_encode($values)); + db_pandora_audit("Template alert management", + "Create alert template #" . $result, false, false, + json_encode($values)); } else { //db_pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values)); - db_pandora_audit("Template alert management", "Fail try to create alert template", false, false, json_encode($values)); + db_pandora_audit("Template alert management", + "Fail try to create alert template", false, false, + json_encode($values)); } ui_print_result_message ($result, @@ -455,7 +459,7 @@ if ($id && ! $create_template) { for ($i = 1; $i <= 10; $i++) { $fields_recovery[$i] = $template['field'.$i.'_recovery']; } - + $default_action = $template['id_alert_action']; $priority = $template['priority']; $id_group = $template['id_group']; @@ -474,6 +478,10 @@ $table->size[0] = '20%'; $table->size[2] = '20%'; if ($step == 2) { + + if (!isset($show_matches)) + $show_matches = false; + /* Firing conditions and events */ $table->colspan = array (); $table->colspan[4][1] = 3; @@ -493,7 +501,7 @@ if ($step == 2) { $table->data[0][1] .= html_print_checkbox ('saturday', 1, $saturday, true); $table->data[0][1] .= __('Sun'); $table->data[0][1] .= html_print_checkbox ('sunday', 1, $sunday, true); - + $table->data[0][2] = __('Use special days list'); $table->data[0][3] = html_print_checkbox ('special_day', 1, $special_day, true); @@ -512,11 +520,11 @@ if ($step == 2) { '', false, true); $table->data[3][0] = __('Min. number of alerts'); - $table->data[3][1] = html_print_input_text ('min_alerts', $min_alerts, '', - 5, 7, true); + $table->data[3][1] = html_print_input_text ('min_alerts', + $min_alerts, '', 5, 7, true); $table->data[3][2] = __('Max. number of alerts'); - $table->data[3][3] = html_print_input_text ('max_alerts', $max_alerts, '', - 5, 7, true); + $table->data[3][3] = html_print_input_text ('max_alerts', + $max_alerts, '', 5, 7, true); $table->data[4][0] = __('Default action'); $usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true))); @@ -529,7 +537,8 @@ if ($step == 2) { ORDER BY name', $usr_groups); break; case "oracle": - $sql_query = sprintf('SELECT id, dbms_lob.substr(name,4000,1) as nombre + $sql_query = sprintf('SELECT id, + dbms_lob.substr(name,4000,1) AS nombre FROM talert_actions WHERE id_group IN (%s) ORDER BY dbms_lob.substr(name,4000,1)', $usr_groups); @@ -543,13 +552,15 @@ if ($step == 2) { $table->data[5][0] = __('Condition type'); $table->data[5][1] = html_print_select (alerts_get_alert_templates_types (), 'type', $type, '', __('Select'), 0, true, false, false); - $table->data[5][1] .= ''; + $table->data[5][1] .= ''; $table->data[5][1] .= ' '.html_print_checkbox ('matches_value', 1, $matches, true); - $table->data[5][1] .= html_print_label (__('Trigger when matches the value'), + $table->data[5][1] .= html_print_label( + __('Trigger when matches the value'), 'checkbox-matches_value', true); $table->data[5][1] .= ''; $table->colspan[5][1] = 3; - + $table->data['value'][0] = __('Value'); $table->data['value'][1] = html_print_input_text ('value', $value, '', 35, 255, true); @@ -566,17 +577,20 @@ if ($step == 2) { 'width' => '20px')); $table->data['value'][1] .= ''; $table->colspan['value'][1] = 3; - + //Min first, then max, that's more logical $table->data['min'][0] = __('Min.'); - $table->data['min'][1] = html_print_input_text ('min', $min, '', 5, 255, true); + $table->data['min'][1] = html_print_input_text ('min', $min, '', 5, + 255, true); $table->colspan['min'][1] = 3; - + $table->data['max'][0] = __('Max.'); - $table->data['max'][1] = html_print_input_text ('max', $max, '', 5, 255, true); + $table->data['max'][1] = html_print_input_text ('max', $max, '', 5, + 255, true); $table->colspan['max'][1] = 3; - - $table->data['example'][1] = ui_print_alert_template_example ($id, true, false); + + $table->data['example'][1] = ui_print_alert_template_example($id, + true, false); $table->colspan['example'][1] = 4; } else if ($step == 3) { @@ -585,7 +599,7 @@ else if ($step == 3) { $table->style[2] = 'font-weight: bold; vertical-align: top'; $table->size = array (); $table->size[0] = '20%'; - + /* Alert recover */ if (! $recovery_notify) { $table->cellstyle['label_fields'][2] = 'display:none;'; @@ -610,7 +624,7 @@ else if ($step == 3) { $table->data['label_fields'][0] = ''; $table->data['label_fields'][1] = __('Firing fields'); $table->data['label_fields'][2] = __('Recovery fields'); - + for ($i = 1; $i <= 10; $i++) { if (isset($template[$name])) { $value = $template[$name]; @@ -621,8 +635,9 @@ else if ($step == 3) { //$table->rowclass['field'.$i] = 'row_field'; - $table->data['field'.$i][0] = sprintf(__('Field %s'), $i) . ui_print_help_icon ('alert_macros', true); - $table->data['field'.$i][1] = html_print_textarea ('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true); + $table->data['field'.$i][0] = sprintf(__('Field %s'), $i) . + ui_print_help_icon ('alert_macros', true); + $table->data['field'.$i][1] = html_print_textarea('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true); // Recovery $table->data['field'.$i][2] = html_print_textarea ('field'.$i.'_recovery', 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', 'style="min-height:40px" class="fields"', true); } diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index a8ee3acab7..4958535221 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -489,7 +489,7 @@ $(document).ready (function () { $("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").attr("disabled",true); } - else{ + else { $("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").attr("disabled", true); diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 126bc58751..794df41252 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -125,7 +125,7 @@ if ($copy_layout) { ui_print_error_message(__('Not copied. Error copying data')); } } - else{ + else { // If the array is empty the copy is completed ui_print_success_message(__('Successfully copied')); db_clean_cache(); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 1c398d0966..cbb193b007 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -66,12 +66,12 @@ if ($schedule_report != '') { 'args' => serialize ($parameters), 'scheduled' => $scheduled, 'flag_delete' => 1); - + $result = db_process_sql_insert('tuser_task_scheduled', $values); ui_print_result_message ($result, - __('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'), - __('An error has ocurred')); + __('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'), + __('An error has ocurred')); echo '
'; } @@ -451,9 +451,12 @@ switch ($action) { $data[2] = '' . html_print_image("images/html.png", true, array('title' => __('HTML view'))) . ''; $data[3] = '' . html_print_image("images/xml.png", true, array('title' => __('Export to XML'))) . ''; //I chose ajax.php because it's supposed to give XML anyway - } else { - $data[2] = html_print_image("images/html_disabled.png", true); - $data[3] = html_print_image("images/xml_disabled.png", true); + } + else { + $data[2] = html_print_image( + "images/html_disabled.png", true); + $data[3] = html_print_image( + "images/xml_disabled.png", true); } @@ -475,7 +478,8 @@ switch ($action) { $next++; - $data[$next] = ui_print_group_icon($report['id_group'], true, "groups_small", '', !defined('METACONSOLE')); + $data[$next] = ui_print_group_icon( + $report['id_group'], true, "groups_small", '', !defined('METACONSOLE')); $next++; } @@ -801,7 +805,7 @@ switch ($action) { else $values['id_agent_module'] = get_parameter('id_agent_module'); - $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); + $values['only_display_wrong'] = (int)get_parameter('checkbox_only_display_wrong', 0); $values['monday'] = get_parameter('monday', 0); $values['tuesday'] = get_parameter('tuesday', 0); $values['wednesday'] = get_parameter('wednesday', 0); @@ -814,7 +818,7 @@ switch ($action) { $values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent'); $values['show_resume'] = get_parameter ('checkbox_show_resume'); $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown'); - $values['exception_condition'] = get_parameter('exception_condition'); + $values['exception_condition'] = (int)get_parameter('exception_condition', 0); $values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['show_graph'] = get_parameter('combo_graph_options'); $values['id_module_group'] = get_parameter('combo_modulegroup'); @@ -916,7 +920,7 @@ switch ($action) { if ($good_format) { $resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem)); } - else{ + else { $resultOperationDB = false; } break; @@ -926,6 +930,7 @@ switch ($action) { $values['type'] = get_parameter('type', null); $values['name'] = (string) get_parameter('name'); $values['description'] = get_parameter('description'); + // Support for projection graph, prediction date and SLA reports // 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report switch ($values['type']) { @@ -1007,15 +1012,15 @@ switch ($action) { switch ($config['dbtype']) { case "mysql": case "postgresql": - $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); + $values['only_display_wrong'] = (int)get_parameter('checkbox_only_display_wrong', 0); break; case "oracle": $only_display_wrong_tmp = get_parameter('checkbox_only_display_wrong'); if (empty($only_display_wrong_tmp)) { $values['only_display_wrong'] = 0; } - else{ - $values['only_display_wrong'] = $only_display_wrong_tmp; + else { + $values['only_display_wrong'] = $only_display_wrong_tmp; } break; } @@ -1040,7 +1045,7 @@ switch ($action) { $values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent',0); $values['show_resume'] = get_parameter ('checkbox_show_resume',0); $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0); - $values['exception_condition'] = get_parameter('radiobutton_exception_condition'); + $values['exception_condition'] = (int)get_parameter('radiobutton_exception_condition', 0); $values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['show_graph'] = get_parameter('combo_graph_options'); $values['id_module_group'] = get_parameter('combo_modulegroup'); @@ -1391,11 +1396,17 @@ switch ($action) { default: switch ($config["dbtype"]) { case "mysql": - $oldOrder = db_get_value_sql('SELECT `order` FROM treport_content WHERE id_rc = ' . $idItem); + $oldOrder = db_get_value_sql(' + SELECT `order` + FROM treport_content + WHERE id_rc = ' . $idItem); break; case "postgresql": case "oracle": - $oldOrder = db_get_value_sql('SELECT "order" FROM treport_content WHERE id_rc = ' . $idItem); + $oldOrder = db_get_value_sql(' + SELECT "order" + FROM treport_content + WHERE id_rc = ' . $idItem); break; } //db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem)); @@ -1413,17 +1424,20 @@ switch ($action) { case "mysql": $resultOperationDB = db_process_sql_update('treport_content', array('`order`' => $oldOrder), - array('`order`' => $newOrder, 'id_report' => $idReport)); + array('`order`' => $newOrder, + 'id_report' => $idReport)); break; case "postgresql": $resultOperationDB = db_process_sql_update('treport_content', array('"order"' => $oldOrder), - array('"order"' => $newOrder, 'id_report' => $idReport)); + array('"order"' => $newOrder, + 'id_report' => $idReport)); break; case "oracle": $resultOperationDB = db_process_sql_update('treport_content', array('"order"' => $oldOrder), - array('"order"' => $newOrder, 'id_report' => $idReport), + array('"order"' => $newOrder, + 'id_report' => $idReport), 'AND', false); break; } @@ -1505,7 +1519,7 @@ if ($enterpriseEnable) { $resultOperationDB = $result; } } - + $buttons = array( 'list_reports' => array('active' => false, 'text' => '' . @@ -1545,15 +1559,21 @@ else { // Page header for metaconsole if ($enterpriseEnable and defined('METACONSOLE')) { // Bread crumbs - ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'text' => __('Reporting'))); + ui_meta_add_breadcrumb( + array('link' => + 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure=' . $pure, + 'text' => __('Reporting'))); ui_meta_print_page_header($nav_bar); // Print header ui_meta_print_header(__('Reporting'). $textReportName, "", $buttons); } -else - ui_print_page_header(__('Reporting') . $textReportName, "images/op_reporting.png", false, "reporting_" . $activeTab . "_tab", false, $buttons); +else { + ui_print_page_header(__('Reporting') . $textReportName, + "images/op_reporting.png", false, + "reporting_" . $activeTab . "_tab", false, $buttons); +} enterprise_hook('open_meta_frame'); @@ -1563,13 +1583,16 @@ if ($resultOperationDB !== null) { switch ($activeTab) { case 'main': - require_once($config['homedir'] . '/godmode/reporting/reporting_builder.main.php'); + require_once($config['homedir'] . + '/godmode/reporting/reporting_builder.main.php'); break; case 'list_items': - require_once($config['homedir'] . '/godmode/reporting/reporting_builder.list_items.php'); + require_once($config['homedir'] . + '/godmode/reporting/reporting_builder.list_items.php'); break; case 'item_editor': - require_once($config['homedir'] . '/godmode/reporting/reporting_builder.item_editor.php'); + require_once($config['homedir'] . + '/godmode/reporting/reporting_builder.item_editor.php'); break; default: reporting_enterprise_select_tab($activeTab); diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 1b3d3b8e38..b1e257a546 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -254,7 +254,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection = else if ($type[0] == '/INSERT'){ $query = oci_parse($config['dbconnection'], substr($sql,1)); } - else{ + else { $query = oci_parse($config['dbconnection'], $sql); } } @@ -661,7 +661,7 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi else if ($value[0] == '%') { $query .= sprintf ("%s LIKE '%s'", $field, $value); } - else{ + else { $query .= sprintf ("%s = '%s'", $field, $value); } } @@ -1009,16 +1009,16 @@ function oracle_db_get_num_rows ($sql) { global $config; $type = explode(' ',strtoupper(trim($sql))); - if ($type[0] == 'SELECT'){ + if ($type[0] == 'SELECT') { $sql = "SELECT count(*) as NUM FROM (" . $sql . ")"; } $query = oci_parse($config['dbconnection'], $sql); oci_execute($query); - if ($type[0] == 'SELECT'){ + if ($type[0] == 'SELECT') { $row = oci_fetch_assoc($query); $rows = $row['NUM']; } - else{ + else { $rows = oci_num_rows($query); } @@ -1039,13 +1039,19 @@ function oracle_db_get_num_rows ($sql) { */ function oracle_db_get_all_rows_field_filter ($table, $field, $condition, $order_field = "") { if (is_int ($condition) || is_bool ($condition)) { - $sql = sprintf ("SELECT * FROM %s WHERE %s = %d", $table, $field, $condition); + $sql = sprintf ("SELECT * + FROM %s + WHERE %s = %d", $table, $field, $condition); } else if (is_float ($condition) || is_double ($condition)) { - $sql = sprintf ("SELECT * FROM %s WHERE %s = %f", $table, $field, $condition); + $sql = sprintf ("SELECT * + FROM %s + WHERE %s = %f", $table, $field, $condition); } else { - $sql = sprintf ("SELECT * FROM %s WHERE %s = '%s'", $table, $field, $condition); + $sql = sprintf ("SELECT * + FROM %s + WHERE %s = '%s'", $table, $field, $condition); } if ($order_field != "") diff --git a/pandora_console/include/db/postgresql.php b/pandora_console/include/db/postgresql.php index fe1e693bf1..d61d44e8b7 100644 --- a/pandora_console/include/db/postgresql.php +++ b/pandora_console/include/db/postgresql.php @@ -349,6 +349,7 @@ function postgresql_db_process_sql_insert($table, $values) { $query .= ' VALUES (' . $values_str . ')'; + //html_debug_print($query); return db_process_sql($query, 'insert_id'); } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 197e9f4275..7b75adf0df 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -2477,7 +2477,7 @@ function api_get_module_value_all_agents($id, $thrash1, $other, $thrash2) { if (!$module_values) { returnError('error_get_module_value_all_agents', 'Error getting module values from all agents.'); } - else{ + else { $data = array('type' => 'array', 'data' => $module_values); returnData('csv', $data, ';'); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 7582f4ae58..c65fc622f6 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -582,7 +582,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, if (!$projection) { return fs_error_image (); } - else{ + else { return fs_error_image (); } } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 21a588c04f..2f40f7c475 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1448,7 +1448,9 @@ function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'rad $values['show_groups'] = $show_groups; $values['show_modules'] = $show_modules; - return @db_process_sql_insert ('tnetwork_map', $values); + $values['server_name'] = ""; + + return @db_process_sql_insert('tnetwork_map', $values); } /** diff --git a/pandora_console/operation/agentes/networkmap.topology.php b/pandora_console/operation/agentes/networkmap.topology.php index 1f5cba4339..3e5b56b604 100644 --- a/pandora_console/operation/agentes/networkmap.topology.php +++ b/pandora_console/operation/agentes/networkmap.topology.php @@ -79,9 +79,18 @@ else { } else { fwrite ($fh, $graph); - $graphviz_path = ($config['graphviz_bin_dir']) ? io_safe_output($config['graphviz_bin_dir']."/") : ""; - $cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " . escapeshellarg("-o$filename_map") . " -Tpng ". escapeshellarg("-o$filename_img") . " " . escapeshellarg($filename_dot); + + $graphviz_path = (isset($config['graphviz_bin_dir'])) ? + io_safe_output($config['graphviz_bin_dir'] . "/") + : + ""; + + $cmd = escapeshellarg($graphviz_path . $filter) . + " -Tcmapx " . escapeshellarg("-o$filename_map") . + " -Tpng ". escapeshellarg("-o$filename_img") . + " " . escapeshellarg($filename_dot); $result = system ($cmd); + fclose ($fh); unlink ($filename_dot); //~ html_debug_print($cmd); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index a4c18b46f7..9c9ec60c12 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -203,7 +203,7 @@ if ($tag_filter !== 0) { WHERE ttag_module.id_tag IN (SELECT id_tag FROM ttag where name LIKE '%" . $tag_filter . "%') )"; } - else{ + else { $sql_conditions .= " AND tagente_modulo.id_agente_modulo IN ( SELECT ttag_module.id_agente_modulo FROM ttag_module diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index f7aa19a04b..a725bb8a5b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -624,7 +624,7 @@ if (is_ajax ()) { if ($modulegroup === false) { echo __('None').'
'; } - else{ + else { echo $modulegroup.'
'; } echo ''.__('Agent').': '; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 85c1b63fa6..7aba3be0c2 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -340,7 +340,7 @@ $events_filter .= html_print_input_hidden('id_name', $id_name, true); if ($open_filter) { $events_filter .= html_print_input_hidden('open_filter', 'true', true); } -else{ +else { $events_filter .= html_print_input_hidden('open_filter', 'false', true); } @@ -414,8 +414,18 @@ $table_advanced->data[] = $data; $table_advanced->rowclass[] = ''; $data = array(); -$data[0] = '
' . __('Events with following tags') . '' . html_print_table($tabletags_with, true) . '
'; -$data[1] = '
' . __('Events without following tags') . '' . html_print_table($tabletags_without, true) . '
'; +$data[0] = '
' . + '' . + __('Events with following tags') . + '' . + html_print_table($tabletags_with, true) . + '
'; +$data[1] = '
' . + '' . + __('Events without following tags') . + '' . + html_print_table($tabletags_without, true) . + '
'; $table_advanced->data[] = $data; $table_advanced->rowclass[] = ''; diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index 43b3ff8b3f..c1740c9d34 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -173,7 +173,7 @@ if ($searchAgents) { AND ( t1.nombre LIKE '%%" . $stringSearchSQL . "%%' OR t2.nombre LIKE '%%" . $stringSearchSQL . "%%' OR - t1.direction LIKE '%%" . $stringSearchSQL . "%%' + t1.direccion LIKE '%%" . $stringSearchSQL . "%%' ) "; break; diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index 60dbed3d4f..b2fad8c33e 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -44,6 +44,7 @@ $table->style[8] = 'font-weight: bold; text-align: center;'; $table->style[9] = 'font-weight: bold; text-align: center;'; $table->style[10] = 'font-weight: bold; text-align: center;'; $table->style[11] = 'font-weight: bold; text-align: center;'; +$table->style[13] = 'font-weight: bold; text-align: center;'; $table->data[0][0] = html_print_image ("images/agent.png", true, array ("title" => __('Agents found'))); $table->data[0][1] = "
" . diff --git a/pandora_console/operation/search_modules.getdata.php b/pandora_console/operation/search_modules.getdata.php index 96c81ee36a..70aca7201e 100644 --- a/pandora_console/operation/search_modules.getdata.php +++ b/pandora_console/operation/search_modules.getdata.php @@ -108,7 +108,7 @@ if ($searchModules) { ) ) ) AND - t1.nombre COLLATE utf8_general_ci LIKE \'%' . $stringSearchSQL . '%\' OR + t1.nombre LIKE \'%' . $stringSearchSQL . '%\' OR t3.nombre LIKE \'%' . $stringSearchSQL . '%\''; break; case "oracle": diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 1e8209cf1f..0a417b412b 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -58,7 +58,9 @@ $selected = 'border: 1px solid black;'; if ($searchMain) { $main_tab = array('text' => "" - . html_print_image ("images/zoom_mc.png", true, array ("title" => __('Global search'))) . "", 'active' => $searchTab == "main"); + . html_print_image ("images/zoom_mc.png", true, + array ("title" => __('Global search'))) . "", + 'active' => $searchTab == "main"); } else { $main_tab = ''; @@ -66,7 +68,9 @@ else { if ($searchAgents) { $agents_tab = array('text' => "" - . html_print_image ("images/op_monitoring.png", true, array ("title" => __('Agents'))) . "", 'active' => $searchTab == "agents"); + . html_print_image ("images/op_monitoring.png", true, + array ("title" => __('Agents'))) . "", + 'active' => $searchTab == "agents"); } else { $agents_tab = ''; @@ -74,7 +78,9 @@ else { if ($searchUsers) { $users_tab = array('text' => "" - . html_print_image ("images/op_workspace.png", true, array ("title" => __('Users'))) . "", 'active' => $searchTab == "users"); + . html_print_image ("images/op_workspace.png", true, + array ("title" => __('Users'))) . "", + 'active' => $searchTab == "users"); } else { $users_tab = ''; @@ -82,7 +88,9 @@ else { if ($searchAlerts) { $alerts_tab = array('text' => "" - . html_print_image ("images/op_alerts.png", true, array ("title" => __('Alerts'))) . "", 'active' => $searchTab == "alerts"); + . html_print_image ("images/op_alerts.png", true, + array ("title" => __('Alerts'))) . "", + 'active' => $searchTab == "alerts"); } else { $alerts_tab = ''; @@ -90,7 +98,9 @@ else { if ($searchGraphs) { $graphs_tab = array('text' => "" - . html_print_image ("images/chart.png", true, array ("title" => __('Graphs'))) . "", 'active' => $searchTab == "graphs"); + . html_print_image ("images/chart.png", true, + array ("title" => __('Graphs'))) . "", + 'active' => $searchTab == "graphs"); } else { $graphs_tab = ''; @@ -98,7 +108,9 @@ else { if ($searchReports) { $reports_tab = array('text' => "" - . html_print_image ("images/op_reporting.png", true, array ("title" => __('Reports'))) . "", 'active' => $searchTab == "reports"); + . html_print_image ("images/op_reporting.png", true, + array ("title" => __('Reports'))) . "", + 'active' => $searchTab == "reports"); } else { $reports_tab = ''; @@ -106,7 +118,9 @@ else { if ($searchMaps) { $maps_tab = array('text' => "" - . html_print_image ("images/visual_console.png", true, array ("title" => __('Maps'))) . "", 'active' => $searchTab == "maps"); + . html_print_image ("images/visual_console.png", true, + array ("title" => __('Maps'))) . "", + 'active' => $searchTab == "maps"); } else { $maps_tab = ''; @@ -114,7 +128,9 @@ else { if ($searchModules) { $modules_tab = array('text' => "" - . html_print_image ("images/brick.png", true, array ("title" => __('Modules'))) . "", 'active' => $searchTab == "modules"); + . html_print_image ("images/brick.png", true, + array ("title" => __('Modules'))) . "", + 'active' => $searchTab == "modules"); } else { $modules_tab = ''; @@ -135,6 +151,7 @@ $only_count = false; switch ($searchTab) { case 'main': $only_count = true; + require_once('search_agents.getdata.php'); require_once('search_agents.php'); require_once('search_users.getdata.php');