diff --git a/include/functions_debug.inc b/include/functions_debug.inc index 489ed9717d0458ab67c7a75b67101e644d57c0f1..b6e335479e43df8832f965a4786a4c9c8d6f78d4 100644 --- a/include/functions_debug.inc +++ b/include/functions_debug.inc @@ -17,16 +17,6 @@ * if mode is defined the function returns the output instead of * printing it to the browser * -* show_vars([int mode]) -* use this function on the bottom of your script to see all -* superglobals and global variables in your script in a nice -* formated way -* -* show_vars() without parameter shows $_GET, $_POST, $_SESSION, -* $_FILES and all global variables you've defined in your script -* -* show_vars(1) shows $_SERVER and $_ENV in addition -* * Happy debugging and feel free to email me your comments. * * History: (starting with version 0.5.3 at 2003-02-24) @@ -36,15 +26,6 @@ * - pre() function now trims trailing tabs ----------------------------------------------------------------------*/ - -// This file must be the first include on your page. - -/* used for tracking of generation-time */ -{ - $MICROTIME_START = microtime(); - @$GLOBALS_initial_count = count($GLOBALS); -} - /*! * \file functions_debug.inc * Source code for print_a class @@ -251,94 +232,3 @@ function print_a ($array, $return_mode = FALSE, $show_object_vars = FALSE, $expo return TRUE; } } - -function _script_globals () -{ - global $GLOBALS_initial_count; - - $varcount = 0; - - foreach ($GLOBALS as $GLOBALS_current_key => $GLOBALS_current_value) { - if ((++$varcount > $GLOBALS_initial_count) - && ($GLOBALS_current_key != 'HTTP_SESSION_VARS') - && ($GLOBALS_current_key != '_SESSION')) { - $script_GLOBALS[$GLOBALS_current_key] = $GLOBALS_current_value; - } - } - - unset($script_GLOBALS['GLOBALS_initial_count']); - return $script_GLOBALS; -} - -/*! - * \brief Show the runtime - */ -function show_runtime () -{ - $MICROTIME_END = microtime(); - $MICROTIME_START = explode(' ', $GLOBALS['MICROTIME_START']); - $MICROTIME_END = explode(' ', $MICROTIME_END); - $GENERATIONSEC = $MICROTIME_END[1] - $MICROTIME_START[1]; - $GENERATIONMSEC = $MICROTIME_END[0] - $MICROTIME_START[0]; - $GENERATIONTIME = substr($GENERATIONSEC + $GENERATIONMSEC, 0, 8); - - return '<span style="color:red;font-weight:normal;font-size:9px;">(runtime: '.$GENERATIONTIME.' sec)</span>'; -} - - -/*! - * \brief function shows all superglobals and script defined global variables - * show_vars() without the first parameter shows all superglobals except $_ENV and $_SERVER - * show_vars(1) shows all - * show_vars(,1) shows object properties in addition - */ -function show_vars ($show_all_vars = FALSE, $show_object_vars = FALSE) -{ - if (isset($GLOBALS['no_vars'])) { - return; - } - - $script_globals = _script_globals(); - print ' - <style type="text/css"> - .vars-container { - font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif; - font-size: 8pt; - padding:5px; - } - .varsname { - font-weight:bold; - } - </style> - '; - - print '<br /> - <div style="border-style:dotted;border-width:1px;padding:2px;font-family:Verdana;font-size:10pt;font-weight:bold;"> - DEBUG '.show_runtime().' - '; - - $vars_arr['script_globals'] = ['global script variables', '#7ACCC8']; - - $vars_arr['_GET'] = ['$_GET', '#7DA7D9']; - $vars_arr['_POST'] = ['$_POST', '#F49AC1']; - $vars_arr['_FILES'] = ['$_POST FILES', '#82CA9C']; - $vars_arr['_SESSION'] = ['$_SESSION', '#FCDB26']; - $vars_arr['_COOKIE'] = ['$_COOKIE', '#A67C52']; - - if ($show_all_vars) { - $vars_arr['_SERVER'] = ['SERVER', '#A186BE']; - $vars_arr['_ENV'] = ['ENV', '#7ACCC8']; - } - - foreach ($vars_arr as $vars_name => $vars_data) { - if ($vars_name != 'script_globals') { - global $$vars_name; - } - if ($$vars_name) { - print '<div class="vars-container" style="background-color:'.$vars_data[1].';"><span class="varsname">'.$vars_data[0].'</span><br />'; - print_a($$vars_name, FALSE, $show_object_vars, FALSE); - print '</div>'; - } - } - print '</div>'; -}