From e7349acfd0424a77d3bd7bd82ec987ec1e1d7904 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 20 Jun 2012 08:28:34 +0000 Subject: [PATCH] 2012-06-20 Miguel de Dios * include/functions_html.php, include/functions.php: cleaned source code style. * extensions/extension_uploader.php: fixed the upload enterprise extension. Fixes: #3532208 MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6609 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 24 +++++++++ .../extensions/extension_uploader.php | 23 ++++++--- pandora_console/extensions/pandora_logs.php | 10 ++-- .../massive/massive_delete_modules.php | 10 ++-- .../reporting_builder.list_items.php | 4 +- .../godmode/reporting/reporting_builder.php | 51 +++++++++---------- pandora_console/include/functions.php | 2 +- pandora_console/include/functions_html.php | 18 +++---- pandora_console/include/javascript/webchat.js | 1 - .../operation/agentes/stat_win.php | 15 +++--- pandora_console/operation/tree.php | 4 +- 11 files changed, 95 insertions(+), 67 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index dd3d78c76a..a1aec6b07d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-06-20 Miguel de Dios + + * include/functions_html.php, include/functions.php: cleaned source + code style. + + * extensions/extension_uploader.php: fixed the upload enterprise + extension. + + Fixes: #3532208 + + MERGED FROM 4.0.2 + 2012-06-20 Hirofumi Kosaka * extensions/net_tools.php: Fixed bug: 'whereis' could find a @@ -47,6 +59,18 @@ of the xml2array function to set it equal to recent fix in 4.0.2 +2012-06-19 Miguel de Dios + + * include/javascript/webchat.js, extensions/pandora_logs.php, + extensions/update_manager/lib/functions.php, operation/tree.php, + operation/agentes/stat_win.php, + godmode/massive/massive_delete_modules.php, + godmode/reporting/reporting_builder.list_items.php, + godmode/reporting/reporting_builder.php: a lot of changes in the + javascript for the crap browser ( = Micro$oft IE9) compatibility. + + MERGED FROM 4.0.2 + 2012-06-19 Miguel de Dios * godmode/reporting/reporting_builder.list_items.php: some fixes. diff --git a/pandora_console/extensions/extension_uploader.php b/pandora_console/extensions/extension_uploader.php index e934a6df83..22ab83e924 100644 --- a/pandora_console/extensions/extension_uploader.php +++ b/pandora_console/extensions/extension_uploader.php @@ -19,25 +19,32 @@ function extension_uploader_extensions() { if (!check_acl($config['id_user'], 0, "PM")) { db_pandora_audit("ACL Violation", - "Trying to access Group Management"); + "Trying to access Group Management"); require ("general/noaccess.php"); return; } - ui_print_page_header (__("Uploader extension"), "images/extensions.png", false, "", true, ""); - + ui_print_page_header (__("Uploader extension"), + "images/extensions.png", false, "", true, ""); + $upload = (bool)get_parameter('upload', 0); + $upload_enteprise = (bool)get_parameter('upload_enterprise', 0); if ($upload) { $error = $_FILES['extension']['error']; - if ($error == 0) { + if ($error == 0) { $zip = new ZipArchive; $tmpName = $_FILES['extension']['tmp_name']; - $pathname = $config['homedir'] . '/' . EXTENSIONS_DIR . '/'; + if ($upload_enteprise) { + $pathname = $config['homedir'] . '/' . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR . '/'; + } + else { + $pathname = $config['homedir'] . '/' . EXTENSIONS_DIR . '/'; + } if ($zip->open($tmpName) === true) { $result = $zip->extractTo($pathname); @@ -57,7 +64,7 @@ function extension_uploader_extensions() { ui_print_result_message ($result, __('Success to upload extension'), __('Fail to upload extension')); } - + $table = null; $table->width = '98%'; @@ -65,6 +72,10 @@ function extension_uploader_extensions() { $table->data[0][0] = __('Upload extension'); $table->data[0][1] = html_print_input_file('extension', true) . ui_print_help_tip (__("Upload the extension as a zip file."), true); + if (enterprise_installed()) { + $table->data[0][2] = __('Upload enterprise extension') . " " . + html_print_checkbox('upload_enterprise', 1, false, true); + } echo "
"; html_print_table($table); diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 8b53ad311b..85b8bf779c 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -39,18 +39,18 @@ function view_logfile ($file_name) { function pandoralogs_extension_main () { global $config; - + if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } - - + + ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" ); - + echo "

" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "

