diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 9086200005..ce54da1409 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150629 +Version: 6.0dev-150630 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 25d1cccdab..845168ee96 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150629" +pandora_version="6.0dev-150630" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index c0f48deb0b..44de38aaba 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150629'; +use constant AGENT_BUILD => '150630'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 8017c3055b..0e224890f1 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150629 +%define release 150630 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 1cbfb83477..b270f055ff 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150629 +%define release 150630 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 7bc5f8d7b0..6ee1d31195 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150629} +{150630} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 57fd12ac9c..d103f89c3c 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150629)") +#define PANDORA_VERSION ("6.0dev(Build 150630)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index da33e2eab3..f869c74036 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150629))" + VALUE "ProductVersion", "(6.0dev(Build 150630))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7cb8b293aa..ab5d9eec5b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150629 +Version: 6.0dev-150630 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 99f5ad7e1e..3f3ea6ee80 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150629" +pandora_version="6.0dev-150630" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index fa960f510d..67ae8bf31e 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -22,14 +22,29 @@ function pluginreg_extension_main () { require ("general/noaccess.php"); return; } - + ui_require_css_file ('firts_task'); ui_print_page_header (__('Plugin registration'), "images/extensions.png", false, "", true, "" ); - echo "
"; - printf(__("This extension makes registration of server plugins more easy. Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz). Please refer to documentation on how to obtain and use Pandora FMS Server Plugins.

You can get more plugins in our Public Resource Library") , "http://pandorafms.com/Library/Library/"); - echo "
"; - - echo "

"; + echo '
+
'; + echo html_print_image("images/firts_task/icono_grande_import.png", true, array("title" => __("") )); + echo '
'; + echo '
'; + echo '

' . __("Plugin registration") . '

'; + echo '

' . + __("This extension makes registration of server plugins more easy. + Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz). + Please refer to documentation on how to obtain and use Pandora FMS Server Plugins. +

You can get more plugins in our Public Resource Library ") . '

'; + // Upload form + echo "
"; + echo ''; + echo "
"; + echo ""; + echo "
"; + echo '
'; + echo '
'; + $zip = null; $upload = false; @@ -408,15 +423,6 @@ function pluginreg_extension_main () { } } } - - // Upload form - echo "
"; - echo ''; - echo "
"; - echo ""; - echo "
"; - - return; } extensions_add_godmode_menu_option (__('Register plugin'), 'PM','gservers', null, "v1r1"); diff --git a/pandora_console/general/firts_task/custom_fields.php b/pandora_console/general/firts_task/custom_fields.php new file mode 100644 index 0000000000..1b7c9c0eca --- /dev/null +++ b/pandora_console/general/firts_task/custom_fields.php @@ -0,0 +1,26 @@ + +true, 'message'=> __('There are no custom fields defined yet.') ) ); +?> + +
+
+ __('Custom Graphs')));?> +
+
+

+

ICMP (pings), + SNMP (detecting the topology of networks and their interfaces), and other customized + type. You can define your own customized recon script.'); ?>

+
+ +
+
+
\ No newline at end of file diff --git a/pandora_console/general/firts_task/incidents.php b/pandora_console/general/firts_task/incidents.php index dc3767a104..ae1671d628 100644 --- a/pandora_console/general/firts_task/incidents.php +++ b/pandora_console/general/firts_task/incidents.php @@ -10,17 +10,19 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no in
- __('Incidents')));?> + __('Incidents')));?>

-

ICMP (pings), - SNMP (detecting the topology of networks and their interfaces), and other customized - type. You can define your own customized recon script.'); ?>

-
+

+
-
\ No newline at end of file + diff --git a/pandora_console/general/firts_task/network_map.php b/pandora_console/general/firts_task/network_map.php index 5b890caaf5..8b385004e8 100755 --- a/pandora_console/general/firts_task/network_map.php +++ b/pandora_console/general/firts_task/network_map.php @@ -19,9 +19,13 @@ $networkmap_types = networkmap_get_types($strict_user);

- - "); ?>

