From aa76993a4b6c372bd8bcf0f1061f16b2efaeb35e Mon Sep 17 00:00:00 2001 From: slerena Date: Mon, 13 Oct 2008 17:13:34 +0000 Subject: [PATCH] 2008-10-13 Sancho Lerena * agent_disk_conf_editor.php: Now load enterprise code using a normalized code. * setup.php: Removed some features of enterprise on setup. * functions.php: Added enterprise load code and load hook functions. * datos_agente.php: Fixed stupid problem with string data deletion. * custom_reporting.php: Now load enterprise code using a normalized code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1147 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 ++++++++++++++ .../godmode/agentes/agent_disk_conf_editor.php | 12 +++++++----- pandora_console/godmode/setup/setup.php | 8 ++++++-- pandora_console/include/functions.php | 16 ++++++++++++++++ .../operation/agentes/datos_agente.php | 4 ++-- .../operation/reporting/custom_reporting.php | 11 +++++++++++ 6 files changed, 56 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index bc32ba98a0..9b2098b878 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,4 +1,18 @@ 2008-10-13 Sancho Lerena + + * agent_disk_conf_editor.php: Now load enterprise code + using a normalized code. + + * setup.php: Removed some features of enterprise on setup. + + * functions.php: Added enterprise load code and load hook + functions. + + * datos_agente.php: Fixed stupid problem with string data + deletion. + + * custom_reporting.php: Now load enterprise code + using a normalized code. * include/help/en/help_tcp_send.php: Added mising help file. diff --git a/pandora_console/godmode/agentes/agent_disk_conf_editor.php b/pandora_console/godmode/agentes/agent_disk_conf_editor.php index 2b5d486ad1..0d0a84fba9 100644 --- a/pandora_console/godmode/agentes/agent_disk_conf_editor.php +++ b/pandora_console/godmode/agentes/agent_disk_conf_editor.php @@ -1,10 +1,12 @@ This feature is not included on OpenSource version. Please visit our website to learn more about the advanced features of Pandora FMS Enterprise edition"; +if (enterprise_include ("godmode/agentes/agent_disk_conf_editor.php")) + return; - // Footer - echo ""; +echo "

This feature is not included on OpenSource version. Please visit our website to learn more about the advanced features of Pandora FMS Enterprise edition

"; +// Footer +echo ""; ?> diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 46c7235333..46c90ef07f 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -27,6 +27,11 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] exit; } +// Load enterprise extensions +if (file_exists( $config["homedir"] . "/enterprise/godmode/setup/setup.php")) { + include $config["homedir"] . "/enterprise/godmode/setup/setup.php"; +} + $update_settings = (bool) get_parameter ('update_settings'); if ($update_settings) { @@ -121,8 +126,7 @@ $table->data[13][1] = print_select ($file_styles, 'style', $config["style"], '', $table->data[14][0] = __('Block size for pagination'); $table->data[14][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); -$table->data[15][0] = __('Forward SNMP traps to agent (if exist)'); -$table->data[15][1] = print_checkbox ('trap2agent', 1, $config["trap2agent"], true); +enterprise_hook ('load_snmpforward_enterprise'); $table->data[16][0] = __('Automatic update check'); $table->data[16][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 14b1fe2eb4..c99cd1f671 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1199,4 +1199,20 @@ function safe_sql_string ($string) { return $string; } +function enterprise_hook ($function_name) { + if (function_exists ($function_name)) + call_user_func ($function_name); +} + +function enterprise_include ($filename) { + global $config; + // Load enterprise extensions + $fullfilename = $config["homedir"]."/enterprise/" . $filename; + if (file_exists ($fullfilename)) { + include ($fullfilename); + return true; + } + return false; +} + ?> diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index ed071f967b..9feed9496b 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -93,7 +93,7 @@ function datos_raw ($id_agente_modulo, $periodo) { if ($string_type == 0) echo ""; else - echo ""; + echo ""; } else { echo ""; } @@ -132,7 +132,7 @@ if (isset($_GET["delete"])) { if (isset($_GET["delete_text"])) { $delete = $_GET["delete_text"]; - $sql = "DELETE FROM tagente_datos_string WHERE id_agente_datos = $delete"; + $sql = "DELETE FROM tagente_datos_string WHERE id_tagente_datos_string = $delete"; $result = process_sql ($sql); } diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php index 47aa9c08ac..d934e999d9 100644 --- a/pandora_console/operation/reporting/custom_reporting.php +++ b/pandora_console/operation/reporting/custom_reporting.php @@ -22,6 +22,12 @@ require ("include/config.php"); check_login (); +// Load enterprise extensions +if (file_exists( $config["homedir"] . "/enterprise/operation/reporting/custom_reporting.php")) { + include $config["homedir"] . "/enterprise/operation/reporting/custom_reporting.php"; +} + + echo "

".__('Reporting')." > "; echo __('Custom reporting')."

"; @@ -38,6 +44,9 @@ $table->head[0] = __('Report name'); $table->head[1] = __('Description'); $table->head[2] = __('HTML'); $table->head[3] = __('XML'); + +enterprise_hook ('load_custom_reporting_1'); + $table->align = array (); $table->align[2] = 'center'; $table->align[3] = 'center'; @@ -51,6 +60,8 @@ foreach ($reports as $report) { $data[2] = '
'; $data[3] = ''; //I chose ajax.php because it's supposed to give XML anyway + + enterprise_hook ('load_custom_reporting_2'); array_push ($table->data, $data); }