Add debugging facility
[misc/kostenrechnung] / lib / general.php
index 279b701..215eee4 100644 (file)
@@ -55,11 +55,26 @@ function process()
   return $ret;
 }
 
+function debug_log($text)
+{
+  global $debug_info;
+
+  $debug_info .= '<br>' . $text;
+}
+
 function debug_info()
 {
+  global $jsfiles;
+  global $debug_info;
+
+  if (DEBUG !== true) return '';
+
+  $jsfiles[] = 'lib/debug_joey.js';
+
   $html = '<div style="background: #DDD; margin: 5px; padding-left: 4px; border: 1px solid #AAA;clear:both;">';
   $html .= "\n<pre>\n\$_SESSION = " . var_export($_SESSION,true) . "\n";
   $html .= "\n\$_COOKIE = " . var_export($_COOKIE,true) . "\n</pre>\n";
+  $html .= $debug_info;
   $html .= '</div>';
   return $html;
 }