Index: trunk/themes/default/incs/inportal_main.css =================================================================== diff -u -N -r817 -r842 --- trunk/themes/default/incs/inportal_main.css (.../inportal_main.css) (revision 817) +++ trunk/themes/default/incs/inportal_main.css (.../inportal_main.css) (revision 842) @@ -795,56 +795,3 @@ .tab_spacer { border-bottom: 1px solid #1C97F1; } - - -/* debug output styles */ - -.flat_table TD { - border: 1px solid buttonface; - border-width: 1 1 0 0; - -} - -.debug_layer_table { - border: 1px solid red; - border-width: 0 0 1 1; -} - -.debug_text, .debug_row_even TD, .debug_row_odd TD { - color: #000000; - font-family: Verdana; - font-size: 11px; -} - -.debug_cell { - border: 1px solid red; - border-width: 1 1 0 0; -} - -.debug_row_even { - background-color: #CCCCFF; -} - -.debug_row_odd { - background-color: #FFFFCC; -} - -.debug_layer_container { - left: 2px; - top: 1px; - width: 500px; - z-index: +10; - position: absolute; - overflow: auto; - border: 2px solid; - padding: 3px; - border-top-color: threedlightshadow; - border-left-color: threedlightshadow; - border-right-color: threeddarkshadow; - border-bottom-color: threeddarkshadow; - background-color: buttonface; -} - -.debug_error { - color: #FF0000; -} \ No newline at end of file Index: trunk/kernel/include/usersession.php =================================================================== diff -u -N -r663 -r842 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 663) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 842) @@ -1041,7 +1041,6 @@ function SessionEnabled() { - //trace(); $res = FALSE; $key = $this->GetSessionKey(); if(strlen($key)>0) Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -N -r787 -r842 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 787) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 842) @@ -980,7 +980,6 @@ { global $Errors; //echo "Method QItem [".get_class($this).'], sql: ['.$sql.']
'; - //if( get_class($this) == 'clsthemefilelist') trace(); $dummy =& $this->GetDummy(); if( !$dummy->TableExists() ) { Index: trunk/index.php =================================================================== diff -u -N -r720 -r842 --- trunk/index.php (.../index.php) (revision 720) +++ trunk/index.php (.../index.php) (revision 842) @@ -1,15 +1,8 @@ '); - ini_set('error_append_string',''); -} -else - error_reporting(0); - list($usec, $sec) = explode(" ",microtime()); $timestart = (float)$usec + (float)$sec; Index: trunk/tools/debug_sample.php =================================================================== diff -u -N -r836 -r842 --- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 836) +++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 842) @@ -2,12 +2,12 @@ // uncomment next line to enable sql logging define('ADODB_OUTP', 'SQLLog'); - // sql logging to screen + define('DOC_ROOT', $_SERVER['DOCUMENT_ROOT']); define('WINDOWS_ROOT', 'w:'); define('WINDOWS_EDITOR', 'c:\Program Files\Zend\ZendStudio-4.0Beta\bin\ZDE.exe %F'); // %F - filename, %L - line number + define('DEBUG_CSS', 'http://'.$_SERVER['HTTP_HOST'].'/in-portal/admin/include/debug_styles.css'); - //define('SQL_TO_SCREEN', 1); // output sql queries to screen // sql logging to file @@ -17,38 +17,25 @@ define('SQL_OVERWRITE', 1); // overwrite or not sql_log file // various levels of debugging + define('SHOW_REQUEST', 1); + define('FRONT_SHOW_REQUEST', 2); - // Admin: - define('KERNEL_ACTIONS', 1); // only kernel - define('MODULE_ACTIONS', 2); // only modules - define('SEARCH_ACTIONS', 4); // kernel & modules - define('SHOW_REQUEST', 8); // show formatted $_REQUEST array passed to script (GE - $_GET, PO - $_POST, CO - $_COOKIE) - - // Front: - define('FRONT_KERNEL_ACTIONS', 16); - define('FRONT_SHOW_REQUEST', 32); - define('DEBUG_MODE', 1); // global debugging - define('DEBUG_ACTIONS', KERNEL_ACTIONS + SHOW_REQUEST + FRONT_KERNEL_ACTIONS + FRONT_SHOW_REQUEST); + define('DEBUG_ACTIONS', SHOW_REQUEST + FRONT_SHOW_REQUEST); //define('DEBUG_HELP', 1); // allow to add missing help - + // For local license testing - define('GET_LICENSE_URL', 'http://maris.prod.intechnic.lv/in-business/license.php'); + //define('GET_LICENSE_URL', 'http://maris.prod.intechnic.lv/in-business/license.php'); if( defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 ) { - error_reporting(E_ALL); ini_set('display_errors', 1); } - ini_set('max_execution_time', '30'); - //ini_set('memory_limit', 512000000); + function SQLLog($msg, $newline = true) { static $file_reset = false; - //$LocationMessage = 'Called from file ['.basename($_SERVER['PHP_SELF']).']'; - //if($msg != $LocationMessage) SQLLog($LocationMessage); - $db =& GetADODBConnection(); // telestial specific: begin static $prefix = ''; @@ -93,10 +80,11 @@ */ function trace() { - $trace_results = debug_backtrace(); + die('Error: Depricated call. Use $debugger->appendTrace(); instead'); + /*$trace_results = debug_backtrace(); array_shift($trace_results); echo 'Called from ['.$trace_results[0]['function'].']
'; - print_pre($trace_results); + print_pre($trace_results);*/ } function DebugByFile() Index: trunk/admin/include/style.css =================================================================== diff -u -N -r817 -r842 --- trunk/admin/include/style.css (.../style.css) (revision 817) +++ trunk/admin/include/style.css (.../style.css) (revision 842) @@ -439,57 +439,4 @@ { padding: 5px 10px 5px 10px; -} - -/* debug output styles */ - - -.flat_table TD { - border: 1px solid buttonface; - border-width: 1 1 0 0; - -} - -.debug_layer_table { - border: 1px solid red; - border-width: 0 0 1 1; -} - -.debug_text, .debug_row_even TD, .debug_row_odd TD { - color: #000000; - font-family: Verdana; - font-size: 11px; -} - -.debug_cell { - border: 1px solid red; - border-width: 1 1 0 0; -} - -.debug_row_even { - background-color: #CCCCFF; -} - -.debug_row_odd { - background-color: #FFFFCC; -} - -.debug_layer_container { - left: 2px; - top: 1px; - width: 500px; - z-index: +10; - position: absolute; - overflow: auto; - border: 2px solid; - padding: 3px; - border-top-color: threedlightshadow; - border-left-color: threedlightshadow; - border-right-color: threeddarkshadow; - border-bottom-color: threeddarkshadow; - background-color: buttonface; -} - -.debug_error { - color: #FF0000; } \ No newline at end of file Index: trunk/kernel/include/adodb/adodb.inc.php =================================================================== diff -u -N -r662 -r842 --- trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 662) +++ trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 842) @@ -702,7 +702,7 @@ } // debug version of query if ($this->debug) { - global $HTTP_SERVER_VARS; + global $HTTP_SERVER_VARS, $debugger; $ss = ''; if ($inputarr) { @@ -744,16 +744,13 @@ $e = $this->ErrorNo(); $m = $this->ErrorMsg(); -if(defined('SQL_ERROR_DIE')&&SQL_ERROR_DIE) -{ - echo '
'.$sql.'
Error #'.$e.': '.$m.'