"; - + view_logfile ($config["homedir"]."/pandora_console.log"); view_logfile ("/var/log/pandora/pandora_server.log"); view_logfile ("/var/log/pandora/pandora_server.error"); diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index d0a2e17aed..3a17317b3f 100644 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -395,17 +395,15 @@ $(document).ready (function () { } else { $(".select_agents_row_2").css('display', ''); - } } } ); $("#form_modules input[name=selection_mode]").change (function () { - console.log(this.value); selector = this.value; clean_lists(); - + if(selector == 'agents') { $(".select_modules_row").css('display', 'none'); $(".select_agents_row").css('display', ''); @@ -415,7 +413,7 @@ $(document).ready (function () { $(".select_modules_row").css('display', ''); } }); - + $("#groups_select").change ( function () { $('#checkbox-force_group').attr('checked', false); @@ -430,7 +428,7 @@ $(document).ready (function () { $('input[type=checkbox]').removeAttr('disabled'); $(".select_agents_row_2").css('display', ''); } - + jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, @@ -439,7 +437,7 @@ $(document).ready (function () { }, function (data, status) { $("#id_agents").html(''); - + jQuery.each (data, function (id, value) { option = $("").attr ("value", value["id_agente"]).html (value["nombre"]); $("#id_agents").append (option); diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index c21f40f647..38a57685bc 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -298,6 +298,7 @@ foreach ($items as $item) { } else { $module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); + $row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small'); } @@ -392,8 +393,6 @@ function added_ids_sorted_items_to_hidden_input() { $("input[name='ids_items_to_sort']").val(ids); - console.log(ids); - if (ids == '') { alert(""); @@ -414,6 +413,5 @@ function only_numbers(name) { } $("input[name='" + name + "']").val(value); - } diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 752ffb1273..e0cc46af5e 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -46,7 +46,6 @@ switch ($action) { case 'sort_items': switch ($activeTab) { case 'list_items': - $resultOperationDB = null; $position_to_sort = (int)get_parameter('position_to_sort', 1); $ids_serialize = (string)get_parameter('ids_items_to_sort', ''); @@ -171,7 +170,7 @@ switch ($action) { __('Successfully deleted'), __('Could not be deleted')); } - + $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $return_all_group = true; @@ -229,24 +228,23 @@ switch ($action) { } $data = array (); - + if (check_acl ($config["id_user"], $report["id_group"], "AW")) { - $data[0] = ''.$report['name'].''; - - } else { + } + else { $data[0] = $report['name']; } - - + + $data[1] = $report['description']; $data[2] = '' . - html_print_image("images/reporting.png", true) . ''; + html_print_image("images/reporting.png", true) . ''; $data[3] = '' . html_print_image("images/database_lightning.png", true) . ''; //I chose ajax.php because it's supposed to give XML anyway - - + + //Calculate dinamically the number of the column $next = 4; if (enterprise_hook ('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) { @@ -259,10 +257,10 @@ switch ($action) { $data[$next] = __('Yes'); else $data[$next] = __('No'); - + $next++; - + $data[$next] = ui_print_group_icon($report['id_group'], true); $next++; @@ -270,7 +268,7 @@ switch ($action) { $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit'))); $data[$next] .= '
'; - + $data[$next] .= '  
'; $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_hidden ('action','delete_report', true); @@ -280,10 +278,11 @@ switch ($action) { } array_push ($table->data, $data); - + } html_print_table ($table); - } else { + } + else { echo "
".__('There are no defined reportings')."
"; } @@ -427,7 +426,7 @@ switch ($action) { $values['id_agent'] = get_parameter('id_agent'); $values['id_gs'] = get_parameter('id_custom_graph'); - + $values['id_agent_module'] = ''; if (isset($values['type'])) { if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent')) @@ -437,7 +436,7 @@ switch ($action) { } else $values['id_agent_module'] = get_parameter('id_agent_module'); - + $values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong'); $values['monday'] = get_parameter('monday', 0); $values['tuesday'] = get_parameter('tuesday', 0); @@ -518,7 +517,7 @@ switch ($action) { $style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0); $values['style'] = io_safe_input(json_encode($style)); - + if ($good_format){ $resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem)); } @@ -582,7 +581,7 @@ switch ($action) { $values['text'] = get_parameter('text'); $good_format = true; } - + $values['id_agent'] = get_parameter('id_agent'); $values['id_gs'] = get_parameter('id_custom_graph'); if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent')) @@ -601,9 +600,9 @@ switch ($action) { } else{ $values['only_display_wrong'] = $only_display_wrong_tmp; - } + } break; - } + } $values['monday'] = get_parameter('monday', 0); $values['tuesday'] = get_parameter('tuesday', 0); $values['wednesday'] = get_parameter('wednesday', 0); @@ -620,8 +619,8 @@ switch ($action) { case "oracle": $values['time_from'] = '#to_date(\'' . get_parameter('time_from') . '\',\'hh24:mi\')'; $values['time_to'] = '#to_date(\'' . get_parameter('time_to') . '\', \'hh24:mi\')'; - break; - } + break; + } $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); @@ -833,14 +832,14 @@ switch ($action) { break; } //db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem)); - + switch ($dir) { case 'up': $newOrder = $oldOrder - 1; break; case 'down': $newOrder = $oldOrder + 1; - break; + break; } db_process_sql_begin(); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 18fa72dad7..e0a4275a62 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -32,7 +32,7 @@ function check_refererer() { if (isset($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; } - + // If refresh is performed then dont't check referer // This is done due to problems with HTTP_REFERER var when metarefresh is performed if ($config["refr"] > 0) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 93f8880881..0539865402 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -130,20 +130,20 @@ function html_print_select_style ($fields, $name, $selected = '', $style='', $sc if (!empty ($disabled)) { $attributes .= ' disabled="disabled"'; } - + $output .= '"; - + if ($return) return $output; - + echo $output; } @@ -1171,7 +1171,7 @@ function html_print_checkbox_extended ($name, $value, $checked, $disabled, $scri */ function html_print_checkbox ($name, $value, $checked = false, $return = false, $disabled = false, $script = '') { $output = html_print_checkbox_extended ($name, $value, (bool) $checked, $disabled, $script, '', true); - + if ($return === false) echo $output; @@ -1217,7 +1217,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src } return io_safe_input($src); } - + $output = ' + "/images/graphmenu_arrow_hide.png"); } @@ -99,14 +98,14 @@ window.onload = function() { $("#graph_menu_arrow").attr("src", + "/images/graphmenu_arrow.png"); } }); - + }; function docOnMousemoveIn(evt) { - + var e = new xEvent(evt); var d = getTermEle(e.target); - + // if (!tnActive) { // no def is active // if (d) { // mouse is over a term, activate its def if (showed == 0) { diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 0648a8eda9..20a459e060 100644 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -1020,8 +1020,8 @@ printTree_($activeTab);