Add debugging facility
authorJoey Schulze <joey@infodrom.org>
Wed, 24 Feb 2010 14:30:07 +0000 (15:30 +0100)
committerJoey Schulze <joey@infodrom.org>
Wed, 24 Feb 2010 14:30:07 +0000 (15:30 +0100)
index.php
lib/general.php

index 3ea5e3d..4dbfdb6 100644 (file)
--- a/index.php
+++ b/index.php
@@ -6,6 +6,8 @@ $jsfiles = array('lib/json_parse.js');
 $jscode = '';
 $html = process();
 
+$debug = debug_info();
+
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="de">
@@ -33,5 +35,6 @@ $html = process();
 <?=$html; ?>
 </div>
 
+<?=$debug; ?>
 </body>
 </html>
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;
 }