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 = '
- Src | Name | Value | ';
-
- 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 = '
+ Src | Name | Value | ';
+
+ 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 .= ''.$src.' | '.$key.' | '.$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
';
}
- $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 = '
- Src | Name | Value | ';
-
- 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 = '
+ Src | Name | Value | ';
+
+ 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 .= ''.$src.' | '.$key.' | '.$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);
}
- $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);
?>
+
@@ -153,19 +171,25 @@
{
if(!$e) $e = window.event;
var $KeyCode = getEventKeyCode($e);
- if( $KeyCode == 113 && $e.ctrlKey || $KeyCode == 123 ) // F12 (for Maxthon) or Ctrl+F2 (for Other Browsers)
+ //alert(showProps($e));
+ if($KeyCode == 123 || $KeyCode == 68 && $e.shiftKey) // F12 (for Maxthon) or Ctrl+F2 (for Other Browsers)
{
- var $DebugLayer = document.getElementById('debug_layer');
- if( typeof($DebugLayer) != 'undefined' )
- {
- resizeDebugLayer($e);
- $DebugLayer.style.display = ($DebugLayer.style.display == 'none') ? 'block' : 'none';
- }
+ toggleDebugLayer();
$e.cancelBubble = true;
if($e.stopPropagation) $e.stopPropagation();
}
}
+ function toggleDebugLayer()
+ {
+ var $DebugLayer = document.getElementById('debug_layer');
+ if( typeof($DebugLayer) != 'undefined' )
+ {
+ resizeDebugLayer(null);
+ $DebugLayer.style.display = ($DebugLayer.style.display == 'none') ? 'block' : 'none';
+ }
+ }
+
function prepareSizes($Prefix)
{
var $ret = '';
@@ -191,6 +215,39 @@
return true;
}
+ function SetClipboard($data)
+ {
+ if (window.clipboardData)
+ {
+ window.clipboardData.setData('Text', $data);
+ }
+ else if (window.netscape)
+ {
+ //netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
+ if (!clip) return;
+
+ var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
+ if (!trans) return;
+
+ trans.addDataFlavor('text/unicode');
+ var str = new Object();
+ var len = new Object();
+ var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
+
+ var $copytext=$data;
+
+ str.data=$copytext;
+
+ trans.setTransferData("text/unicode",str,$copytext.length*2);
+ var clipid=Components.interfaces.nsIClipboard;
+ if (!clip) return false;
+
+ clip.setData(trans,null,clipid.kGlobalClipboard);
+ }
+
+ }
+
function showProps($Obj, $Name)
{
var $ret = '';
@@ -228,6 +285,11 @@
window.onresize = resizeDebugLayer;
window.onscroll = resizeDebugLayer;
window.focus();
+ if( typeof($isFatalError) != 'undefined' && $isFatalError == 1 )
+ {
+ toggleDebugLayer();
+ document.getElementById('debug_layer').scrollTop = 10000000;
+ }
error ['.$errno.'] = ['.$errstr.']
';
$errorType = $this->getErrorNameByCode($errno);
- if( substr($errorType,0,5) == 'Fatal')
- {
-
- $this->printReport();
- exit;
- }
if(!$errorType)
{
trigger_error('Unknown error type ['.$errno.']', E_USER_ERROR);
return false;
}
$this->Data[] = Array('no' => $errno, 'str' => $errstr, 'file' => $errfile, 'line' => $errline, 'context' => $errcontext, 'debug_type' => 'error');
+ if( substr($errorType,0,5) == 'Fatal')
+ {
+ echo '';
+ exit;
+ }
}
}
$debugger = new Debugger();
+ $debugger->appendHTML('Hide Debugger');
+
set_error_handler( array(&$debugger,'saveError') );
register_shutdown_function( array(&$debugger,'printReport') );
Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -N -r838 -r842
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 838)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 842)
@@ -351,11 +351,10 @@
{
if( is_array($value) )
{
- echo "Invalid Value: ";
- print_pre($value);
- echo "Tracing:
";
- trace();
- die();
+ global $debugger;
+ $debugger->dumpVars($value);
+ $debugger->appendTrace();
+ trigger_error('Value of array type not allowed in method CreateSQL of clsItemDB class', E_USER_ERROR);
}
if($first)
{