From e9fb346ecd113ae68bcfe82acb42d22b249be63e Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 24 Nov 2020 18:10:39 +0100 Subject: [PATCH 1/3] Definition matching Entity --- pandora_console/include/lib/Entity.php | 4 ++-- pandora_console/include/lib/Module.php | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/lib/Entity.php b/pandora_console/include/lib/Entity.php index 85901db309..1bc1b219ac 100644 --- a/pandora_console/include/lib/Entity.php +++ b/pandora_console/include/lib/Entity.php @@ -61,12 +61,12 @@ abstract class Entity /** * Instances a new object using array definition. * - * @param string $class_str Class name. * @param array $data Fields data. + * @param string $class_str Class name. * * @return object With current definition. */ - public static function build(string $class_str, array $data=[]) + public static function build(array $data=[], string $class_str=__CLASS__) { $obj = new $class_str(); // Set values. diff --git a/pandora_console/include/lib/Module.php b/pandora_console/include/lib/Module.php index 000d71b0c2..203b6001f1 100644 --- a/pandora_console/include/lib/Module.php +++ b/pandora_console/include/lib/Module.php @@ -136,13 +136,16 @@ class Module extends Entity /** * Creates a module object from given data. Avoid query duplication. * - * @param array $data Module information. + * @param array $data Module information. + * @param string $class_str Class type. * * @return PandoraFMS\Module Object. */ - public static function build(array $data=[]) - { - $obj = new Module(); + public static function build( + array $data=[], + string $class_str='\PandoraFMS\Module' + ) { + $obj = new $class_str(); // Set values. foreach ($data as $k => $v) { From a419c2ec468fce7f18da1c296468ebf08b370474 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 25 Nov 2020 20:16:30 +0100 Subject: [PATCH 2/3] Minor fix avoid notice --- pandora_console/include/functions_ui.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 2506b3e051..8710a77d31 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4087,13 +4087,17 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true) function ui_forced_public_url() { global $config; - $exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions'])); + + $exclusions = []; + if (empty($config['public_url_exclusions']) === false) { + $exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions'])); + } if (in_array($_SERVER['REMOTE_ADDR'], $exclusions)) { return false; } - return (bool) $config['force_public_url']; + return isset($config['force_public_url']) && (bool) $config['force_public_url']; } From 41daa24c3937e4158fa4dccac0b834f38450f298 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 26 Nov 2020 17:01:47 +0100 Subject: [PATCH 3/3] interval selector auto-with --- pandora_console/include/functions_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bda3a759e0..76dbba17b1 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1734,7 +1734,7 @@ function html_print_extended_select_for_time( ob_start(); // Use the no_meta parameter because this image is only in the base console. - echo '
'; + echo '
'; html_print_select( $fields, $uniq_name.'_select',