Index: trunk/tools/debug_sample.php
===================================================================
diff -u -r859 -r874
--- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 859)
+++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 874)
@@ -19,12 +19,7 @@
define('SQL_OUTPUT', DOC_ROOT.'/inportal_sqls.txt'); // file where to store sql queries
define('SQL_OVERWRITE', 1); // overwrite or not sql_log file
- // various levels of debugging
- define('SHOW_REQUEST', 1);
- define('FRONT_SHOW_REQUEST', 2);
-
define('DEBUG_MODE', 1); // global debugging
- define('DEBUG_ACTIONS', SHOW_REQUEST + FRONT_SHOW_REQUEST);
//define('DEBUG_HELP', 1); // allow to add missing help
if( defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 )
Index: trunk/kernel/frontaction.php
===================================================================
diff -u -r858 -r874
--- trunk/kernel/frontaction.php (.../frontaction.php) (revision 858)
+++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 874)
@@ -1,34 +1,10 @@
appendHTML('Front Action: '.$Action.'');
- $script = basename($_SERVER['PATH_TRANSLATED']);
- $debugger->appendHTML('ScriptName: '.$script.' ('.dirname($_SERVER['PATH_TRANSLATED']).')');
- $requestTable = '
- Src | Name | Value | ';
-
- foreach($_REQUEST as $key => $value)
- {
- if( !is_array($value) && trim($value) == '' )
- {
- $value = 'no value';
- }
- else
- {
- $value = htmlspecialchars(print_r($value, true));
- }
- $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') );
- $requestTable .= ''.$src.' | '.$key.' | '.$value.' |
';
- }
- $requestTable .= '
';
- $debugger->appendHTML($requestTable);
- unset($script, $requestTable);
- echo 'Show Debugger
';
- }
+ if($Action) $debugger->setHTMLByIndex(1,'Front Action: '.$Action.'','append');
+ echo 'Show Debugger
';
}
// ====== Debugger related: end ======
Index: trunk/kernel/action.php
===================================================================
diff -u -r869 -r874
--- trunk/kernel/action.php (.../action.php) (revision 869)
+++ trunk/kernel/action.php (.../action.php) (revision 874)
@@ -7,36 +7,9 @@
$skipDebug = Array('index.php','tree.php','head.php','credits.php');
if( admin_login() && !in_array($script, $skipDebug) )
{
- if( defined('DEBUG_ACTIONS') )
- {
- if( (DEBUG_ACTIONS & SHOW_REQUEST) == SHOW_REQUEST )
- {
- if($Action) $debugger->appendHTML('Kernel Action: '.$Action.'');
- $debugger->appendHTML('ScriptName: '.$debugger->getFileLink($_SERVER['PATH_TRANSLATED'],1,$script).' ('.dirname($_SERVER['PHP_SELF']).')');
- $requestTable = '
- Src | Name | Value | ';
-
- foreach($_REQUEST as $key => $value)
- {
- if( !is_array($value) && trim($value) == '' )
- {
- $value = 'no value';
- }
- else
- {
- $value = htmlspecialchars(print_r($value, true));
- }
- $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') );
- $requestTable .= ''.$src.' | '.$key.' | '.$value.' |
';
- }
- $requestTable .= '
';
- $debugger->appendHTML($requestTable);
- unset($requestTable);
- }
- }
-
if( IsDebugMode() )
{
+ if($Action) $debugger->setHTMLByIndex(1,'Kernel Action: '.$Action.'','append');
echo 'Reload Frame || ';
echo 'Show Debugger
';
}
Index: trunk/kernel/include/debugger.php
===================================================================
diff -u -r872 -r874
--- trunk/kernel/include/debugger.php (.../debugger.php) (revision 872)
+++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 874)
@@ -13,6 +13,12 @@
var $ProfilerData = Array();
var $RecursionStack = Array(); // prevent recursion when processing debug_backtrace() function results
+ function Debugger()
+ {
+ $this->appendHTML('Hide Debugger');
+ $this->appendRequest();
+ }
+
function dumpVars()
{
$dumpVars = func_get_args();
@@ -165,6 +171,68 @@
$this->Data[] = Array('html' => $html,'debug_type' => 'html');
}
+ /**
+ * Change debugger info that was already generated before.
+ * Returns true if html was set.
+ *
+ * @param int $index
+ * @param string $html
+ * @param string $type = {'append','prepend','replace'}
+ * @return bool
+ */
+ function setHTMLByIndex($index,$html,$type='append')
+ {
+ if( !isset($this->Data[$index]) || $this->Data[$index]['debug_type'] != 'html' )
+ {
+ return false;
+ }
+
+ switch ($type)
+ {
+ case 'append':
+ $this->Data[$index]['html'] .= '
'.$html;
+ break;
+ case 'prepend':
+ $this->Data[$index]['html'] = $this->Data[$index]['html'].'
'.$html;
+ break;
+ case 'replace':
+ $this->Data[$index]['html'] = $html;
+ break;
+ }
+ return true;
+ }
+
+ function appendRequest()
+ {
+ $script = $_SERVER['PATH_TRANSLATED'];
+ $this->appendHTML('ScriptName: '.$this->getFileLink($script,1,basename($script)).' ('.dirname($script).')');
+ ob_start();
+ ?>
+
+
+ Src | Name | Value |
+
+ $value)
+ {
+ if( !is_array($value) && trim($value) == '' )
+ {
+ $value = 'no value';
+ }
+ else
+ {
+ $value = htmlspecialchars(print_r($value, true));
+ }
+ $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') );
+ echo ''.$src.' | '.$key.' | '.$value.' |
';
+ }
+ ?>
+
+ appendHTML( ob_get_contents() );
+ ob_end_clean();
+ }
+
function profileStart($key, $description)
{
$timeStamp = $this->getMoment();
@@ -228,9 +296,10 @@
* Generates report
*
*/
- function printReport()
+ function printReport($returnResult = false)
{
$i = 0; $lineCount = count($this->Data);
+ ob_start();
?>