Index: trunk/admin/install.php
===================================================================
diff -u -r3184 -r3216
--- trunk/admin/install.php (.../install.php) (revision 3184)
+++ trunk/admin/install.php (.../install.php) (revision 3216)
@@ -72,7 +72,7 @@
ini_set('include_path', '.');
-if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
+if( file_exists($pathtoroot.'debug.php') && !(defined('DEBUG_MODE') && DEBUG_MODE) ) include_once($pathtoroot.'debug.php');
if(!defined('IS_INSTALL'))define('IS_INSTALL',1);
$admin = substr($path,strlen($pathtoroot));
$state = isset($_GET["state"]) ? $_GET["state"] : '';
Index: trunk/admin/index4.php
===================================================================
diff -u -r3184 -r3216
--- trunk/admin/index4.php (.../index4.php) (revision 3184)
+++ trunk/admin/index4.php (.../index4.php) (revision 3216)
@@ -17,7 +17,8 @@
$end = getmicrotime();
-if (defined('DEBUG_MODE')) {
+if ( constOn('DEBUG_MODE') )
+{
echo '
Index: trunk/core/kernel/globals.php
===================================================================
diff -u -r3210 -r3216
--- trunk/core/kernel/globals.php (.../globals.php) (revision 3210)
+++ trunk/core/kernel/globals.php (.../globals.php) (revision 3216)
@@ -46,7 +46,7 @@
*/
function print_pre($data, $label='')
{
- if( defined('DEBUG_MODE') && DEBUG_MODE )
+ if( constOn('DEBUG_MODE') )
{
global $debugger;
if($label) $debugger->appendHTML(''.$label.'');
@@ -186,7 +186,7 @@
{
function k4_include_once($file)
{
- if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES )
+ if ( constOn('DEBUG_MODE') && isset($debugger) && constOn('DBG_PROFILE_INCLUDES') )
{
if ( in_array($file, get_required_files()) ) return;
@@ -369,14 +369,17 @@
return $result;
}
- /**
- * Checks if constant is defined and has positive value
- *
- * @param string $const_name
- * @return bool
- */
- function constOn($const_name)
+ if( !function_exists('constOn') )
{
- return defined($const_name) && constant($const_name);
+ /**
+ * Checks if constant is defined and has positive value
+ *
+ * @param string $const_name
+ * @return bool
+ */
+ function constOn($const_name)
+ {
+ return defined($const_name) && constant($const_name);
+ }
}
?>
\ No newline at end of file
Index: trunk/admin/listview/listview.php
===================================================================
diff -u -r1050 -r3216
--- trunk/admin/listview/listview.php (.../listview.php) (revision 1050)
+++ trunk/admin/listview/listview.php (.../listview.php) (revision 3216)
@@ -258,7 +258,7 @@
$PerPage = $objConfig->Get($this->PerPageVar);
if($PerPage < 1)
{
- if( defined('DEBUG_MODE') ) echo 'PerPage Variable ['.$this->PerPageVar.'] not defined in Config
';
+ if( IsDebugMode() ) echo 'PerPage Variable ['.$this->PerPageVar.'] not defined in Config
';
$PerPage = 20;
//$objConfig->Set($this->PerPageVar,20);
//$objConfig->Save();
Index: trunk/globals.php
===================================================================
diff -u -r3201 -r3216
--- trunk/globals.php (.../globals.php) (revision 3201)
+++ trunk/globals.php (.../globals.php) (revision 3216)
@@ -1743,9 +1743,11 @@
*
* @return bool
*/
-function IsDebugMode()
+function IsDebugMode($check_debugger = true)
{
- return defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 ? 1 : 0;
+ $debug_mode = defined('DEBUG_MODE') && DEBUG_MODE;
+ if($check_debugger) $debug_mode = $debug_mode && isset($GLOBALS['debugger']);
+ return $debug_mode;
}
/**
@@ -2032,5 +2034,19 @@
}
return $ret;
}
+
+ if( !function_exists('constOn') )
+ {
+ /**
+ * Checks if constant is defined and has positive value
+ *
+ * @param string $const_name
+ * @return bool
+ */
+ function constOn($const_name)
+ {
+ return defined($const_name) && constant($const_name);
+ }
+ }
?>
Index: trunk/index.php
===================================================================
diff -u -r3184 -r3216
--- trunk/index.php (.../index.php) (revision 3184)
+++ trunk/index.php (.../index.php) (revision 3216)
@@ -13,7 +13,8 @@
$end = getmicrotime();
-if (defined('DEBUG_MODE')&&DEBUG_MODE) {
+if ( $application->isDebugMode() )
+{
echo '
Memory used: '.round(memory_get_usage()/1024/1024, 1).' Mb
';
echo 'Time used: '.round(($end - $start), 5).' Sec
';
}
Index: trunk/tools/debug_sample.php
===================================================================
diff -u -r1566 -r3216
--- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 1566)
+++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 3216)
@@ -1,7 +1,7 @@
CacheExpired = true;
$file = $this->getConfigName($full_path);
- if ( defined('DEBUG_MODE') && dbg_ConstOn('DBG_PROFILE_INCLUDES')) {
+ if ( $this->Application->isDebugMode() && constOn('DBG_PROFILE_INCLUDES') )
+ {
if ( in_array($file, get_required_files()) ) return;
global $debugger;
@@ -171,7 +172,7 @@
foreach ($this->configFiles as $filename)
{
$config_found = file_exists(FULL_PATH.$filename) && $this->configAllowed($filename);
- if( defined('DEBUG_MODE') && DEBUG_MODE && dbg_ConstOn('DBG_PROFILE_INCLUDES'))
+ if( $this->Application->isDebugMode() && constOn('DBG_PROFILE_INCLUDES') )
{
if ( in_array($filename, get_required_files()) ) return;
global $debugger;
Index: trunk/kernel/startup.php
===================================================================
diff -u -r3008 -r3216
--- trunk/kernel/startup.php (.../startup.php) (revision 3008)
+++ trunk/kernel/startup.php (.../startup.php) (revision 3216)
@@ -21,7 +21,7 @@
include_once(FULL_PATH.'/kernel/kernel4/startup.php');
// just to make sure that this is correctly detected
- if( defined('DEBUG_MODE') && DEBUG_MODE ) $debugger->appendHTML('FULL_PATH: '.FULL_PATH.'');
+ if( IsDebugMode() ) $debugger->appendHTML('FULL_PATH: '.FULL_PATH.'');
$application =& kApplication::Instance();
$application->Init();
@@ -76,7 +76,7 @@
require_once(FULL_PATH.'/compat.php');
/* set global variables and module lists */
-include_once(FULL_PATH.'/kernel/include/'.( IsDebugMode() ? 'debugger.php' : 'debugger_dummy.php') );
+if( constOn('DEBUG_MODE') ) include_once(FULL_PATH.'/kernel/include/debugger.php');
// put all non-checked checkboxes in $_POST & $_REQUEST with 0 values
if( GetVar('form_fields') )
@@ -193,7 +193,7 @@
LogEntry("Startup complete\n");
include_once("include/modules.php");
-if( defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 && function_exists('DebugByFile') ) DebugByFile();
+if( IsDebugMode() && function_exists('DebugByFile') ) DebugByFile();
/* startup is complete, so now check the mail queue to see if there's anything that needs to be sent*/
$objEmailQueue->SendMailQeue();
Index: trunk/kernel/include/adodb/adodb.inc.php
===================================================================
diff -u -r1852 -r3216
--- trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 1852)
+++ trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 3216)
@@ -701,7 +701,8 @@
$inputarr = false;
}
// debug version of query
- if ($this->debug) {
+ if ($this->debug && isset($GLOBALS['debugger']) )
+ {
global $HTTP_SERVER_VARS, $debugger;
$ss = '';
Index: trunk/core/kernel/utility/email.php
===================================================================
diff -u -r2979 -r3216
--- trunk/core/kernel/utility/email.php (.../email.php) (revision 2979)
+++ trunk/core/kernel/utility/email.php (.../email.php) (revision 3216)
@@ -415,9 +415,9 @@
return true;
}else {
- if (defined('DEBUG_MODE')){
- global $debugger;
- $debugger->appendHTML(''.$smtp_object->debugtext.'
');
+ if ( $this->Application->isDebugMode() )
+ {
+ $this->Application->Debugger->appendHTML(''.$smtp_object->debugtext.'
');
//define('DBG_REDIRECT', 1);
}
return false;