Ent 5850 error reports historical serialize command snapshots

This commit is contained in:
Luis 2020-06-25 15:17:24 +02:00 committed by Daniel Rodriguez
parent ae0ac8dc8c
commit 5bc968aefe
3 changed files with 30 additions and 10 deletions

View File

@ -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('/</', '&lt;', $text);
$text = preg_replace('/>/', '&gt;', $text);
$text = preg_replace('/\n/i', '<br>', $text);
$text = preg_replace('/\s/i', '&nbsp;', $text);
if ($text_only) {
return $text;
}
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$enclose .= $text;
$enclose .= '</div>';

View File

@ -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 *

View File

@ -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')],
'<pre>'.$data[__('Data')].'</pre>',
];
} 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, "<br>\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] = '<pre>'.$data_value.'</pre>';
}
}