'; - echo 'Request
'; - print_r($_REQUEST); - echo 'Back Trace
'; - print_r(debug_backtrace()); - echo '
'; - exit; -} + if(defined('SQL_ERROR_DIE')&&SQL_ERROR_DIE) + { + $debugger->dumpVars($_REQUEST); + $debugger->appendTrace(); + trigger_error(''.$m.' ('.$e.')
SQL: '.$sql, E_USER_ERROR); + } + ADOConnection::outp($e .': '. $m ); flush(); } Index: trunk/kernel/frontaction.php =================================================================== diff -u -N -r836 -r842 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 836) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 842) @@ -1,36 +1,36 @@ appendHTML('Front Action: '.$Action.''); -} - -if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & FRONT_SHOW_REQUEST) == FRONT_SHOW_REQUEST ) -{ - // don't show debug output in tree & header of admin & while logging in - $script = basename($_SERVER['PHP_SELF']); - $debugger->appendHTML('ScriptName: '.$script.' ('.dirname($_SERVER['PHP_SELF']).')'); - $requestTable = ' - '; - - foreach($_REQUEST as $key => $value) + if( (DEBUG_ACTIONS & FRONT_SHOW_REQUEST) == FRONT_SHOW_REQUEST ) { - if( !is_array($value) && trim($value) == '' ) + if($Action) $debugger->appendHTML('Front Action: '.$Action.''); + $script = basename($_SERVER['PATH_TRANSLATED']); + $debugger->appendHTML('ScriptName: '.$script.' ('.dirname($_SERVER['PATH_TRANSLATED']).')'); + $requestTable = '
SrcNameValue
+ '; + + foreach($_REQUEST as $key => $value) { - $value = 'no 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 .= ''; } - else - { - $value = htmlspecialchars(print_r($value, true)); - } - $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') ); - $requestTable .= ''; + $requestTable .= '
SrcNameValue
'.$src.''.$key.''.$value.'
'.$src.''.$key.''.$value.'
'; + $debugger->appendHTML($requestTable); + unset($script, $requestTable); + echo 'Show Debugger
'; } - $requestTable .= ''; - $debugger->appendHTML($requestTable); - unset($script, $requestTable); -// echo "SID: ".$objSession->GetSessionKey().'
'; } +// ====== Debugger related: end ====== switch($Action) { Index: trunk/kernel/action.php =================================================================== diff -u -N -r837 -r842 --- trunk/kernel/action.php (.../action.php) (revision 837) +++ trunk/kernel/action.php (.../action.php) (revision 842) @@ -2,42 +2,47 @@ $ro_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY"); -$AdminLogin = admin_login(); -if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & KERNEL_ACTIONS) == KERNEL_ACTIONS && $AdminLogin ) +// ====== Debugger related: begin ====== +$script = basename($_SERVER['PATH_TRANSLATED']); +$skipDebug = Array('index.php','tree.php','head.php','credits.php'); +if( admin_login() && !in_array($script, $skipDebug) ) { - if($Action) $debugger->appendHTML('Kernel Action: '.$Action.''); -} - -if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & SHOW_REQUEST) == SHOW_REQUEST && $AdminLogin ) -{ - // don't show debug output in tree & header of admin & while logging in - $script = basename($_SERVER['PATH_TRANSLATED']); - $skip_debug = Array('index.php','tree.php','head.php','credits.php'); - if( !in_array($script, $skip_debug) ) + if( defined('DEBUG_ACTIONS') ) { - $debugger->appendHTML('ScriptName: '.$debugger->getFileLink($_SERVER['PATH_TRANSLATED'],1,$script).' ('.dirname($_SERVER['PHP_SELF']).')'); - $requestTable = ' - '; - - foreach($_REQUEST as $key => $value) + if( (DEBUG_ACTIONS & SHOW_REQUEST) == SHOW_REQUEST ) { - if( !is_array($value) && trim($value) == '' ) + if($Action) $debugger->appendHTML('Kernel Action: '.$Action.''); + $debugger->appendHTML('ScriptName: '.$debugger->getFileLink($_SERVER['PATH_TRANSLATED'],1,$script).' ('.dirname($_SERVER['PHP_SELF']).')'); + $requestTable = '
SrcNameValue
+ '; + + foreach($_REQUEST as $key => $value) { - $value = 'no 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 .= ''; } - else - { - $value = htmlspecialchars(print_r($value, true)); - } - $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') ); - $requestTable .= ''; + $requestTable .= '
SrcNameValue
'.$src.''.$key.''.$value.'
'.$src.''.$key.''.$value.'
'; + $debugger->appendHTML($requestTable); + unset($requestTable); } - $requestTable .= ''; - $debugger->appendHTML($requestTable); - echo 'Reload Frame
'; } - unset($script, $skip_debug, $requestTable); + + if( IsDebugMode() ) + { + echo 'Reload Frame || '; + echo 'Show Debugger
'; + } } +unset($script, $skipDebug); +// ====== Debugger related: end ====== switch($Action) { Index: trunk/admin/include/debug_styles.css =================================================================== diff -u -N --- trunk/admin/include/debug_styles.css (revision 0) +++ trunk/admin/include/debug_styles.css (revision 842) @@ -0,0 +1,49 @@ +.flat_table TD { + border: 1px solid buttonface; + border-width: 1 1 0 0; + +} + +.debug_layer_table { + border: 1px solid red; + border-width: 0 0 1 1; +} + +.debug_text, .debug_row_even TD, .debug_row_odd TD { + color: #000000; + font-family: Verdana; + font-size: 11px; +} + +.debug_cell { + border: 1px solid red; + border-width: 1 1 0 0; +} + +.debug_row_even { + background-color: #CCCCFF; +} + +.debug_row_odd { + background-color: #FFFFCC; +} + +.debug_layer_container { + left: 2px; + top: 1px; + width: 500px; + z-index: +10; + position: absolute; + overflow: auto; + border: 2px solid; + padding: 3px; + border-top-color: threedlightshadow; + border-left-color: threedlightshadow; + border-right-color: threeddarkshadow; + border-bottom-color: threeddarkshadow; + background-color: buttonface; +} + +.debug_error { + color: #FF0000; +} \ No newline at end of file Index: trunk/kernel/include/debugger.php =================================================================== diff -u -N -r837 -r842 --- trunk/kernel/include/debugger.php (.../debugger.php) (revision 837) +++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 842) @@ -8,8 +8,8 @@ * @var Array */ var $Data = Array(); + var $ProfilerData = Array(); - function dumpVars() { $dumpVars = func_get_args(); @@ -36,7 +36,7 @@ case 'var_dump': $ret = highlight_string('', true); $ret = preg_replace('/<\?php (.*)\?>/s','$1',$ret); - return $ret; + return addslashes($ret); break; case 'trace': @@ -65,7 +65,13 @@ $ret = preg_replace('/<\?php (.*)\?>/s','$1',$ret);*/ return $ret; break; - + + case 'profiler': + $profileKey = $Data['profile_key']; + $Data =& $this->ProfilerData[$profileKey]; + return 'Name: '.$Data['description'].'. Runtime: '.($Data['ends'] - $Data['begins']); + break; + default: return 'incorrect debug data'; break; @@ -95,6 +101,17 @@ $this->Data[] = Array('html' => $html,'debug_type' => 'html'); } + function profileStart($key, $description) + { + $this->ProfilerData[$key] = Array('begins' => time(), 'debuggerRowID' => count($this->Data), 'description' => $description); + $this->Data[] = array('profile_key' => $key, 'debug_type' => 'profiler'); + } + + function profileFinish($key) + { + $this->ProfilerData[$key]['ends'] = time(); + } + function getErrorNameByCode($errorCode) { switch($errorCode) @@ -127,6 +144,7 @@ { $i = 0; $lineCount = count($this->Data); ?> +