diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index 470cdd471e..33873fc0d8 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -295,19 +295,8 @@ if ($get_module_detail) {
elseif (($config['command_snapshot'] == '0') && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
// Its a single-data, multiline data (data snapshot) ?
- // Detect string data with \n and convert to
's
- $datos = $row[$attr[0]];
-
- $datos = preg_replace ('/', '<', $datos);
- $datos = preg_replace ('/>/', '>', $datos);
- $datos = preg_replace ('/\n/i','
',$datos);
- $datos = preg_replace ('/\s/i',' ',$datos);
- $datos_format = "
";
- $datos_format .= $datos;
- $datos_format .= "
";
-
// I dont why, but using index (value) method, data is automatically converted to html entities ¿?
- $data[] = $datos_format;
+ $data[] = html_print_result_div($row[$attr[0]]);
}
elseif ($is_web_content_string) {
//Fixed the goliat sends the strings from web
@@ -315,11 +304,9 @@ if ($get_module_detail) {
$data[] = io_safe_input($row[$attr[0]]);
}
else {
- // Just a string of alphanumerical data... just do print
//Fixed the data from Selenium Plugin
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
-
- $data[] = io_safe_input($row[$attr[0]]);
+ $data[] = html_print_result_div(io_safe_input($row[$attr[0]]));
}
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
switch($row['module_type']) {
@@ -334,7 +321,6 @@ if ($get_module_detail) {
}else{
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
}
-
break;
default:
$data_macro = modules_get_unit_macro($row[$attr[0]],$unit);
@@ -355,15 +341,7 @@ if ($get_module_detail) {
if($data_macro){
$data[] = $data_macro;
} else {
- $datos = $row[$attr[0]];
- $datos = preg_replace ('/', '<', $datos);
- $datos = preg_replace ('/>/', '>', $datos);
- $datos = preg_replace ('/\n/i','
',$datos);
- $datos = preg_replace ('/\s/i',' ',$datos);
- $datos_format = "";
- $datos_format .= $datos;
- $datos_format .= "
";
- $data[] = $datos_format;
+ $data[] = html_print_result_div($row[$attr[0]]);
}
}
}
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 2352e7c547..af43ecf3e4 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -2458,4 +2458,23 @@ function html_print_timezone_select ($name, $selected = "") {
return html_print_select($timezones, $name, $selected, "", __("None"), "", true, false, false);
}
+/**
+ * Enclose a text into a result_div
+ *
+ * @param string Text to enclose
+ *
+ * @return string Text inside the result_div
+ */
+function html_print_result_div ($text) {
+ $text = preg_replace ('/', '<', $text);
+ $text = preg_replace ('/>/', '>', $text);
+ $text = preg_replace ('/\n/i','
',$text);
+ $text = preg_replace ('/\s/i',' ',$text);
+
+ $enclose = "";
+ $enclose .= $text;
+ $enclose .= "
";
+ return $enclose;
+}
+
?>