diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php index 3e4df23d..87b49931 100644 --- a/bt/includes/init_tr.php +++ b/bt/includes/init_tr.php @@ -441,21 +441,21 @@ class sql_db /** * Find caller source */ - function debug_find_source () + function debug_find_source ($mode = '') { - $source = ''; - $backtrace = debug_backtrace(); - - foreach ($backtrace as $trace) + foreach (debug_backtrace() as $trace) { if ($trace['file'] !== __FILE__) { - $source = str_replace(BB_PATH, '', $trace['file']) .'('. $trace['line'] .')'; - break; + switch ($mode) + { + case 'file': return $trace['file']; + case 'line': return $trace['line']; + default: return hide_bb_path($trace['file']) .'('. $trace['line'] .')'; + } } } - - return $source; + return 'src not found'; } /** diff --git a/library/includes/cache/common.php b/library/includes/cache/common.php index 10852733..0320b667 100644 --- a/library/includes/cache/common.php +++ b/library/includes/cache/common.php @@ -69,6 +69,9 @@ class cache_common } } + /** + * Find caller source + */ function debug_find_source ($mode = '') { foreach (debug_backtrace() as $trace) @@ -85,4 +88,4 @@ class cache_common } return 'src not found'; } -} \ No newline at end of file +} diff --git a/library/includes/core/mysql.php b/library/includes/core/mysql.php index c8f10f4e..f3cb8cf9 100644 --- a/library/includes/core/mysql.php +++ b/library/includes/core/mysql.php @@ -831,7 +831,7 @@ class sql_db { foreach (debug_backtrace() as $trace) { - if (!empty($trace['file']) && $trace['file'] !== __FILE__) + if ($trace['file'] !== __FILE__) { switch ($mode) { @@ -841,7 +841,7 @@ class sql_db } } } - return ''; + return 'src not found'; } /** diff --git a/library/includes/datastore/common.php b/library/includes/datastore/common.php index 2d46dd4b..c0d2d212 100644 --- a/library/includes/datastore/common.php +++ b/library/includes/datastore/common.php @@ -160,6 +160,9 @@ class datastore_common } } + /** + * Find caller source + */ function debug_find_source ($mode = '') { foreach (debug_backtrace() as $trace) @@ -176,4 +179,4 @@ class datastore_common } return 'src not found'; } -} \ No newline at end of file +}