+ "); + echo "
  • " . __("Topology Map") . "
  • +
  • " . __("Group Map") . "
  • +
  • " . __("Radial Map (User without strict user)") . "
  • +
  • " . __("Dinamic Map") . "
  • +
  • " . __("Policy Map (Only Enterprise version)") . "
  • "; + ?>

    -

    ICMP (pings), - SNMP (detecting the topology of networks and their interfaces), and other customized - type. You can define your own customized recon script.'); ?>

    - +

    +
    diff --git a/pandora_console/general/firts_task/tags.php b/pandora_console/general/firts_task/tags.php index 23bdaa85e6..ef8c94b652 100755 --- a/pandora_console/general/firts_task/tags.php +++ b/pandora_console/general/firts_task/tags.php @@ -3,21 +3,19 @@ global $config; check_login (); ui_require_css_file ('firts_task'); ?> -true, 'message'=> __('There are no recon task defined yet.') ) ); ?> +true, 'message'=> __('There are no tags defined yet.') ) ); ?>
    - __('Recon server')));?> + __('Recon server')));?>
    -

    -

    ICMP (pings), - SNMP (detecting the topology of networks and their interfaces), and other customized - type. You can define your own customized recon script.'); ?>

    -
    - +

    +

    + +
    diff --git a/pandora_console/godmode/agentes/fields_manager.php b/pandora_console/godmode/agentes/fields_manager.php index 4b431e0865..90ad2d4df2 100644 --- a/pandora_console/godmode/agentes/fields_manager.php +++ b/pandora_console/godmode/agentes/fields_manager.php @@ -103,7 +103,8 @@ if ($fields) { $table->data = array (); } else { - ui_print_info_message ( array('no_close'=>true, 'message'=> __('No fields defined') ) ); + require_once ($config['homedir'] . "/general/firts_task/custom_fields.php"); + return; } if ($fields === false) $fields = array(); diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index fe4676711b..5d2db04207 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -255,9 +255,9 @@ if ($template['time_from'] == $template['time_to']) { } else { $from_array = explode(':', $template['time_from']); - $from = $from_array[0] * 3600 + $from_array[1] * 60 + $from_array[2]; + $from = $from_array[0] * SECONDS_1HOUR + $from_array[1] * SECONDS_1MINUTE + $from_array[2]; $to_array = explode(':', $template['time_to']); - $to = $to_array[0] * 3600 + $to_array[1] * 60 + $to_array[2]; + $to = $to_array[0] * SECONDS_1HOUR + $to_array[1] * SECONDS_1MINUTE + $to_array[2]; if ($to > $from) { if ($template['time_from'] != '00:00:00') { $table_time->head[0] = '00:00:00
    -
    ' . $template['time_from']; @@ -296,7 +296,11 @@ unset($table_time); $table_conditions->data[] = $data; $data[0] = __('Use special days list'); -$data[1] = (isset($alert['special_day']) && $alert['special_day'] == 1) ? __('Yes') : __('No'); +$data[1] = (isset($alert['special_day']) && $alert['special_day'] == 1) + ? + __('Yes') + : + __('No'); $table_conditions->data[] = $data; $data[0] = __('Time threshold'); @@ -372,7 +376,7 @@ else { else { $table->head[$k] = '#' . $k; } - } + } } $action_threshold = $action['module_action_threshold'] > 0 ? $action['module_action_threshold'] : $action['action_threshold']; @@ -523,21 +527,21 @@ else { $table->style[3] = 'width: 25%;'; $table->style[3] = 'font-weight: bold; width: 25%;'; $table->title = __('Recovering fields') . ui_print_help_tip(__('Fields passed to the command executed by this action when the alert is recovered'), true); - + $table->head[0] = __('Field') . ui_print_help_tip(__('Fields configured on the command associated to the action'), true); $table->head[1] = __('Firing fields') . ui_print_help_tip(__('Fields used on execution when the alert is fired'), true); $table->head[2] = __('Template recovery fields') . ui_print_help_tip(__('Recovery fields configured in alert template'), true); $table->head[3] = __('Action recovery fields') . ui_print_help_tip(__('Recovery fields configured in alert action'), true); $table->head[4] = __('Executed on recovery') . ui_print_help_tip(__('Fields used on execution when the alert is recovered'), true); $table->style[4] = 'font-weight: bold;'; - + foreach($firing_fields as $kaction => $firing) { $data = array(); $command_preview = $firing_fields[$kaction]['command']; $fieldn = 1; foreach ($firing['description'] as $field => $desc) { $data[0] = $desc; - + if (!empty($data[0])) { $data[0] = '' . $data[0] . '
    '; } @@ -609,7 +613,7 @@ $('#firing_action_select').change(function() { $('.action_details').show(); } - + $('.firing_action').hide(); if($(this).val() != -1) { $('.firing_action_' + $(this).val()).show(); diff --git a/pandora_console/godmode/massive/massive_edit_plugins.php b/pandora_console/godmode/massive/massive_edit_plugins.php new file mode 100644 index 0000000000..e25d9ff53e --- /dev/null +++ b/pandora_console/godmode/massive/massive_edit_plugins.php @@ -0,0 +1,990 @@ +", $plugin['description']); + } + if (isset($plugin['macros'])) { + $macros = json_decode($plugin['macros'], true); + if (!empty($macros)) { + $macros = array_values($macros); + + if (!empty($macros)) { + $plugin['macros'] = $macros; + } + } + } + + echo json_encode($plugin); + return; + } + + if ($get_agents) { + $sql = "SELECT ta.id_agente, ta.nombre AS agent_name, + tam.nombre AS module_name + FROM tagente ta + INNER JOIN tagente_modulo tam + ON ta.id_agente = tam.id_agente + AND tam.id_plugin = $plugin_id + ORDER BY ta.nombre, tam.nombre"; + $result = db_get_all_rows_sql($sql); + if (empty($result)) $result = array(); + + $agents = array(); + + $current_element = array(); + foreach ($result as $key => $value) { + $id = (int) $value['id_agente']; + $name = $value['agent_name']; + $module_name = $value['module_name']; + + if (!empty($current_element) && $current_element['id'] !== $id) { + $agents[] = $current_element; + $current_element = array(); + } + + $current_element['id'] = $id; + $current_element['name'] = $name; + + if (!isset($current_element['module_names'])) + $current_element['module_names'] = array(); + $current_element['module_names'][] = $module_name; + } + if (!empty($current_element)) { + $agents[] = $current_element; + } + + echo json_encode($agents); + return; + } + + if ($get_module_plugin_macros) { + $fields = array('macros'); + $filter = array( + 'id_plugin' => $plugin_id, + 'id_agente' => $agent_ids, + 'nombre' => $module_names + ); + $module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields); + if (empty($module_plugin_macros)) $module_plugin_macros = array(); + + $module_plugin_macros = array_reduce($module_plugin_macros, function($carry, $item) { + + $macros = json_decode($item['macros'], true); + if (!empty($macros)) { + $macros = array_values($macros); + if (!empty($macros)) { + $carry[] = $macros; + } + } + + return $carry; + + }, array()); + + echo json_encode($module_plugin_macros); + return; + } + + return; +} + +$update = (bool) get_parameter('update'); + +if ($update) { + try { + $plugin = db_get_row('tplugin', 'id', $plugin_id); + // Macros retrieved from the plugin definition + $plugin_macros = array(); + if (isset($plugin['macros'])) { + $plugin_macros = json_decode($plugin['macros'], true); + if (!empty($plugin_macros)) { + $plugin_macros = array_values($plugin_macros); + } + } + + // Error + if (empty($plugin_macros)) + throw new Exception(__('Error retrieving the plugin macros')); + + // Macros returned by the form + $macros = get_parameter('macros', array()); + + // Error + if (empty($macros)) + throw new Exception(__('Error retrieving the modified macros')); + + $fields = array('id_agente_modulo', 'macros'); + $filter = array( + 'id_plugin' => $plugin_id, + 'id_agente' => $agent_ids, + 'nombre' => $module_names + ); + $module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields); + if (empty($module_plugin_macros)) $module_plugin_macros = array(); + + // Error + if (empty($module_plugin_macros)) + throw new Exception(__('Error retrieving the module plugin macros')); + + // Begin transaction + // db_process_sql_begin(); + $errors = 0; + $count = 0; + + foreach ($module_plugin_macros as $item) { + + $module_id = $item['id_agente_modulo']; + $module_macros_str = $item['macros']; + // Macros retrieved from the agent module + $module_macros = json_decode($module_macros_str, true); + + // Error + if (empty($module_macros)) + throw new Exception(__('Error retrieving the module plugin macros data')); + + // Get the new module plugin macros + $result_macros = array_map(function ($item) use ($macros, $module_macros) { + + $result = array( + 'macro' => $item['macro'], + 'desc' => $item['desc'], + 'help' => $item['help'], + 'hide' => $item['hide'] + ); + + // Get the default value os the module plugin macro + $default = array_reduce($module_macros, function ($carry, $module_macro) use ($result) { + + if (isset($module_macro['macro']) && $module_macro['macro'] == $result['macro']) { + $carry = $module_macro['value']; + } + + return $carry; + + }, ''); + + set_if_defined($result['value'], $macros[$item['macro']]); + set_unless_defined($result['value'], $default); + + return $result; + + }, $plugin_macros); + + // Error + if (empty($result_macros)) + throw new Exception(__('Error building the new macros')); + + $module_macros = json_encode($result_macros); + if (empty($module_macros)) { + $module_macros = $module_macros_str; + } + + $values = array('macros' => $module_macros); + $where = array('id_agente_modulo' => $module_id); + // $result = db_process_sql_update('tagente_modulo', $values, $where, 'AND', false); + $result = db_process_sql_update('tagente_modulo', $values, $where); + + if (!$result) + $errors++; + else + $count += $result; + + } + + // if (!$errors) { + // db_process_sql_commit(); + // } + // else { + // db_process_sql_rollback(); + // } + + // Result message + ui_print_info_message(sprintf(__('%d modules updated'), $count)); + } + catch (Exception $e) { + ui_print_error_message($e->getMessage()); + } +} + +$table = new StdClass(); +$table->id = 'massive_plugin_edition'; +$table->width = '100%'; +$table->rowstyle = array(); +$table->data = array(); + +// Plugins +$filter = array('order' => 'name'); +$fields = array('id', 'name'); +$plugins = db_get_all_rows_filter('tplugin', $filter, $fields); + +if (empty($plugins)) { + ui_print_empty_data(__('There are not registered plugins')); + return; +} + +$plugins_aux = array(); +foreach ($plugins as $plugin) { + $plugins_aux[$plugin['id']] = $plugin['name']; +} +$plugins = $plugins_aux; +unset($plugins_aux); + +$plugins_select = html_print_select ($plugins, 'plugin_id', + $plugin_id, '', __('None'), 0, true, false, false); + +$row = array(); +$row[] = '' . __('Plugin') . ''; +$row[] = $plugins_select; + +$table->data['plugin-ids-row'] = $row; + +// Agents & modules +$row = array(); + +// Agents +$agents_select = html_print_select ($agent_ids, 'agent_ids[]', + false, '', '', 0, true, true, false); + +$row[] = '' . __('Agents') . ''; +$row[] = $agents_select; + +// Modules +// $modules_select = html_print_select ($module_ids, 'module_ids', +// false, '', '', 0, true, true, false); +$modules_select = html_print_select ($module_names, 'module_names[]', + false, '', '', 0, true, true, false); + +$row[] = '' . _('Modules') . ''; +$row[] = $modules_select; + +$table->rowstyle['agents-modules-row'] = 'vertical-align: top; display: none'; +$table->data['agents-modules-row'] = $row; + +echo '
    '; + +html_print_table($table); + +echo "
    "; +html_print_input_hidden('update', 1); +html_print_submit_button (__('Update'), 'upd-btn', false, 'class="sub upd"'); +echo "
    "; + +echo '
    '; + +?> + + diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index 923b2fa9cd..67faa3e41a 100755 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -58,6 +58,10 @@ $options_modules = array( 'edit_modules' => __('Bulk module edit'), 'copy_modules' => __('Bulk module copy')); +$options_plugins = array( + 'edit_plugins' => __('Bulk plugin edit') + ); + if (! check_acl ($config['id_user'], 0, "PM")) { unset($options_modules['edit_modules']); } @@ -107,6 +111,9 @@ elseif (in_array($option, array_keys($options_snmp))) { elseif (in_array($option, array_keys($options_satellite))) { $tab = 'massive_satellite'; } +elseif (in_array($option, array_keys($options_plugins))) { + $tab = 'massive_plugins'; +} else { $option = ''; } @@ -133,6 +140,9 @@ switch ($tab) { case 'massive_satellite': $options = $options_satellite; break; + case 'massive_plugins': + $options = $options_plugins; + break; } // Set the default option of the category @@ -140,35 +150,30 @@ if ($option == '') { $option = array_shift(array_keys($options)); } -$alertstab = array( - 'text' => '' - . html_print_image ('images/op_alerts.png', true, - array ('title' => __('Alerts operations'))) - . '', - 'active' => $tab == 'massive_alerts'); +$alertstab = array('text' => '' + . html_print_image ('images/op_alerts.png', true, + array ('title' => __('Alerts operations'))) + . '', 'active' => $tab == 'massive_alerts'); -$userstab = array( - 'text' => '' - . html_print_image ('images/op_workspace.png', true, - array ('title' => __('Users operations'))) - . '', - 'active' => $tab == 'massive_users'); +$userstab = array('text' => '' + . html_print_image ('images/op_workspace.png', true, + array ('title' => __('Users operations'))) + . '', 'active' => $tab == 'massive_users'); -$agentstab = array( - 'text' => '' - . html_print_image ('images/bricks.png', true, - array ('title' => __('Agents operations'))) - . '', - 'active' => $tab == 'massive_agents'); - -$modulestab = array( - 'text' => '' - . html_print_image ('images/brick.png', true, - array ('title' => __('Modules operations'))) - . '', - 'active' => $tab == 'massive_modules'); +$agentstab = array('text' => '' + . html_print_image ('images/bricks.png', true, + array ('title' => __('Agents operations'))) + . '', 'active' => $tab == 'massive_agents'); +$modulestab = array('text' => '' + . html_print_image ('images/brick.png', true, + array ('title' => __('Modules operations'))) + . '', 'active' => $tab == 'massive_modules'); +$pluginstab = array('text' => '' + . html_print_image ('images/plugin.png', true, + array ('title' => __('Plugins operations'))) + . '', 'active' => $tab == 'massive_plugins'); $policiestab = enterprise_hook('massive_policies_tab'); @@ -189,6 +194,7 @@ if ($satellitetab == ENTERPRISE_NOT_HOOK) $onheader = array(); $onheader['massive_agents'] = $agentstab; $onheader['massive_modules'] = $modulestab; +$onheader['massive_plugins'] = $pluginstab; if (check_acl ($config['id_user'], 0, "PM")) { $onheader['user_agents'] = $userstab; } @@ -221,8 +227,7 @@ $submit_template_standby = get_parameter('id_alert_template_standby'); $submit_add = get_parameter('crtbutton'); echo '
    '; -echo html_print_image("images/wait.gif", true, array("border" => '0')) . - '
    '; +echo html_print_image("images/wait.gif", true, array("border" => '0')) . '
    '; echo '' . __('Please wait...') . ''; echo '
    '; ?> @@ -254,19 +259,14 @@ echo ''; "; echo '
    '; -echo ''; -echo ''; -echo '
    '; +echo ''; -echo ''; -echo ''; -echo '
    '; echo __("Action"); -echo ''; +echo ''; html_print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false); if ($option == 'edit_agents' || $option == 'edit_modules') ui_print_help_tip(__("The blank fields will not be updated")); -echo '
    '; +echo '
    '; echo '
    '; echo "
    "; @@ -310,6 +310,9 @@ switch ($option) { case 'copy_modules': require_once ('godmode/massive/massive_copy_modules.php'); break; + case 'edit_plugins': + require_once ('godmode/massive/massive_edit_plugins.php'); + break; default: if (!enterprise_hook('massive_operations', array($option))) { require_once ('godmode/massive/massive_config.php'); diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 0c2debac22..2785ba13c4 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -105,6 +105,7 @@ if (check_acl ($config['id_user'], 0, "PM")) { $sub2 = array (); $sub2["godmode/massive/massive_operations&tab=massive_agents"]["text"] = __('Agents operations'); $sub2["godmode/massive/massive_operations&tab=massive_modules"]["text"] = __('Modules operations'); + $sub2["godmode/massive/massive_operations&tab=massive_plugins"]["text"] = __('Plugins operations'); if (check_acl ($config['id_user'], 0, "PM")) { $sub2["godmode/massive/massive_operations&tab=massive_users"]["text"] = __('Users operations'); } diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 9a1f038f83..c2b6dc7803 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -312,7 +312,7 @@ if (($create != "") OR ($view != "")) { $data[0] = __('Plugin command'); $data[1] = ''; if ($locked) { - $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf lock')); } $data[1] .= ' '; $data[1] .= html_print_image('images/file.png', true); @@ -323,7 +323,7 @@ if (($create != "") OR ($view != "")) { $data[0] = __('Plug-in parameters').ui_print_help_icon ('plugin_parameters', true); $data[1] = ''; if ($locked) { - $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf lock')); } $table->data['plugin_parameters'] = $data; @@ -358,7 +358,7 @@ if (($create != "") OR ($view != "")) { $i = 1; while (1) { // Always print at least one macro - if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { + if ((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { break; } $macro_desc_name = 'field'.$i.'_desc'; @@ -372,19 +372,19 @@ if (($create != "") OR ($view != "")) { $macro_hide_value_name = 'field'.$i.'_hide'; $macro_hide_value_value = 0; - if(isset($macros[$i]['desc'])) { + if (isset($macros[$i]['desc'])) { $macro_desc_value = $macros[$i]['desc']; } - if(isset($macros[$i]['help'])) { + if (isset($macros[$i]['help'])) { $macro_help_value = $macros[$i]['help']; } - if(isset($macros[$i]['value'])) { + if (isset($macros[$i]['value'])) { $macro_value_value = $macros[$i]['value']; } - if(isset($macros[$i]['hide'])) { + if (isset($macros[$i]['hide'])) { $macro_hide_value_value = $macros[$i]['hide']; // Decrypt hidden macros. @@ -394,15 +394,15 @@ if (($create != "") OR ($view != "")) { $datam = array (); $datam[0] = __('Description')." ($macro_name)"; $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); - $datam[1] = html_print_input_text_extended ($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_advanced_conf'", true); - if($locked) { - $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + $datam[1] = html_print_input_text_extended ($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro'", true); + if ($locked) { + $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_macro lock')); } $datam[2] = __('Default value')." ($macro_name)"; - $datam[3] = html_print_input_text_extended ($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_advanced_conf'", true); - if($locked) { - $datam[3] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + $datam[3] = html_print_input_text_extended ($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro'", true); + if ($locked) { + $datam[3] .= html_print_image('images/lock.png', true, array('class' => 'command_macro lock')); } $table->data['plugin_'.$next_name_number] = $datam; @@ -413,7 +413,7 @@ if (($create != "") OR ($view != "")) { $datam = array (); $datam[0] = __('Hide value') . ui_print_help_tip(__('This field will show up as dots like a password'), true); - $datam[1] = html_print_checkbox_extended ($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', array('class' => 'command_advanced_conf'), true, 'checkbox-'.$macro_hide_value_name); + $datam[1] = html_print_checkbox_extended ($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', array('class' => 'command_macro'), true, 'checkbox-'.$macro_hide_value_name); $table->data['plugin_'.$next_name_number] = $datam; $next_name_number++; @@ -423,10 +423,10 @@ if (($create != "") OR ($view != "")) { $datam = array (); $datam[0] = __('Help')." ($macro_name)


    "; $tadisabled = $locked === true ? ' disabled' : ''; - $datam[1] = html_print_textarea ($macro_help_name, 6, 100, $macro_help_value, 'class="command_advanced_conf" style="width: 97%;"' . $tadisabled, true); + $datam[1] = html_print_textarea ($macro_help_name, 6, 100, $macro_help_value, 'class="command_macro" style="width: 97%;"' . $tadisabled, true); - if($locked) { - $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); + if ($locked) { + $datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_macro lock')); } $datam[1] .= "


    "; @@ -435,22 +435,41 @@ if (($create != "") OR ($view != "")) { $i++; } + // Add/Delete buttons + $datam = array (); + $datam[0] = '
    ' . + '' . + __('Add macro') . + '' . ' ' . + html_print_image('images/add.png',true) . + ''; + $datam[0] .= ''; + $datam[0] .= ''; + if (!$locked) { - $datam = array (); - $datam[0] = ''.__('Add macro').' '.html_print_image('images/add.png',true).''; - $datam[0] .= ''; - $datam[0] .= ''; $delete_macro_style = ''; - if($i <= 2) { + if ($i <= 2) { $delete_macro_style = 'display:none;'; } - $datam[2] = '
    '.__('Delete macro').' '.html_print_image('images/delete.png',true).'
    '; + $datam[2] = '
    ' . + '' . + '' . + __('Delete macro') . + '' . ' ' . + html_print_image('images/delete.png',true) . + '' . + '
    '; $table->colspan['plugin_action'][0] = 2; - $table->rowstyle['plugin_action'] = 'text-align:center'; $table->colspan['plugin_action'][2] = 2; - $table->data['plugin_action'] = $datam; } + else { + $table->colspan['plugin_action'][0] = 4; + } + + $table->rowstyle['plugin_action'] = 'text-align:center'; + $table->data['plugin_action'] = $datam; + if (defined("METACONSOLE")) { $table->width = '100%'; @@ -749,37 +768,31 @@ ui_require_javascript_file('pandora_modules'); ?> diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index 3fc1809f7c..9cc6122df0 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -117,52 +117,53 @@ else { $result = tags_search_tag(false, $filter); } -// Form to add new tags or search tags -if (!defined('METACONSOLE')) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "
    "; - echo '' . __("Name") . "/" . __("Description") . ''; - echo ""; - echo '
    '; - html_print_input_hidden ("search_tag", "1"); - html_print_input_text ('tag_name', $tag_name, '', 30, 255, false); - echo "   "; - html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"'); - echo "
    "; - echo "
    "; -} -else { - - $filters = '
    '; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= "
    "; - $filters .= __("Name") . "/" . __("Description"); - $filters .= "  "; - $filters .= html_print_input_hidden ("search_tag", "1",true); - $filters .= html_print_input_text ('tag_name', $tag_name, '', 30, 255, true); - $filters .= ""; - $filters .= html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"',true); - $filters .= "
    "; - $filters .= "
    "; - ui_toggle($filters, __("Show Options")); -} - -// Prepare pagination -ui_pagination ($total_tags, $url); - -// Display tags previously filtered or not -$rowPair = true; -$iterator = 0; - if (!empty($result)) { + // Form to add new tags or search tags + if (!defined('METACONSOLE')) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
    "; + echo '' . __("Name") . "/" . __("Description") . ''; + echo ""; + echo '
    '; + html_print_input_hidden ("search_tag", "1"); + html_print_input_text ('tag_name', $tag_name, '', 30, 255, false); + echo "   "; + html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"'); + echo "
    "; + echo "
    "; + } + else { + + $filters = '
    '; + $filters .= ""; + $filters .= ""; + $filters .= ""; + $filters .= ""; + $filters .= ""; + $filters .= "
    "; + $filters .= __("Name") . "/" . __("Description"); + $filters .= "  "; + $filters .= html_print_input_hidden ("search_tag", "1",true); + $filters .= html_print_input_text ('tag_name', $tag_name, '', 30, 255, true); + $filters .= ""; + $filters .= html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"',true); + $filters .= "
    "; + $filters .= "
    "; + ui_toggle($filters, __("Show Options")); + } + + // Prepare pagination + ui_pagination ($total_tags, $url); + + // Display tags previously filtered or not + $rowPair = true; + $iterator = 0; + + $table = new stdClass(); $table->width = '100%'; @@ -241,7 +242,12 @@ if (!empty($result)) { html_print_table ($table); } - +else{ + if(!defined("METACONSOLE")){ + require_once ($config['homedir'] . "/general/firts_task/tags.php"); + return; + } +} echo ""; echo ""; echo "
    "; diff --git a/pandora_console/godmode/update_manager/update_manager.css b/pandora_console/godmode/update_manager/update_manager.css index 8a07438ef5..7b276e6b9b 100644 --- a/pandora_console/godmode/update_manager/update_manager.css +++ b/pandora_console/godmode/update_manager/update_manager.css @@ -1,141 +1,141 @@ .fileupload_form { - background-color: #373A3D; - background-image: -moz-linear-gradient(center top , #373A3D, #313437); - border-radius: 3px; - font-family: 'PT Sans Narrow',sans-serif; - margin: 0px; - padding: 30px; + background-color: #373A3D; + background-image: -moz-linear-gradient(center top , #373A3D, #313437); + border-radius: 3px; + font-family: 'PT Sans Narrow',sans-serif; + margin: 0px; + padding: 30px; } #drop_file { - background-color: #E6E6E6; - border: 20px solid rgba(0, 0, 0, 0); - border-radius: 3px; - color: #707070; - font-size: 16px; - font-weight: bold; - margin-bottom: 30px; - padding: 40px 50px; - text-align: center; - text-transform: uppercase; + background-color: #E6E6E6; + border: 20px solid rgba(0, 0, 0, 0); + border-radius: 3px; + color: #707070; + font-size: 16px; + font-weight: bold; + margin-bottom: 30px; + padding: 40px 50px; + text-align: center; + text-transform: uppercase; } #drop_file table { - vertical-align: middle; + vertical-align: middle; } #drop_file table td, #drop_file table label { - color: #707070; - font-family: 'PT Sans Narrow',sans-serif; - font-size: 16px; - font-weight: bold; - margin-top: 0; - vertical-align: middle; + color: #707070; + font-family: 'PT Sans Narrow',sans-serif; + font-size: 16px; + font-weight: bold; + margin-top: 0; + vertical-align: middle; } #drop_file table select { - float: none; + float: none; } #drop_file a { - background-color: #FF9933; - border-radius: 2px; - color: #FFFFFF; - cursor: pointer; - display: inline-block; - font-size: 14px; - line-height: 1; - padding: 12px 26px; + background-color: #80BA27; + border-radius: 2px; + color: #FFFFFF; + cursor: pointer; + display: inline-block; + font-size: 14px; + line-height: 1; + padding: 12px 26px; } #drop_file a:hover { - background-color: #FFB972; - text-decoration: none; + background-color: #A6CE67; + text-decoration: none; } #drop_file input { - display: none; + display: none; } .fileupload_form ul { - border-bottom: 1px solid #3D4043; - border-top: 1px solid #2B2E31; - list-style: none outside none; - margin: 0 -30px; - padding: 0; + border-bottom: 1px solid #3D4043; + border-top: 1px solid #2B2E31; + list-style: none outside none; + margin: 0 -30px; + padding: 0; } .fileupload_form ul li { - background-color: #333639; - background-image: -moz-linear-gradient(center top , #333639, #303335); - border-bottom: 1px solid #2B2E31; - border-top: 1px solid #3D4043; - padding: 15px; - position: relative; + background-color: #333639; + background-image: -moz-linear-gradient(center top , #333639, #303335); + border-bottom: 1px solid #2B2E31; + border-top: 1px solid #3D4043; + padding: 15px; + position: relative; } .fileupload_form ul li #input-progress { - left: 68px; - position: absolute; + left: 68px; + position: absolute; } .fileupload_form ul li p { - color: #EEEEEE; - font-size: 12px; - font-weight: bold; - left: 95px; - overflow: hidden; - position: absolute; - top: 12px; - white-space: nowrap; + color: #EEEEEE; + font-size: 12px; + font-weight: bold; + left: 95px; + overflow: hidden; + position: absolute; + top: 12px; + white-space: nowrap; } .fileupload_form ul li i { - color: #7F7F7F; - display: block; - font-style: normal; - font-weight: normal; + color: #7F7F7F; + display: block; + font-style: normal; + font-weight: normal; } .fileupload_form ul li canvas { - left: 13px; - position: absolute; - top: 15px; + left: 13px; + position: absolute; + top: 15px; } .fileupload_form ul li span { - background: url("../../images/check-cross.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); - cursor: pointer; - height: 12px; - position: absolute; - right: 13px; - top: 34px; - width: 15px; + background: url("../../images/check-cross.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); + cursor: pointer; + height: 12px; + position: absolute; + right: 13px; + top: 34px; + width: 15px; } .fileupload_form ul li div { - display: block !important; + display: block !important; } .fileupload_form ul li.working span { - background-position: 0 -12px; - height: 16px; + background-position: 0 -12px; + height: 16px; } .fileupload_form ul li.loading span { - background: url("../../images/spinner.gif") no-repeat scroll 0 0 rgba(0, 0, 0, 0); - height: 16px; + background: url("../../images/spinner.gif") no-repeat scroll 0 0 rgba(0, 0, 0, 0); + height: 16px; } .fileupload_form ul li.suc span { - background: url("../../images/check-cross.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); - height: 12px; + background: url("../../images/check-cross.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); + height: 12px; } .fileupload_form ul li.suc p { - color: #5A8629; + color: #5A8629; } .fileupload_form ul li.error span { - background: url("../../images/check-cross.png") no-repeat scroll 0 -12px rgba(0, 0, 0, 0); - height: 16px; + background: url("../../images/check-cross.png") no-repeat scroll 0 -12px rgba(0, 0, 0, 0); + height: 16px; } .fileupload_form ul li.error p { - color: #FF3333; + color: #FF3333; } #log_zone { - background-color: #E6E6E6; - border: 20px solid rgba(0, 0, 0, 0); - border-radius: 3px; - color: #707070; - font-size: 12px; - margin-bottom: 30px; - padding: 10px; - text-align: left; + background-color: #E6E6E6; + border: 20px solid rgba(0, 0, 0, 0); + border-radius: 3px; + color: #707070; + font-size: 12px; + margin-bottom: 30px; + padding: 10px; + text-align: left; } #box_online { - background-color: #E6E6E6; - padding: 10px; + background-color: #E6E6E6; + padding: 10px; } \ No newline at end of file diff --git a/pandora_console/godmode/update_manager/update_manager.offline.php b/pandora_console/godmode/update_manager/update_manager.offline.php index db0c14c307..ce9faad466 100644 --- a/pandora_console/godmode/update_manager/update_manager.offline.php +++ b/pandora_console/godmode/update_manager/update_manager.offline.php @@ -16,21 +16,25 @@ global $config; -ui_require_css_file('update_manager', 'godmode/update_manager/'); +// ui_require_css_file('update_manager', 'godmode/update_manager/'); + +$baseurl = ui_get_full_url(false, false, false, false); ?> + + + +
    @@ -38,12 +42,12 @@ ui_require_css_file('update_manager', 'godmode/update_manager/');
      - - - + + + - + \ No newline at end of file + form_upload(""); + diff --git a/pandora_console/godmode/update_manager/update_manager.php b/pandora_console/godmode/update_manager/update_manager.php index 45692f9c28..34d99ba324 100644 --- a/pandora_console/godmode/update_manager/update_manager.php +++ b/pandora_console/godmode/update_manager/update_manager.php @@ -53,14 +53,14 @@ ui_print_page_header($title, switch ($tab) { case 'setup': - require("update_manager.setup.php"); + require($config['homedir'] . "/godmode/update_manager/update_manager.setup.php"); break; case 'offline': - require("update_manager.offline.php"); + require($config['homedir'] . "/godmode/update_manager/update_manager.offline.php"); break; case 'online': default: - require("update_manager.online.php"); + require($config['homedir'] . "/godmode/update_manager/update_manager.online.php"); break; } ?> \ No newline at end of file diff --git a/pandora_console/images/chart_curve_overview.disabled.png b/pandora_console/images/chart_curve_overview.disabled.png index 268701fc71..c3586c1684 100644 Binary files a/pandora_console/images/chart_curve_overview.disabled.png and b/pandora_console/images/chart_curve_overview.disabled.png differ diff --git a/pandora_console/images/chart_curve_overview.png b/pandora_console/images/chart_curve_overview.png index 477e34f252..f8e69bb221 100644 Binary files a/pandora_console/images/chart_curve_overview.png and b/pandora_console/images/chart_curve_overview.png differ diff --git a/pandora_console/images/csv_grey.png b/pandora_console/images/csv_grey.png new file mode 100644 index 0000000000..545cc10576 Binary files /dev/null and b/pandora_console/images/csv_grey.png differ diff --git a/pandora_console/images/csv_grey_disabled.png b/pandora_console/images/csv_grey_disabled.png new file mode 100644 index 0000000000..9e4175948b Binary files /dev/null and b/pandora_console/images/csv_grey_disabled.png differ diff --git a/pandora_console/images/update.png b/pandora_console/images/update.png new file mode 100644 index 0000000000..d0f2275ac2 Binary files /dev/null and b/pandora_console/images/update.png differ diff --git a/pandora_console/images/zoom_cross_grey.disabled.png b/pandora_console/images/zoom_cross_grey.disabled.png new file mode 100644 index 0000000000..2918f35535 Binary files /dev/null and b/pandora_console/images/zoom_cross_grey.disabled.png differ diff --git a/pandora_console/images/zoom_cross_grey.png b/pandora_console/images/zoom_cross_grey.png new file mode 100644 index 0000000000..b39f7bcb2c Binary files /dev/null and b/pandora_console/images/zoom_cross_grey.png differ diff --git a/pandora_console/include/ajax/update_manager.ajax.php b/pandora_console/include/ajax/update_manager.ajax.php index e134ba719d..18d52a5d9f 100644 --- a/pandora_console/include/ajax/update_manager.ajax.php +++ b/pandora_console/include/ajax/update_manager.ajax.php @@ -15,8 +15,8 @@ global $config; -require_once("include/functions_update_manager.php"); -require_once("include/functions_graph.php"); +require_once($config['homedir'] . "/include/functions_update_manager.php"); +require_once($config['homedir'] . "/include/functions_graph.php"); enterprise_include_once("include/functions_update_manager.php"); $upload_file = (boolean) get_parameter("upload_file"); @@ -131,7 +131,7 @@ if ($install_package) { if (file_exists($config["homedir"]."/".$line)) { rename($config["homedir"]."/".$line, $package."/backup/".$line); } - // Tries to move the new file to the Integria directory + // Tries to move the new file to the Pandora directory $dirname = dirname($line); if (!file_exists($config["homedir"]."/".$dirname)) { $dir_array = explode("/", $dirname); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 2cd087ea8e..7c817e9f1d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150629'; +$build_version = 'PC150630'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 9d1e6052cb..947ddb9f5a 100755 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -8049,40 +8049,46 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) { if (defined ('METACONSOLE')) { return; } - + if (is_nan($id_module) || $id_module <= 0) { returnError('error_module_graph', __('')); return; } - + $id_exist = (bool) db_get_value ('id_agente_modulo', 'tagente_modulo', 'id_agente_modulo', $id_module); - + if (!$id_exist) { // returnError('id_not_found'); return; } - - $graph_seconds =(!empty($other) && isset($other['data'])) ? $other['data'] : 3600; // 1 hour by default - + + $graph_seconds = + (!empty($other) && isset($other['data'])) + ? + $other['data'] + : + SECONDS_1HOUR; // 1 hour by default + if (is_nan($graph_seconds) || $graph_seconds <= 0) { // returnError('error_module_graph', __('')); return; } // Get the html item - $graph_html = grafico_modulo_sparse($id_module, $graph_seconds, false, 600, 300, '', - '', false, false, true, time(), '', 0, 0, true, true, - ui_get_full_url(false) . '/', 1, false, '', false, true); - + $graph_html = grafico_modulo_sparse( + $id_module, $graph_seconds, false, 600, 300, '', + '', false, false, true, time(), '', 0, 0, true, true, + ui_get_full_url(false) . '/', 1, false, '', false, true); + $graph_image_file_encoded = false; - + // Get the src of the html item if (preg_match("//", $graph_html, $matches)) { if (isset($matches) && isset($matches[1])) { $file_url = $matches[1]; // Get the file $graph_image_file = file_get_contents($file_url); - + if ($graph_image_file !== false) { // Encode the file $graph_image_file_encoded = base64_encode($graph_image_file); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c02408f1dd..3d059d0383 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -95,36 +95,43 @@ function reporting_get_name($id_report) { return db_get_value('name', 'treport', 'id_report', $id_report); } -function reporting_make_reporting_data($id_report, $date, $time, - $period = null, $type = 'dinamic', $force_width_chart = null, - $force_height_chart = null) { +function reporting_make_reporting_data($report = null, $id_report, + $date, $time, $period = null, $type = 'dinamic', + $force_width_chart = null, $force_height_chart = null) { global $config; $return = array(); - $report = db_get_row ('treport', 'id_report', $id_report); + if (!empty($report)) { + $contents = $report['contents']; + } + else { + $report = db_get_row ('treport', 'id_report', $id_report); + + switch ($config["dbtype"]) { + case "mysql": + $contents = db_get_all_rows_field_filter ("treport_content", + "id_report", $id_report, "`order`"); + break; + case "postgresql": + $contents = db_get_all_rows_field_filter ("treport_content", + "id_report", $id_report, '"order"'); + break; + case "oracle": + $contents = db_get_all_rows_field_filter ("treport_content", + "id_report", $id_report, '"order"'); + break; + } + } + + $datetime = strtotime($date . ' ' . $time); + $report["datetime"] = $datetime; $report["group"] = $report['id_group']; $report["group_name"] = groups_get_name ($report['id_group']); $report['contents'] = array(); - $datetime = strtotime($date . ' ' . $time); - $report["datetime"] = $datetime; - switch ($config["dbtype"]) { - case "mysql": - $contents = db_get_all_rows_field_filter ("treport_content", - "id_report", $id_report, "`order`"); - break; - case "postgresql": - $contents = db_get_all_rows_field_filter ("treport_content", - "id_report", $id_report, '"order"'); - break; - case "oracle": - $contents = db_get_all_rows_field_filter ("treport_content", - "id_report", $id_report, '"order"'); - break; - } - if ($contents === false) { + if (empty($contents)) { return reporting_check_structure_report($report); } @@ -477,9 +484,14 @@ function reporting_SLA($report, $content, $type = 'dinamic', $edge_interval = 10; - $slas = db_get_all_rows_field_filter ( - 'treport_content_sla_combined', - 'id_report_content', $content['id_rc']); + if (empty($content['subitems'])) { + $slas = db_get_all_rows_field_filter ( + 'treport_content_sla_combined', + 'id_report_content', $content['id_rc']); + } + else { + $slas = $content['subitems']; + } if (empty($slas)) { $return['failed'] = __('There are no SLAs defined'); @@ -929,12 +941,19 @@ function reporting_event_top_n($report, $content, $type = 'dinamic', $top_n_value = $content['top_n_value']; $show_graph = $content['show_graph']; - //Get all the related data - $sql = sprintf("SELECT id_agent_module, server_name - FROM treport_content_item - WHERE id_report_content = %d", $content['id_rc']); - $tops = db_process_sql ($sql); + + if (empty($content['subitems'])) { + //Get all the related data + $sql = sprintf("SELECT id_agent_module, server_name + FROM treport_content_item + WHERE id_report_content = %d", $content['id_rc']); + + $tops = db_process_sql ($sql); + } + else { + $tops = $content['subitems']; + } // Get chart reporting_set_conf_charts($width, $height, $only_image, $type, @@ -1727,13 +1746,22 @@ function reporting_exception($report, $content, $type = 'dinamic', - //Get all the related data - $sql = sprintf(" - SELECT id_agent_module, server_name, operation - FROM treport_content_item - WHERE id_report_content = %d", $content['id_rc']); - $exceptions = db_process_sql ($sql); + + if (empty($content['subitems'])) { + //Get all the related data + $sql = sprintf(" + SELECT id_agent_module, server_name, operation + FROM treport_content_item + WHERE id_report_content = %d", $content['id_rc']); + + $exceptions = db_process_sql ($sql); + } + else { + $exceptions = $content['subitems']; + } + + if ($exceptions === false) { $return['failed'] = __('There are no Agent/Modules defined'); } @@ -3729,14 +3757,21 @@ function reporting_availability($report, $content) { } - $sql = sprintf(" - SELECT id_agent_module, - server_name, operation - FROM treport_content_item - WHERE id_report_content = %d", - $content['id_rc']); + if (empty($content['subitems'])) { + $sql = sprintf(" + SELECT id_agent_module, + server_name, operation + FROM treport_content_item + WHERE id_report_content = %d", + $content['id_rc']); + + $items = db_process_sql ($sql); + } + else { + $items = $content['subitems']; + } - $items = db_process_sql ($sql); + $data = array(); @@ -3964,9 +3999,16 @@ function reporting_general($report, $content) { $return["max"]["agent"] = null; $return["max"]["module"] = null; - $generals = db_get_all_rows_filter( - 'treport_content_item', - array('id_report_content' => $content['id_rc'])); + if (empty($content['subitems'])) { + $generals = db_get_all_rows_filter( + 'treport_content_item', + array('id_report_content' => $content['id_rc'])); + } + else { + $generals = $content['subitems']; + } + + if (empty($generals)) { $generals = array(); } diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 5b54f46db2..56a889b281 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -500,7 +500,8 @@ function reports_get_report_types ($template = false, $not_editor = false) { $types['simple_baseline_graph'] = array('optgroup' => __('Graphs'), 'name' => __('Simple baseline graph')); if ($not_editor == false) - $types['automatic_custom_graph'] = array('optgroup' => __('Graphs'), + $types['automatic_custom_graph'] = array( + 'optgroup' => __('Graphs'), 'name' => __('Custom graph')); $types['custom_graph'] = array('optgroup' => __('Graphs'), 'name' => __('Custom graph')); @@ -513,7 +514,7 @@ function reports_get_report_types ($template = false, $not_editor = false) { $types['sql_graph_hbar'] = array('optgroup' => __('Graphs'), 'name' => __('SQL horizonal bar graph')); } - if ($template) { + if ($template && !defined('METACONSOLE')) { $types['automatic_graph'] = array('optgroup' => __('Graphs'), 'name' => __('Automatic combined Graph')); } diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 5cbfdd7e8b..a3f22082a6 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -797,7 +797,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, })); $('#menu_cancelzoom_' + graph_id) - .attr('src', homeurl + '/images/zoom_cross.png'); + .attr('src', homeurl + '/images/zoom_cross_grey.png'); currentRanges = ranges; // don't fire event on the overview to prevent eternal loop @@ -1250,7 +1250,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, })); $('#menu_cancelzoom_' + graph_id) - .attr('src', homeurl + '/images/zoom_cross.disabled.png'); + .attr('src', homeurl + '/images/zoom_cross_grey.disabled.png'); overview.clearSelection(); currentRanges = null; }); diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 36fbcd6141..d273d930aa 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -299,14 +299,14 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, "border: solid 1px #666; ". "border-bottom: 0px; " . "padding: 4px 4px 4px 4px'> - ".__("; + ".__("; if ($threshold) { $return .= " ".__("; } $return .= " ".__("; // Export buttons - $return .= " ".__("; + $return .= " ".__("; // Button disabled. This feature works, but seems that is not useful enough to the final users. //$return .= " ".__("; diff --git a/pandora_console/include/help/en/help_action_threshold.php b/pandora_console/include/help/en/help_action_threshold.php index 7faff692f9..cc3884a85c 100755 --- a/pandora_console/include/help/en/help_action_threshold.php +++ b/pandora_console/include/help/en/help_action_threshold.php @@ -6,10 +6,16 @@

      Action Threshold

      -An alert action will not be executed more than once every action_threshold seconds, regardless of the number of times the alert is fired. - -For example, if you have configured an action that sends you an email when the alert fires and you don't want to receive more than one email per hour, you can set the action_threshold to 3600. - -Bear in mind that the individual action_threshold of an action overrides the global action_threshold of the alert. - +An alert action will not be executed more than once every +action_threshold seconds, regardless of the number of times the alert is +fired. +

      +

      +For example, if you have configured an action that sends you an email +when the alert fires and you don't want to receive more than one email +per hour, you can set the action_threshold to 3600. +

      +

      +Bear in mind that the individual action_threshold of an action overrides +the global action_threshold of the alert.

      diff --git a/pandora_console/include/help/es/help_action_threshold.php b/pandora_console/include/help/es/help_action_threshold.php index f0861b60d6..d2c0482840 100755 --- a/pandora_console/include/help/es/help_action_threshold.php +++ b/pandora_console/include/help/es/help_action_threshold.php @@ -6,10 +6,16 @@

      Umbral de acción

      -Una acción de una alerta no se ejecutará más de una vez cada action_threshold segundos, independientemenete del número de veces que se dispare la alerta. - -Por ejemplo, si ha configurado una acción que le envía un email cuando la alerta se dispara y no quiere recibir más de un email por hora, puede configurar un action_threshold de 3600. - -Tenga en cuenta que el action_threshold individual de una acción tiene precedencia sobre el action_threshold global de una alerta. - +Una acción de una alerta no se ejecutará más de una vez cada +action_threshold segundos, independientemenete del número de veces que +se dispare la alerta. +

      +

      +Por ejemplo, si ha configurado una acción que le envía un email cuando +la alerta se dispara y no quiere recibir más de un email por hora, puede +configurar un action_threshold de 3600. +

      +

      +Tenga en cuenta que el action_threshold individual de una acción tiene +precedencia sobre el action_threshold global de una alerta.

      diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 1c1b88c27f..86ee03e9d1 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -475,7 +475,10 @@ function delete_macro(prefix) { var $row3 = $('#'+prefix+nrow3).remove(); } -function new_macro(prefix) { +// The callback parameter is for a callback function +// that will receive the 3 rows (function(row1, row2, row3)) +// to edit them before the new_macro function ends. +function new_macro(prefix, callback) { $('#delete_macro_button').show(); var next_row = parseInt($('#next_row').html()); @@ -539,6 +542,9 @@ function new_macro(prefix) { $('#text-field' + next_number + '_value').val(''); $('#radio-field' + next_number + '_hide').val(0); + if (typeof callback === 'function') + callback($row1, $row2, $row3); + function changeTdId() { switch(this.id) { case prefix + (nrow1) + '-0': @@ -677,6 +683,9 @@ function load_plugin_macros_fields(row_model_id) { add_macro_field(macro, row_model_id); } }); + + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); } } }); diff --git a/pandora_console/include/javascript/update_manager.js b/pandora_console/include/javascript/update_manager.js index b33968aeca..1388bc73f7 100644 --- a/pandora_console/include/javascript/update_manager.js +++ b/pandora_console/include/javascript/update_manager.js @@ -1,6 +1,11 @@ var correct_install_progress = true; -function form_upload () { +function form_upload (homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; + //Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/ var ul = $('#form-offline_update ul'); @@ -18,7 +23,7 @@ function form_upload () { // Initialize the jQuery File Upload plugin $('#form-offline_update').fileupload({ - url: 'ajax.php?page=include/ajax/update_manager.ajax&upload_file=true', + url: homeurl + 'ajax.php?page=include/ajax/update_manager.ajax&upload_file=true', // This element will accept file drag/drop uploading dropZone: $('#drop_file'), @@ -31,8 +36,8 @@ function form_upload () { var tpl = $('
    • ' + '' + + 'data-fgColor="#80BA27" data-readOnly="1" ' + + 'data-bgColor="#3E4043" />' + '

      ' + '
    • '); @@ -139,7 +144,7 @@ function form_upload () { data.context.find('input').val(0).change(); // Begin the installation - install_package(res.package, 'filename'); + install_package(res.package, homeurl); }); } else { @@ -188,30 +193,12 @@ function formatFileSize(bytes) { return (bytes / 1000).toFixed(2) + ' KB'; } -function install_package(package) { - var parameters = {}; - parameters['page'] = 'include/ajax/update_manager.ajax'; - parameters['install_package'] = 1; - parameters['package'] = package; +function install_package (package, homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; - jQuery.post( - "ajax.php", - parameters, - function (data) { - if (data["status"] == "success") { - install_package_step2(package); - } - else { - $("#box_online .loading").hide(); - $("#box_online .content").html(data['message']); - stop_check_progress = 1; - } - }, - "json" - ); -} - -function install_package (package) { var parameters = {}; parameters['page'] = 'include/ajax/update_manager.ajax'; parameters['install_package'] = 1; @@ -222,7 +209,7 @@ function install_package (package) { $.ajax({ type: 'POST', - url: 'ajax.php', + url: homeurl + 'ajax.php', data: parameters, dataType: "json", success: function (data) { @@ -245,10 +232,10 @@ function install_package (package) { }); // Check the status of the update - check_install_package(package); + check_install_package(package, homeurl); } -function check_install_package(package) { +function check_install_package(package, homeurl) { var parameters = {}; parameters['page'] = 'include/ajax/update_manager.ajax'; parameters['check_install_package'] = 1; @@ -256,7 +243,7 @@ function check_install_package(package) { $.ajax({ type: 'POST', - url: 'ajax.php', + url: homeurl + 'ajax.php', data: parameters, dataType: "json", success: function(data) { @@ -275,13 +262,18 @@ function check_install_package(package) { var isInstalling = $('#form-offline_update ul').find('li').hasClass('loading'); if (data.progress < 100 && isInstalling) { // Recursive call to check the update status - check_install_package(package); + check_install_package(package, homeurl); } } }) } -function check_online_free_packages() { +function check_online_free_packages(homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; + $("#box_online .checking_package").show(); var parameters = {}; @@ -289,7 +281,7 @@ function check_online_free_packages() { parameters['check_online_free_packages'] = 1; jQuery.post( - "ajax.php", + homeurl + "ajax.php", parameters, function (data) { $("#box_online .checking_package").hide(); @@ -301,7 +293,12 @@ function check_online_free_packages() { ); } -function update_last_package(package, version) { +function update_last_package(package, version, homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; + version_update = version; $("#box_online .content").html(""); @@ -316,7 +313,7 @@ function update_last_package(package, version) { parameters['version'] = version; jQuery.post( - "ajax.php", + homeurl + "ajax.php", parameters, function (data) { if (data['in_progress']) { @@ -325,8 +322,10 @@ function update_last_package(package, version) { $("#box_online .content").html(data['message']); - install_free_package(package,version); - setTimeout(check_progress_update, 1000); + install_free_package(package, version, homeurl); + setTimeout(function () { + check_progress_update(homeurl); + }, 1000); } else { $("#box_online .content").html(data['message']); @@ -336,7 +335,12 @@ function update_last_package(package, version) { ); } -function check_progress_update() { +function check_progress_update(homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; + if (stop_check_progress) { return; } @@ -346,7 +350,7 @@ function check_progress_update() { parameters['check_update_free_package'] = 1; jQuery.post( - "ajax.php", + homeurl + "ajax.php", parameters, function (data) { if (stop_check_progress) { @@ -363,7 +367,9 @@ function check_progress_update() { $("#box_online .progressbar .progressbar_img").attr('src', data['progressbar']); - setTimeout(check_progress_update, 1000); + setTimeout(function () { + check_progress_update(homeurl); + }, 1000); } } else { @@ -375,7 +381,12 @@ function check_progress_update() { ); } -function install_free_package(package,version) { +function install_free_package(package, version, homeurl) { + if (typeof homeurl !== 'undefined') + homeurl += '/'; + else + homeurl = ''; + var parameters = {}; parameters['page'] = 'include/ajax/update_manager.ajax'; parameters['install_free_package'] = 1; @@ -385,7 +396,7 @@ function install_free_package(package,version) { jQuery.ajax ({ data: parameters, type: 'POST', - url: "ajax.php", + url: homeurl + "ajax.php", timeout: 600000, dataType: "json", error: function(data) { @@ -393,7 +404,7 @@ function install_free_package(package,version) { stop_check_progress = 1; $("#box_online .loading").hide(); - $("#box_online .progressbar").hide(); + $("#box_online .progressbar").hide(); $("#box_online .content").html(unknown_error_update_manager); }, success: function (data) { diff --git a/pandora_console/install.php b/pandora_console/install.php index 2d96337511..dc2a395ae6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
      size[0] = '60px'; $table->colspan[0][1] = 2; $table->style[0] = 'text-align:center;'; $table->data = array (); -$table->data[0][0] = html_print_image("images/reporting32.png", true, array("width" => "32", "height" => "32")); +$table->data[0][0] = html_print_image("images/reporting32.png", true, + array("width" => "32", "height" => "32")); if (defined("METACONSOLE")) { if ($report['description'] != '') { $table->data[0][1] = '
      ' . __("Description: ") . $report['description'] . '
      '; @@ -215,7 +216,8 @@ else { } $table->data[0][1] .= '
      '.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true); - $html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report)); + $html_enterprise = enterprise_hook('reporting_print_button_PDF', + array($id_report)); if ($html_enterprise !== ENTERPRISE_NOT_HOOK) { $table->data[0][1] .= $html_enterprise; } @@ -245,7 +247,9 @@ if ($enable_init_date) { } } -$report = reporting_make_reporting_data($id_report, $date, $time, $period, 'dinamic'); +$report = reporting_make_reporting_data(null, $id_report, $date, $time, + $period, 'dinamic'); + reporting_html_print_report($report); echo "
      "; diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 8b1459e631..cff9376ef6 100755 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -120,7 +120,7 @@ switch ($date_mode) { } -$report = reporting_make_reporting_data($id_report, $date, $time, +$report = reporting_make_reporting_data(null, $id_report, $date, $time, $period, 'static'); //------- Removed the unused fields ------------------------------------ diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 0e0ec99cbf..72712cfec4 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 6.0dev -%define release 150629 +%define release 150630 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index b3480a0311..0cc5fc07d1 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 6.0dev -%define release 150629 +%define release 150630 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 4c403468bd..1d033923f9 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('graph_res','5'), ('step_compact','1'), ('db_scheme_version','6.0dev'), -('db_scheme_build','PD150629'), +('db_scheme_build','PD150630'), ('show_unknown','0'), ('show_lastalerts','1'), ('style','pandora'), diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index b1192ef159..739339e904 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 6.0dev-150629 +Version: 6.0dev-150630 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index b9478b451f..6c2e1a66cf 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150629" +pandora_version="6.0dev-150630" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 2f918341e6..13614ec5f5 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -43,7 +43,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "6.0dev"; -my $pandora_build = "150629"; +my $pandora_build = "150630"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 9880da1936..95278fa645 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 6.0dev -%define release 150629 +%define release 150630 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 9aaae392fc..bb5f09ad0e 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 6.0dev -%define release 150629 +%define release 150630 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 0223e1fb2b..ebe3ec682f 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -33,7 +33,7 @@ use PandoraFMS::Tools; use PandoraFMS::DB; # version: define current version -my $version = "6.0dev PS150629"; +my $version = "6.0dev PS150630"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 66e411a57e..ca1b0555b7 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -35,7 +35,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "6.0dev PS150629"; +my $version = "6.0dev PS150630"; # save program name for logging my $progname = basename($0);