Changeset:
31d5a3052491
https://sourceforge.net/p/mrbs/hg-code/ci/31d5a30524912075d41d223a818e575f8a4ada45
Author:
John Beranek <[email protected]>
Date:
Tue Oct 04 18:56:47 2016 +0100
Log message:
Merged
diffstat:
web/functions_error.inc | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r c43758b6c49f -r 31d5a3052491 web/functions_error.inc
--- a/web/functions_error.inc Tue Oct 04 18:55:40 2016 +0100
+++ b/web/functions_error.inc Tue Oct 04 18:56:47 2016 +0100
@@ -14,6 +14,21 @@
}
+// Replace leading spaces in $string with non-breaking spaces
+function replace_leading_spaces($string)
+{
+ return preg_replace('/\G /', ' ', $string);
+}
+
+
+function to_html($string)
+{
+ $lines = explode("\n", $string);
+ $lines = array_map(__NAMESPACE__ . "\\replace_leading_spaces", $lines);
+ return implode("<br>\n", $lines);
+}
+
+
function output_error($heading, $body, $show_data=false)
{
if ($show_data)
@@ -25,8 +40,8 @@
if (ini_get('display_errors'))
{
- echo nl2br("<b>$heading</b>");
- echo nl2br($body);
+ echo "<b>" . to_html($heading) . "</b>\n";
+ echo to_html($body);
}
if (ini_get('log_errors'))
{
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits