diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index e3afbb8ded..a57d062ec6 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -3621,16 +3621,21 @@ function html_print_timezone_select($name, $selected='') * Enclose a text into a result_div * * @param string Text to enclose + * @param boolean Return formatted text without html tags. * * @return string Text inside the result_div */ -function html_print_result_div($text) +function html_print_result_div($text, $text_only) { $text = preg_replace('//', '>', $text); $text = preg_replace('/\n/i', '
', $text); $text = preg_replace('/\s/i', ' ', $text); + if ($text_only) { + return $text; + } + $enclose = "
"; $enclose .= $text; $enclose .= '
'; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index f1bea0a736..65724000f2 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3357,7 +3357,7 @@ function reporting_database_serialized($report, $content) ); // Adds string data if there is no numeric data. - if ((count($result) < 0) || (!$result)) { + if ($result === false) { // This query gets information from the default and the historic database. $result = db_get_all_rows_sql( 'SELECT * diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 493fcc5b68..2ef9586f12 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2159,10 +2159,19 @@ function reporting_html_historical_data($table, $item, $pdf=0) ]; } } else { - $row = [ - $data[__('Date')], - $data[__('Data')], - ]; + // Command line snapshot. + if (is_text_to_black_string($data[__('Data')])) { + $table1->style[1] = 'text-align: left; font-family: monospace, mono'; + $row = [ + $data[__('Date')], + '
'.$data[__('Data')].'
', + ]; + } else { + $row = [ + $data[__('Date')], + $data[__('Data')], + ]; + } } } else { $row = [ @@ -2181,15 +2190,16 @@ function reporting_html_historical_data($table, $item, $pdf=0) $table1, true ); + + return html_print_table($table, true); } else { $table1->title = $item['title']; $table1->titleclass = 'title_table_pdf'; $table1->titlestyle = 'text-align:left;'; - return html_print_table( - $table1, - true - ); + + return html_print_table($table1, true); } + } @@ -2234,6 +2244,11 @@ function reporting_html_database_serialized($table, $item, $pdf=0) } else { $data_unserialized[$key] = wordwrap(io_safe_input($data_value), 60, "
\n", true); } + } else if (is_text_to_black_string($data_unserialized[$key])) { + $table1->style[1] = 'white-space: pre-wrap;'; + $table1->style[1] .= 'font-family: monospace, mono; '; + $table1->style[1] .= 'text-align: left'; + $data_unserialized[$key] = '
'.$data_value.'
'; } }