From ad30a667fd8abeb576c04026b62c2e8a29d86f52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 6 Jun 2010 17:41:09 +0000 Subject: [PATCH] debug_report_bug() should be used as a replacement for app_die() calls --- inc/classes/cachesystem.class.php | 8 ++-- inc/code-functions.php | 2 +- inc/config-functions.php | 10 ++-- inc/db/lib-mysql3.php | 18 ++++---- inc/extensions-functions.php | 18 ++++---- inc/extensions/ext-sql_patches.php | 2 +- inc/filter-functions.php | 4 +- inc/filters.php | 16 +++---- inc/functions.php | 54 +++++++++++----------- inc/handler.php | 2 +- inc/inc-functions.php | 2 +- inc/install-inc.php | 2 +- inc/libs/admins_functions.php | 6 +-- inc/libs/bonus_functions.php | 4 +- inc/libs/network_functions.php | 42 ++++++++--------- inc/libs/online_functions.php | 2 +- inc/libs/register_functions.php | 8 ++-- inc/libs/surfbar_functions.php | 2 +- inc/libs/theme_functions.php | 4 +- inc/libs/yoomedia_functions.php | 4 +- inc/load_config.php | 6 +-- inc/loader/load_cache-modules.php | 2 +- inc/modules/admin/admin-inc.php | 4 +- inc/modules/admin/overview-inc.php | 4 +- inc/modules/admin/what-add_guestnl_cat.php | 2 +- inc/modules/admin/what-list_payouts.php | 2 +- inc/modules/admin/what-list_task.php | 2 +- inc/modules/guest/what-confirm.php | 2 +- inc/modules/guest/what-stats.php | 2 +- inc/mysql-manager.php | 6 +-- inc/revision-functions.php | 2 +- inc/stylesheet.php | 2 +- inc/wrapper-functions.php | 28 +++++------ mailid.php | 4 +- mailid_top.php | 10 ++-- 35 files changed, 142 insertions(+), 146 deletions(-) diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 5892900b3d..4c4878aa57 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -108,7 +108,7 @@ class CacheSystem { // Create file if ($this->isCacheReadable()) changeMode($this->fqfn, 0666); - $this->pointer = fopen($this->fqfn, 'w') or app_die(__METHOD__, __LINE__, "Cannot write to cache ".$this->fqfn." !"); + $this->pointer = fopen($this->fqfn, 'w') or debug_report_bug(__METHOD__, __LINE__, 'Cannot write to cache ' . $this->fqfn . ' !'); // Add open PHP tag fwrite($this->pointer, "removeCacheFile(true); // Unsupported cache found! - debug_report_bug('Unsupported cache ' . $this->name . ' detected.'); + debug_report_bug(__METHOD__, __LINE__, 'Unsupported cache ' . $this->name . ' detected.'); } // Write cache line to file @@ -260,7 +260,7 @@ class CacheSystem { } // END - if } else { // Cache file not found or not readable - debug_report_bug($this->name); + debug_report_bug(__METHOD__, __LINE__, $this->name); addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): ' . getMaskedMessage('CACHE_CANNOT_LOAD', $this->fqfn)); // Try to remove it @@ -500,7 +500,7 @@ class CacheSystem { } } elseif (isset($value[0])) { // These lines needs fixing - debug_report_bug('Invalid entry with [0] found. key=' . $key); + debug_report_bug(__METHOD__, __LINE__, 'Invalid entry with [0] found. key=' . $key); } else { // Non-string $line = '$this->' . $prefix . "['" . $this->name . "']['" . $key . "']" . $extender . ' = ' . $value . ";\n"; diff --git a/inc/code-functions.php b/inc/code-functions.php index 6670ed1cf6..4f4156fe35 100644 --- a/inc/code-functions.php +++ b/inc/code-functions.php @@ -52,7 +52,7 @@ function getCode ($key) { // Is the key set? if (!isCodeSet($key)) { // Abort here - debug_report_bug(sprintf("%s[%s:] Code %s is not set.", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("%s[%s:] Code %s is not set.", __FUNCTION__, __LINE__, $key diff --git a/inc/config-functions.php b/inc/config-functions.php index bc3eea0070..b58db19ee5 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -47,7 +47,7 @@ function initConfig () { // Init not if already found if (isConfigurationLoaded()) { // Already initialized - debug_report_bug(sprintf("[%s:%s] Configuration is already initialized.", __FUNCTION__, __LINE__)); + debug_report_bug(__FUNCTION__, __LINE__, 'Configuration is already initialized.'); } // END - if // Set a minimum of configuration, required to by-pass some error triggers in getConfig() @@ -79,11 +79,7 @@ function getConfig ($configEntry) { // Is the entry there? if (!isset($GLOBALS['config'][$configEntry])) { // Raise an error of missing entries - debug_report_bug(sprintf("[%s:%s] Configuration entry %s is missing.", - __FUNCTION__, - __LINE__, - $configEntry - )); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Configuration entry %s is missing.", $configEntry)); } // END - if // Return it @@ -298,7 +294,7 @@ function updateConfiguration ($entries, $values, $updateMode='', $config = '0') // Check if string or number but no array if (is_array($values[$idx])) { // Arrays must be fixed... - debug_report_bug('values[' . $idx . '] should not be an array! Content=
'.print_r($values[$idx], true).'
'); + debug_report_bug(__FUNCTION__, __LINE__, 'values[' . $idx . '] should not be an array! Content=
'.print_r($values[$idx], true).'
'); } elseif (($values[$idx] + 0) === $values[$idx]) { // Number detected $all .= sprintf("`%s`=%s,", $entry, (float)$values[$idx]); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 4f4b8cd098..25a8307cca 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -50,7 +50,7 @@ function SQL_QUERY ($sqlString, $F, $L) { // Link is up? if (!SQL_IS_LINK_UP()) { // We should not quietly ignore this! - debug_report_bug(sprintf("Cannot query database: sqlString=%s,file=%s,line=%s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s", $sqlString, basename($F), $L @@ -60,7 +60,7 @@ function SQL_QUERY ($sqlString, $F, $L) { return false; } elseif (empty($sqlString)) { // Empty SQL string! - debug_report_bug(sprintf("SQL string is empty. Please fix this. file=%s, line=%s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("SQL string is empty. Please fix this. file=%s, line=%s", basename($F), $L )); @@ -84,7 +84,7 @@ function SQL_QUERY ($sqlString, $F, $L) { // Run SQL command //* DEBUG: */ print('F=' . basename($F) . ',L=' . $L . 'sql=' . htmlentities($sqlString) . '
'); $result = mysql_query($sqlString, SQL_GET_LINK()) - or debug_report_bug('[' . __FUNCTION__ . ':' . __LINE__ . '] ' . $F . ' (' . $L . '):' . mysql_error() . "\n". + or debug_report_bug(__FUNCTION__, __LINE__, 'file='. $F . ',line=' . $L . ':mysql_error()=' . mysql_error() . "\n". 'Query string:' . $sqlString); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sqlString . ',numRows=' . SQL_NUMROWS($result) . ',affected=' . SQL_AFFECTEDROWS()); @@ -108,7 +108,7 @@ function SQL_QUERY ($sqlString, $F, $L) { // // Debugging stuff... // - $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or app_die(__FILE__, __LINE__, 'Cannot write mysql.log!'); + $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write mysql.log!'); if (!isset($GLOBALS['sql_first_entry'])) { // Write first entry fwrite($fp, 'Module=' . getModule() . "\n"); @@ -283,7 +283,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure // Debugging // - //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!"); + //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, "Cannot write debug.log!"); //* DEBUG: */ fwrite($fp, $F.'('.$L."): ".str_replace("\r", '', str_replace("\n", ' ', $eval))."\n"); //* DEBUG: */ fclose($fp); @@ -340,7 +340,7 @@ function SQL_RESULT_FROM_ARRAY ($table, $columns, $idRow, $id, $F, $L) { // Is columns an array? if (!is_array($columns)) { // No array - debug_report_bug(sprintf("columns is not an array. %s != array, file=%s, line=%s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("columns is not an array. %s != array, file=%s, line=%s", gettype($columns), basename($F), $L @@ -397,7 +397,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { // Get column information $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'", - array($tableName, $columnName), __FILE__, __LINE__); + array($tableName, $columnName), __FUNCTION__, __LINE__); // Do we have no entry on ADD or an entry on DROP? // 123 4 4 3 3 4 4 32 23 4 4 3 3 4 4 321 @@ -444,7 +444,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { } // END - if // Show indexes - $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__); // Non-skipping is default for ADD $skip = false; @@ -515,7 +515,7 @@ function SQL_SET_LINK ($link) { // Is this a resource or null? if ((!is_resource($link)) && (!is_null($link))) { // This should never happen! - debug_report_bug(sprintf("link is not resource or null. Type: %s", gettype($link))); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("link is not resource or null. Type: %s", gettype($link))); } // END - if // Set it diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 8703d98ac3..8d981e3e24 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -207,7 +207,7 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru // Still zero and not in dry-run? if (($task_id == '0') && (!getExtensionDryRun())) { // Then request a bug report - debug_report_bug(sprintf("%s: task_id is still zero after determineExtensionTaskId(%s)", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("%s: task_id is still zero after determineExtensionTaskId(%s)", __FUNCTION__, getCurrentExtensionName() )); @@ -537,7 +537,7 @@ function isExtensionActive ($ext_name) { incrementStatsEntry('cache_hits'); } elseif (isset($GLOBALS['ext_loaded'][$ext_name])) { // @TODO Extension is loaded, what next? - app_die(__FUNCTION__, __LINE__, 'LOADED:' . $ext_name); + debug_report_bug(__FUNCTION__, __LINE__, 'LOADED:' . $ext_name); } elseif (($ext_name == 'cache') || (!isExtensionInstalled('cache'))) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}"); // Load from database @@ -604,7 +604,7 @@ function getExtensionVersion ($ext_name, $force = false) { $data = SQL_FETCHARRAY($result); } elseif (isDebugModeEnabled()) { // Not found, please report all - debug_report_bug(sprintf(": Cannot find extension %s in database!", $ext_name)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf(": Cannot find extension %s in database!", $ext_name)); } // Free result @@ -617,7 +617,7 @@ function getExtensionVersion ($ext_name, $force = false) { // Extension version should not be invalid if (($data['ext_version'] == 'false') && ($force === false)) { // Please report this trouble - debug_report_bug(sprintf("Extension %s has empty version!", $ext_name)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Extension %s has empty version!", $ext_name)); } // END - if // Return result @@ -950,7 +950,7 @@ function createExtensionUpdateTask ($adminId, $ext_name, $ext_ver, $notes) { } // END - if } else { // Extension not there! :-( - debug_report_bug(sprintf("Extension %s not found but should be updated?", $ext_name)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Extension %s not found but should be updated?", $ext_name)); } } @@ -1202,7 +1202,7 @@ function addExtensionUpdateDependency ($updateDepends) { // Is the update depency empty? (NEED TO BE FIXED!) if (empty($updateDepends)) { // Please report this bug! - debug_report_bug('updateDepends is empty: currentExtension=' . getCurrentExtensionName()); + debug_report_bug(__FUNCTION__, __LINE__, 'updateDepends is empty: currentExtension=' . getCurrentExtensionName()); } // END - if // Is it not yet added? @@ -1463,7 +1463,7 @@ function getExtensionSqls () { // Output debug backtrace if not found (SHOULD NOT HAPPEN!) if (!isset($GLOBALS['ext_sqls'][getCurrentExtensionName()])) { // Not found, should not happen - debug_report_bug(sprintf("ext_sqls is empty, current extension: %s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("ext_sqls is empty, current extension: %s", getCurrentExtensionName() )); } // END - if @@ -1560,7 +1560,7 @@ function setCurrentExtensionVersion ($ext_ver) { // ext_ver should never be empty in other modes than 'test' if ((empty($ext_ver)) && (getExtensionMode() != 'test')) { // Please report all these messages - debug_report_bug('ext_ver is empty. Current extension name: ' . getCurrentExtensionName() . ', mode=' . getExtensionMode()); + debug_report_bug(__FUNCTION__, __LINE__, 'ext_ver is empty. Current extension name: ' . getCurrentExtensionName() . ', mode=' . getExtensionMode()); } // END - if // Add version @@ -1657,7 +1657,7 @@ function loadExtensionInclude () { // Is it readable? if (!isExtensionIncludeReadable()) { // Not readable - debug_report_bug('Extension ' . getCurrentExtensionName() . ' should be loaded, but is not readable.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Extension ' . getCurrentExtensionName() . ' should be loaded, but is not readable.'); } // END - if // Generate INC name diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 68d4ea59e1..da81139181 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -773,7 +773,7 @@ INDEX (`ip`) updateConfiguration('file_hash', ''); // Cannot read secret file! - app_die(__FILE__, __LINE__, 'Cannot read secret file! Please try to reload.'); + debug_report_bug(__FILE__, __LINE__, 'Cannot read secret file! Please try to reload.'); } } // END - if diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 39b7558bfd..7c0296dad2 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -47,7 +47,7 @@ function initFilterSystem () { // Is the filter already initialized? if (isset($GLOBALS['filter_init'])) { // Then abort here - debug_report_bug('Filter system already initialized.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Filter system already initialized.'); } // END - if // Load all saved filers if sql_patches is updated @@ -195,7 +195,7 @@ function registerFilter ($filterName, $filterFunction, $silentAbort = true, $for // In installation phase we always want to abort if (($silentAbort === false) || (isInstallationPhase())) { // Add fatal message - debug_report_bug(sprintf("[%s:%s] Filter chain %s has already filter function %s registered!", __FUNCTION__, __LINE__, $filterName, $filterFunction)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Filter chain %s has already filter function %s registered!", $filterName, $filterFunction)); } // END - if // Abort here diff --git a/inc/filters.php b/inc/filters.php index 4dcb9e3f0f..424fe9f104 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -190,7 +190,7 @@ function FILTER_SOLVE_TASK ($data) { adminSolveTask($data['task_id']); } else { // Not detectable! - debug_report_bug(sprintf("Cannot resolve task. data[%s]=
%s
", gettype($data), print_r($data, true))); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot resolve task. data[%s]=
%s
", gettype($data), print_r($data, true))); } // Return the data @@ -202,7 +202,7 @@ function FILTER_LOAD_INCLUDES ($pool) { // Is it null? if (is_null($pool)) { // This should not happen! - debug_report_bug('pool is null.'); + debug_report_bug(__FUNCTION__, __LINE__, 'pool is null.'); } // END - if // Is the pool an array and 'pool' set? @@ -220,7 +220,7 @@ function FILTER_LOAD_INCLUDES ($pool) { // Is it an array? if ((!isset($data)) || (!is_array($data))) { // Then abort here - debug_report_bug(sprintf("INC_POOL is no array! Type: %s", gettype($data))); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("INC_POOL is no array! Type: %s", gettype($data))); } elseif (isset($data['inc_pool'])) { // Use this as new inclusion pool! setIncludePool($realPool, $data['inc_pool']); @@ -489,7 +489,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { $code = call_user_func($commandFunction, $data); } else { // Unsupported command detected - debug_report_bug('Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.'); } } // END - foreach } // END - if @@ -521,7 +521,7 @@ function FILTER_RUN_RESET_INCLUDES () { // Is the reset set or old sql_patches? if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (getOutputMode() == '0')) { // Then abort here - debug_report_bug('Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks'); } // END - if // Get more daily reset scripts @@ -885,7 +885,7 @@ function FILTER_FETCH_USER_DATA ($userid = 0) { // Get user data if (!fetchUserData($userid)) { // Userid is not valid - debug_report_bug('User id '.$userid . ' is invalid.'); + debug_report_bug(__FUNCTION__, __LINE__, 'User id '.$userid . ' is invalid.'); } // END - if // Set member id @@ -897,7 +897,7 @@ function FILTER_RESET_USER_LOGIN_FAILURE () { // Is the user data valid? if (!isMember()) { // Do only run for logged in members - debug_report_bug('Please only run this filter for logged in users.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); } // END - if // Remmeber login failures if available @@ -911,7 +911,7 @@ SET WHERE `userid`=%s LIMIT 1", - array(getMemberId()), __FILE__, __LINE__); + array(getMemberId()), __FUNCTION__, __LINE__); // Store it in session setSession('mailer_member_failures' , getUserData('login_failures')); diff --git a/inc/functions.php b/inc/functions.php index 9a6014a05b..305ee3f8aa 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -85,7 +85,7 @@ function outputHtml ($htmlCode, $newLine = true) { default: // Huh, something goes wrong or maybe you have edited config.php ??? - app_die(__FUNCTION__, __LINE__, '{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}'); + debug_report_bug(__FUNCTION__, __LINE__, '{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}'); break; } // END - switch } elseif ((getPhpCaching() == 'on') && ((!isset($GLOBALS['header'])) || (count($GLOBALS['header']) == 0))) { @@ -162,7 +162,7 @@ function compileFinalOutput () { // Was that eval okay? if (empty($newContent)) { // Something went wrong! - debug_report_bug('Evaluation error:
' . linenumberCode($eval) . '
', false); + debug_report_bug(__FUNCTION__, __LINE__, 'Evaluation error:
' . linenumberCode($eval) . '
', false); } // END - if // Use it again @@ -256,7 +256,7 @@ function getTotalFatalErrors () { // Load a template file and return it's content (only it's name; do not use ' or ") function loadTemplate ($template, $return = false, $content = array()) { // @TODO Remove this sanity-check if all is fine - if (!is_bool($return)) debug_report_bug('return is not bool (' . gettype($return) . ')'); + if (!is_bool($return)) debug_report_bug(__FUNCTION__, __LINE__, 'return is not bool (' . gettype($return) . ')'); // @TODO Try to rewrite all $DATA to $content global $DATA; @@ -839,7 +839,7 @@ function translateGender ($gender) { case 'C': $ret = getMessage('GENDER_C'); break; default: // Please report bugs on unknown genders - debug_report_bug(sprintf("Unknown gender %s detected.", $gender)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Unknown gender %s detected.", $gender)); break; } // END - switch @@ -864,7 +864,7 @@ function translateUserStatus ($status) { default: // Please report all unknown status - debug_report_bug(sprintf("Unknown status %s detected.", $status)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status)); break; } // END - switch @@ -954,7 +954,7 @@ function redirectToUrl ($URL, $allowSpider = true) { } // END - if // Three different ways to debug... - //* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); + //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $URL); //* DEBUG: */ die($URL); @@ -993,7 +993,7 @@ function redirectToConfiguredUrl ($configEntry) { // Is this URL set? if (is_null($URL)) { // Then abort here - debug_report_bug(sprintf("Configuration entry %s is not set!", $configEntry)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Configuration entry %s is not set!", $configEntry)); } // END - if // Load the URL @@ -1341,7 +1341,7 @@ function bigintval ($num, $castValue = true, $abortOnMismatch = true) { // Has the whole value changed? if (('' . $ret . '' != '' . $num . '') && ($abortOnMismatch === true)) { // Log the values - debug_report_bug('Problem with number found. ret=' . $ret . ', num='. $num); + debug_report_bug(__FUNCTION__, __LINE__, 'Problem with number found. ret=' . $ret . ', num='. $num); } // END - if // Return result @@ -1353,7 +1353,7 @@ function generateImageOrCode ($img_code, $headerSent = true) { // Is the code size oversized or shouldn't we display it? if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == '0')) { // Stop execution of function here because of over-sized code length - debug_report_bug('img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getConfig('code_length')); + debug_report_bug(__FUNCTION__, __LINE__, 'img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getConfig('code_length')); } elseif ($headerSent === false) { // Return an HTML code here return 'Image'; @@ -2074,7 +2074,7 @@ function isUrlValid ($URL, $compile=true) { // Generate a list of administrative links to a given userid function generateMemberAdminActionLinks ($userid, $status = '') { // Make sure userid is a number - if ($userid != bigintval($userid)) debug_report_bug('userid is not a number!'); + if ($userid != bigintval($userid)) debug_report_bug(__FUNCTION__, __LINE__, 'userid is not a number!'); // Define all main targets $targetArray = array('del_user', 'edit_user', 'lock_user', 'add_points', 'sub_points'); @@ -2155,7 +2155,7 @@ function generateHash ($plainText, $salt = '', $hash = true) { // Do we miss an arry element here? if (!isConfigEntrySet('file_hash')) { // Stop here - debug_report_bug('Missing file_hash in ' . __FUNCTION__ . '.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Missing file_hash in ' . __FUNCTION__ . '.'); } // END - if // When the salt is empty build a new one, else use the first x configured characters as the salt @@ -2377,7 +2377,7 @@ function app_die ($F, $L, $message) { loadIncludeOnce('inc/footer.php'); } else { // Script tried to kill itself twice - debug_report_bug('Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $F . ', line=' . $L); + die('['.__FUNCTION__.':'.__LINE__.']: Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $F . ', line=' . $L); } } @@ -2526,7 +2526,7 @@ function debug_get_mailable_backtrace () { } // Output a debug backtrace to the user -function debug_report_bug ($message = '', $sendEmail = true) { +function debug_report_bug ($F, $L, $message = '', $sendEmail = true) { // Is this already called? if (isset($GLOBALS[__FUNCTION__])) { // Other backtrace @@ -2549,7 +2549,7 @@ function debug_report_bug ($message = '', $sendEmail = true) { ); // @TODO Add a little more infos here - logDebugMessage(__FUNCTION__, __LINE__, strip_tags($message)); + logDebugMessage($F, $L, strip_tags($message)); } // END - if // Add output @@ -2571,7 +2571,7 @@ function debug_report_bug ($message = '', $sendEmail = true) { } // END - if // And abort here - app_die(__FUNCTION__, __LINE__, $debug); + app_die($F, $L, $debug); } // Generates a ***weak*** seed @@ -2633,7 +2633,7 @@ function getMessageFromErrorCode ($code) { case getCode('URL_TLOCK'): // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", - array(bigintval(getRequestParameter('id'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('id'))), __FUNCTION__, __LINE__); // Load timestamp from last order list($timestamp) = SQL_FETCHROW($result); @@ -2855,8 +2855,8 @@ function logDebugMessage ($funcFile, $line, $message, $force=true) { // Remove CRLF $message = str_replace("\r", '', str_replace("\n", '', $message)); - // Log this message away, we better don't call app_die() here to prevent an endless loop - $fp = fopen(getConfig('CACHE_PATH') . 'debug.log', 'a') or die(__FUNCTION__.'['.__LINE__.']: Cannot write logfile debug.log!'); + // Log this message away + $fp = fopen(getConfig('CACHE_PATH') . 'debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write logfile debug.log!'); fwrite($fp, date('d.m.Y|H:i:s', time()) . '|' . getModule(false) . '|' . basename($funcFile) . '|' . $line . '|' . $message . "\n"); fclose($fp); } // END - if @@ -3150,10 +3150,10 @@ function shutdown () { // Check if not in installation phase and the link is up if ((!isInstallationPhase()) && (SQL_IS_LINK_UP())) { // Close link - SQL_CLOSE(__FILE__, __LINE__); + SQL_CLOSE(__FUNCTION__, __LINE__); } elseif (!isInstallationPhase()) { // No database link - addFatalMessage(__FILE__, __LINE__, getMessage('NO_DB_LINK_SHUTDOWN')); + addFatalMessage(__FUNCTION__, __LINE__, getMessage('NO_DB_LINK_SHUTDOWN')); } // Stop executing here @@ -3168,7 +3168,7 @@ function initMemberId () { // Setter for member id function setMemberId ($memberid) { // We should not set member id to zero - if ($memberid == '0') debug_report_bug('Userid should not be set zero.'); + if ($memberid == '0') debug_report_bug(__FUNCTION__, __LINE__, 'Userid should not be set zero.'); // Set it secured $GLOBALS['member_id'] = bigintval($memberid); @@ -3221,7 +3221,7 @@ function getExtraTitle () { // Is the extra title set? if (!isExtraTitleSet()) { // No, then abort here - debug_report_bug('extra_title is not set!'); + debug_report_bug(__FUNCTION__, __LINE__, 'extra_title is not set!'); } // END - if // Return it @@ -3316,7 +3316,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad $files = array(); // Open directory - $dirPointer = opendir(getConfig('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.'); + $dirPointer = opendir(getConfig('PATH') . $baseDir) or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.'); // Read all entries while ($baseFile = readdir($dirPointer)) { @@ -3390,7 +3390,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad } } else { // We found .php file but should not search for them, why? - debug_report_bug('We should find files with extension=' . $extension . ', but we found a PHP script.'); + debug_report_bug(__FUNCTION__, __LINE__, 'We should find files with extension=' . $extension . ', but we found a PHP script.'); } } elseif (substr($baseFile, -4, 4) == $extension) { // Other, generic file found @@ -3469,7 +3469,7 @@ function initCacheInstance () { $GLOBALS['cache_instance'] = new CacheSystem(); if ($GLOBALS['cache_instance']->getStatus() != 'done') { // Failed to initialize cache sustem - addFatalMessage(__FILE__, __LINE__, '(' . __LINE__ . '): ' . getMessage('CACHE_CANNOT_INITIALIZE')); + addFatalMessage(__FUNCTION__, __LINE__, '(' . __LINE__ . '): ' . getMessage('CACHE_CANNOT_INITIALIZE')); } // END - if } @@ -3564,7 +3564,7 @@ function determinePageTitle () { $pageTitle = getMessage('NO_CONFIG_FOUND_TITLE'); // Do not add the fatal message in installation mode - if ((!isInstalling()) && (!isConfigurationLoaded())) addFatalMessage(__FILE__, __LINE__, getMessage('NO_CONFIG_FOUND')); + if ((!isInstalling()) && (!isConfigurationLoaded())) addFatalMessage(__FUNCTION__, __LINE__, getMessage('NO_CONFIG_FOUND')); } // Return title @@ -3800,7 +3800,7 @@ function getModuleFromFileName ($file, $accessLevel) { break; default: // Unsupported file name / access level - debug_report_bug('Unsupported file name=' . basename($file) . '/access level=' . $accessLevel); + debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported file name=' . basename($file) . '/access level=' . $accessLevel); break; } diff --git a/inc/handler.php b/inc/handler.php index e4c5f97811..74eb58753d 100644 --- a/inc/handler.php +++ b/inc/handler.php @@ -53,7 +53,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) { ); // Output message to user and die - debug_report_bug($message); + debug_report_bug($errfile, $errline, $message); } // Init error handler diff --git a/inc/inc-functions.php b/inc/inc-functions.php index d93731ab0d..989eb238d4 100644 --- a/inc/inc-functions.php +++ b/inc/inc-functions.php @@ -123,7 +123,7 @@ function loadInclude ($inc) { // Is the include file there? if (!isIncludeReadable($inc)) { // Not there so log it - debug_report_bug(sprintf("Include file %s not found.", $inc)); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Include file %s not found.", $inc)); } // END - if } // END - if diff --git a/inc/install-inc.php b/inc/install-inc.php index f27ccb8c02..1f70d3aa55 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -226,7 +226,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) { mergeSqls(explode(";\n", $fileContent), 'install'); } else { // Not readable! - debug_report_bug(sprintf("SQL dump %s is not readable!", $dump)); + debug_report_bug(__FILE__, __LINE__, sprintf("SQL dump %s is not readable!", $dump)); } } // END - foreach //* DEBUG: */ die(__FUNCTION__.'['.__LINE__.']:'
'.print_r(getSqls(), true).'
'); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 8bca848b23..b613105fa4 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -166,7 +166,7 @@ function adminsChangeAdminAccount ($postData, $element = '') { if ((!empty($element)) && (isset($postData[$element]))) { // Save this setting SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `%s`='%s' WHERE `id`=%s LIMIT 1", - array($element, $postData[$element][$id], $id), __FILE__, __LINE__); + array($element, $postData[$element][$id], $id), __FUNCTION__, __LINE__); // Admin account saved $message = getMessage('ADMIN_ACCOUNT_SAVED'); @@ -561,7 +561,7 @@ function getAminsExpertWarning () { function getAdminLoginFailures ($adminLogin) { // Admin login should not be empty if (empty($adminLogin)) { - debug_report_bug('adminLogin is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'adminLogin is empty.'); } // END - if // By default no admin is found @@ -597,7 +597,7 @@ function getAdminLoginFailures ($adminLogin) { function getAdminLastFailure ($adminLogin) { // Admin login should not be empty if (empty($adminLogin)) { - debug_report_bug('adminLogin is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'adminLogin is empty.'); } // END - if // By default no admin is found diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 21ef2d6d1b..5c99bb2e47 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -291,7 +291,7 @@ function FILTER_ADD_LOGIN_BONUS () { // Is the user data valid? if (!isMember()) { // Do only run for logged in members - debug_report_bug('Please only run this filter for logged in users.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); } // END - if // Bonus is not given by default ;-) @@ -309,7 +309,7 @@ WHERE LIMIT 1", array( getMemberId() - ), __FILE__, __LINE__ + ), __FUNCTION__, __LINE__ ); // Updated entry? diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 11ca2ba09d..be9110404b 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -86,7 +86,7 @@ function doAdminNetworkProcessForm () { // Is the function valid? if (!function_exists($functionName)) { // Invalid function name - debug_report_bug('Invalid do ' . getRequestParameter('do') . ', function ' . $functionName .' does not exist.', false); + debug_report_bug(__FUNCTION__, __LINE__, 'Invalid do ' . getRequestParameter('do') . ', function ' . $functionName .' does not exist.', false); } // END - if // Call-back the method handling our request @@ -146,7 +146,7 @@ function getNetworkDataById ($id, $column = '') { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network id ' . $id . ' is smaller than 1.'); } // END - if // Set current network id @@ -192,7 +192,7 @@ function getNetworkDataByTypeId ($id, $column = '') { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network type id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network type id ' . $id . ' is smaller than 1.'); } // END - if // Set current network id @@ -243,7 +243,7 @@ function getNetworkTypeDataById ($id) { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network type id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network type id ' . $id . ' is smaller than 1.'); } // END - if // By default we have no data @@ -277,7 +277,7 @@ function getNetworkRequestParamsDataById ($id) { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network request parameter id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $id . ' is smaller than 1.'); } // END - if // By default we have no data @@ -311,7 +311,7 @@ function doNetworkUpdateDataByArray ($id, $networkData) { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network id ' . $id . ' is smaller than 1.'); } // END - if // Just call our inner method @@ -323,7 +323,7 @@ function doNetworkUpdateTypeByArray ($id, $networkTypeData) { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network type handler id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network type handler id ' . $id . ' is smaller than 1.'); } // END - if // Just call our inner method @@ -335,7 +335,7 @@ function doNetworkUpdateParamsByArray ($id, $networkParamData) { // Ids lower one are not accepted if ($id < 1) { // Not good, should be fixed - debug_report_bug('Network request parameter id ' . $id . ' is smaller than 1.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $id . ' is smaller than 1.'); } // END - if // Just call our inner method @@ -346,7 +346,7 @@ function doNetworkUpdateParamsByArray ($id, $networkParamData) { function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) { // Remove the entry SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_network_%s` WHERE `%s`=%s LIMIT %s", - array($table, $column, $id, $limit), __FILE__, __LINE__); + array($table, $column, $id, $limit), __FUNCTION__, __LINE__); // Return affected rows return SQL_AFFECTEDROWS(); @@ -363,7 +363,7 @@ function generateAdminNetworkList () { FROM `{?_MYSQL_PREFIX?}_network_data` ORDER BY - `network_short_name` ASC", __FILE__, __LINE__); + `network_short_name` ASC", __FUNCTION__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result) > 0) { @@ -407,7 +407,7 @@ ORDER BY `network_type_handle` ASC", array( bigintval($networkId) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result) > 0) { @@ -451,7 +451,7 @@ ON t.`network_id`=d.`network_id` ORDER BY d.`network_short_name` ASC, - t.`network_type_handle` ASC", __FILE__, __LINE__); + t.`network_type_handle` ASC", __FUNCTION__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result) > 0) { @@ -657,7 +657,7 @@ function doAdminNetworkProcessHandlenetworkForm () { $OUT .= loadTemplate('admin_del_networks_row', true, $networkData); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Switch colors @@ -675,7 +675,7 @@ function doAdminNetworkProcessHandlenetworkForm () { loadTemplate('admin_del_networks', false, $OUT); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Don't display the list/add new form @@ -718,7 +718,7 @@ function doAdminNetworkProcessHandlenetworktypeForm () { $OUT .= loadTemplate('admin_del_network_types_row', true, $networkTypeData); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Switch colors @@ -742,7 +742,7 @@ function doAdminNetworkProcessHandlenetworktypeForm () { loadTemplate('admin_del_network_types', false, $content); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Don't display the list/add new form @@ -797,7 +797,7 @@ function doAdminNetworkProcessHandlerequestparamsForm () { $OUT .= loadTemplate('admin_del_network_params_row', true, $networkRequestData); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Switch colors @@ -821,7 +821,7 @@ function doAdminNetworkProcessHandlerequestparamsForm () { loadTemplate('admin_del_network_params', false, $content); } else { // Problem! - debug_report_bug('Cannot detect edit/del.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.'); } // Don't display the list/add new form @@ -855,7 +855,7 @@ function doAdminNetworkProcessChangenetworkForm () { // Do we have this enty? if (!isset($entry[$id])) { // Not found, needs fixing - debug_report_bug('No entry in key=' . $key . ', id=' . $id . ' found.'); + debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $id . ' found.'); } // END - if // Add this entry @@ -969,7 +969,7 @@ function doAdminNetworkProcessChangenetworktypeForm () { // Do we have this enty? if (!isset($entry[$id])) { // Not found, needs fixing - debug_report_bug('No entry in key=' . $key . ', id=' . $id . ' found.'); + debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $id . ' found.'); } // END - if // Fix empty network_type_banner_url to NULL @@ -1020,7 +1020,7 @@ function doAdminNetworkProcessChangenetworkparamForm () { // Do we have this enty? if (!isset($entry[$id])) { // Not found, needs fixing - debug_report_bug('No entry in key=' . $key . ', id=' . $id . ' found.'); + debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $id . ' found.'); } // END - if // Fix empty request_param_default to NULL diff --git a/inc/libs/online_functions.php b/inc/libs/online_functions.php index 91c84f1158..3e2cf9d02f 100644 --- a/inc/libs/online_functions.php +++ b/inc/libs/online_functions.php @@ -50,7 +50,7 @@ function FILTER_UPDATE_ONLINE_LIST () { // Empty session? if (session_id() == '') { // This is invalid here! - debug_report_bug('Invalid session.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Invalid session.'); } // END - if // Initialize variables diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index d4db9cc067..9218d5e93d 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -357,7 +357,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF bigintval(postRequestParameter('refid')), $hash, detectRemoteAddr(), - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); // Get his userid $userid = bigintval(SQL_INSERTID()); @@ -382,7 +382,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF // @TODO Rewrite this whole if() block to addPointsThroughReferalSystem(). This will also make following if() block obsolete // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`=0 LIMIT 1", - array($userid), __FILE__, __LINE__); + array($userid), __FUNCTION__, __LINE__); if (SQL_HASZERONUMS($result)) { // Add only when the line was not found (maybe some more secure?) $locked = 'points'; @@ -391,7 +391,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF if (getConfig('ref_payout') > 0) $locked = 'locked_points'; SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,0,'{?points_register?}')", - array($locked, $userid), __FILE__, __LINE__); + array($locked, $userid), __FUNCTION__, __LINE__); // Update mediadata as well if ((isExtensionInstalledAndNewer('mediadata', '0.0.4')) && ($locked == 'points')) { @@ -406,7 +406,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF if ($joined == 'Y') { // Insert category entry SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (`userid`, `cat_id`) VALUES (%s, %s)", - array($userid, bigintval($cat)), __FILE__, __LINE__); + array($userid, bigintval($cat)), __FUNCTION__, __LINE__); } // END - if } // END - foreach } // END - if diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 6716188e18..2260039884 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -1752,7 +1752,7 @@ function SURFBAR_GET_DATA ($element) { print('
');
 		print_r($GLOBALS['surfbar_cache']);
 		print('
'); - debug_report_bug('Element ' . $element . ' not found.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Element ' . $element . ' not found.'); } // Return result diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index c733441a6a..2279e5741f 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -72,7 +72,7 @@ FROM `{?_MYSQL_PREFIX?}_themes` ".$add." ORDER BY - `theme_name` ASC", __FILE__, __LINE__); + `theme_name` ASC", __FUNCTION__, __LINE__); // Load all themes while ($content = SQL_FETCHARRAY($result)) { @@ -331,7 +331,7 @@ function FILTER_SET_USERS_THEME () { // Is the user data valid? if (!isMember()) { // Do only run for logged in members - debug_report_bug('Please only run this filter for logged in users.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); } // END - if // Change to new theme diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index ab92eba1d2..83167b1275 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -335,7 +335,7 @@ function translateYooMediaError ($errorCode) { $return = $GLOBALS['translation_tables']['yoomedia']['error_codes'][$errorCode]; } else { // Log missing entries - debug_report_bug(sprintf("Unknown error code %s[%s] detected.", $errorCode, gettype($errorCode))); + debug_report_bug(__FUNCTION__, __LINE__, sprintf("Unknown error code %s[%s] detected.", $errorCode, gettype($errorCode))); } // Return value @@ -434,7 +434,7 @@ function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) { } else { // Should not happen! - debug_report_bug('Cannot parse response. Raw response:
' . print_r($response, true) . '
'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot parse response. Raw response:
' . print_r($response, true) . '
'); } // Fix empty code to bad diff --git a/inc/load_config.php b/inc/load_config.php index fbda547f94..fce7ca8696 100644 --- a/inc/load_config.php +++ b/inc/load_config.php @@ -62,7 +62,7 @@ if ((isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) && (isIncl setConfigEntry('OUTPUT_MODE', 'render'); // Both exist! This is bad and should be avoided by the admin - app_die(__FILE__, __LINE__, 'You have uploaded or kept an out-dated file at inc/config.php along with the new file '.getConfig('CACHE_PATH').'config-local.php. Please remove inc/config.php to avoid incompatiblity issues. Thank you.'); + debug_report_bug(__FILE__, __LINE__, 'You have uploaded or kept an out-dated file at inc/config.php along with the new file '.getConfig('CACHE_PATH').'config-local.php. Please remove inc/config.php to avoid incompatiblity issues. Thank you.'); } elseif (isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) { // Then load it loadIncludeOnce(getConfig('CACHE_PATH') . 'config-local.php'); @@ -89,10 +89,10 @@ if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isInstallation outputHtml('{--MAILER_WARNING--}:'); if (isInstalled()) { // You have changed my configuration file! - app_die(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}'); + debug_report_bug(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}'); } else { // Please run the installation script (maybe again) - app_die(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}'); + debug_report_bug(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}'); } } elseif ((!isInstalling()) && (!isInstallationPhase()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) { // No database password entered!!! diff --git a/inc/loader/load_cache-modules.php b/inc/loader/load_cache-modules.php index 4875790656..be0d09f630 100644 --- a/inc/loader/load_cache-modules.php +++ b/inc/loader/load_cache-modules.php @@ -56,7 +56,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i // Do only process valid arrays if (!isset($modArray['module'])) { // We should fix this! - debug_report_bug('modArray=
'.print_r($modArray, true).'
'); + debug_report_bug(__FILE__, __LINE__, 'modArray=
'.print_r($modArray, true).'
'); } // END - if // Rewrite some parts diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 2f9bd54d5a..e63b021236 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -861,7 +861,7 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti } // END - if } elseif (isset($content[$column])) { // Unfinished! - app_die(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}"); + debug_report_bug(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}"); } } // END - foreach @@ -1201,7 +1201,7 @@ function adminUpdateTaskData ($id, $row, $data) { // Is the id not set, then we need a backtrace here... :( if ($id <= 0) { // Initiate backtrace - debug_report_bug(sprintf("id is invalid: %s. row=%s, data=%s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("id is invalid: %s. row=%s, data=%s", $id, $row, $data diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 360550d5b9..9685c51acd 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -261,7 +261,7 @@ LIMIT 1", $taskData['text'] .= getExtensionNotes(); } else { // This should not normally happen! - debug_report_bug('ext_name(' . $ext_name . ') or ext_ver(' . $ext_ver . ') is empty! sql_patches=' . getExtensionVersion('sql_patches') . '/verbose_sql=' . getConfig('verbose_sql')); + debug_report_bug(__FILE__, __LINE__, 'ext_name(' . $ext_name . ') or ext_ver(' . $ext_ver . ') is empty! sql_patches=' . getExtensionVersion('sql_patches') . '/verbose_sql=' . getConfig('verbose_sql')); } // Prepare array for the template @@ -421,7 +421,7 @@ LIMIT 1", } } else { // Unknown action - debug_report_bug(sprintf("Unknown task action performed. data=
%s
", print_r($postData, true))); + debug_report_bug(__FILE__, __LINE__, sprintf("Unknown task action performed. data=
%s
", print_r($postData, true))); } // Update query diff --git a/inc/modules/admin/what-add_guestnl_cat.php b/inc/modules/admin/what-add_guestnl_cat.php index a0f9287d57..cf56d8a3d3 100644 --- a/inc/modules/admin/what-add_guestnl_cat.php +++ b/inc/modules/admin/what-add_guestnl_cat.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); if (isFormSent()) { // @TODO Check if category does already exist - debug_report_bug('Unfinished area!'); + debug_report_bug(__FILE__, __LINE__, 'Unfinished area!'); } else { // Display form loadTemplate('admin_add_guestnl_cat'); diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 8d6a01fba2..9a2541368f 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -72,7 +72,7 @@ if (isGetRequestParameterSet(('pid'))) { // Load user's data if (!fetchUserData($userid)) { // Abort here because it is not valid! - debug_report_bug('No user account ' . $userid . ' found.'); + debug_report_bug(__FILE__, __LINE__, 'No user account ' . $userid . ' found.'); } // END - if if ((getRequestParameter('do') == 'accept') && (!empty(getUserData('email')))) { diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 5d5a3cd547..206b4777e5 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -126,7 +126,7 @@ ORDER BY } // END - foreach } else { // Unknown action performed - debug_report_bug(sprintf("Unknown task action performed. data=
%s
", print_r(postRequestArray(), true))); + debug_report_bug(__FILE__, __LINE__, sprintf("Unknown task action performed. data=
%s
", print_r(postRequestArray(), true))); } // Update query diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index 75bf5075bf..166f2b8a5b 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -65,7 +65,7 @@ if (isGetRequestParameterSet('hash')) { // Fetch user data if (!fetchUserData($userid)) { // Not found, should not happen - debug_report_bug('User account ' . $userid . ' not found.'); + debug_report_bug(__FILE__, __LINE__, 'User account ' . $userid . ' not found.'); } // END - if // Load all data and add points diff --git a/inc/modules/guest/what-stats.php b/inc/modules/guest/what-stats.php index 9fe4fc7148..aadc78d976 100644 --- a/inc/modules/guest/what-stats.php +++ b/inc/modules/guest/what-stats.php @@ -66,7 +66,7 @@ switch (getRequestParameter('mode')) { default: // Unsupported mode - debug_report_bug(sprintf("Unsupported mode %s detected.", secureString(getRequestParameter('mode')))); + debug_report_bug(__FILE__, __LINE__, sprintf("Unsupported mode %s detected.", secureString(getRequestParameter('mode')))); break; } diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 2f4528168c..c74bf46c3c 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -631,7 +631,7 @@ function fetchUserData ($userid, $column = 'userid') { // Don't look for invalid userids... if ($userid < 1) { // Invalid, so abort here - debug_report_bug('User id ' . $userid . ' is invalid.'); + debug_report_bug(__FUNCTION__, __LINE__, 'User id ' . $userid . ' is invalid.'); } elseif (isUserDataValid()) { // Use cache, so it is fine return true; @@ -796,7 +796,7 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { $OUT = loadTemplate(($mode . '_receive_table'), true, $OUT); } else { // Maybe the admin has to setup some maximum values? - debug_report_bug('Nothing is being done here?'); + debug_report_bug(__FUNCTION__, __LINE__, 'Nothing is being done here?'); } // Free result @@ -1562,7 +1562,7 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher } // END - foreach } else { // Problem in request - debug_report_bug('Not all are arrays: id[' . count($id) . ']=' . gettype($id) . ',name[' . count($name) . ']=' . gettype($name)); + debug_report_bug(__FUNCTION__, __LINE__, 'Not all are arrays: id[' . count($id) . ']=' . gettype($id) . ',name[' . count($name) . ']=' . gettype($name)); } } else { // Data from database diff --git a/inc/revision-functions.php b/inc/revision-functions.php index 0058a5bb33..2b4b74702a 100644 --- a/inc/revision-functions.php +++ b/inc/revision-functions.php @@ -212,7 +212,7 @@ function getArrayFromActualVersion () { // Invalid request reply? if (!isset($version[11])) { // Cannot continue here - debug_report_bug('Invalid response from check-updates3.php, count should be 10+, is ' . count($version)); + debug_report_bug(__FUNCTION__, __LINE__, 'Invalid response from check-updates3.php, count should be 10+, is ' . count($version)); } // END - if // Prepare content diff --git a/inc/stylesheet.php b/inc/stylesheet.php index 12838b3b33..ebe08b6e9b 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -78,7 +78,7 @@ if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) { break; default: // Invalid mode! - debug_report_bug(sprintf("Invalid css_php value %s detected.", getConfig('css_php'))); + debug_report_bug(__FILE__, __LINE__, sprintf("Invalid css_php value %s detected.", getConfig('css_php'))); break; } // END - switch } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 6e8cb2e97b..dbd6e713f4 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -92,7 +92,7 @@ function writeToFile ($FQFN, $content, $aquireLock = false) { } } else { // Write it with fopen - $fp = fopen($FQFN, 'w') or app_die(__FUNCTION__, __LINE__, "Cannot write file ".basename($FQFN).'!'); + $fp = fopen($FQFN, 'w') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($FQFN) . '!'); // Aquire lock if ($aquireLock === true) flock($fp, LOCK_EX); @@ -154,10 +154,10 @@ function merge_array ($array1, $array2) { debug_report_bug(__FUNCTION__ . ': No arrays provided!'); } elseif (!is_array($array1)) { // Left one is not an array - debug_report_bug(sprintf("[%s:%s] array1 is not an array. array != %s", __FUNCTION__, __LINE__, gettype($array1))); + debug_report_bug(__FILE__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1))); } elseif (!is_array($array2)) { // Right one is not an array - debug_report_bug(sprintf("[%s:%s] array2 is not an array. array != %s", __FUNCTION__, __LINE__, gettype($array2))); + debug_report_bug(__FILE__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2))); } // Merge all together @@ -393,19 +393,19 @@ function copyFileVerified ($source, $dest, $chmod = '') { // Is the source file there? if (!isFileReadable($source)) { // Then abort here - debug_report_bug('Cannot read from source file ' . basename($source) . '.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read from source file ' . basename($source) . '.'); } // END - if // Is the target directory there? if (!isDirectory(dirname($dest))) { // Then abort here - debug_report_bug('Cannot find directory ' . str_replace(getConfig('PATH'), '', dirname($dest)) . '.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot find directory ' . str_replace(getConfig('PATH'), '', dirname($dest)) . '.'); } // END - if // Now try to copy it if (!copy($source, $dest)) { // Something went wrong - debug_report_bug('copy() has failed to copy the file.'); + debug_report_bug(__FUNCTION__, __LINE__, 'copy() has failed to copy the file.'); } else { // Reset cache $GLOBALS['file_readable'][$dest] = true; @@ -437,7 +437,7 @@ function flushHeaders () { // Is the header already sent? if (headers_sent()) { // Then abort here - debug_report_bug('Headers already sent!'); + debug_report_bug(__FUNCTION__, __LINE__, 'Headers already sent!'); } // END - if // Flush all headers if found @@ -457,7 +457,7 @@ function changeMode ($FQFN, $mode) { // Is the file/directory there? if ((!isFileReadable($FQFN)) && (!isDirectory($FQFN))) { // Neither, so abort here - debug_report_bug('Cannot chmod() on ' . basename($FQFN) . '.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cannot chmod() on ' . basename($FQFN) . '.'); } // END - if // Try to set them @@ -555,7 +555,7 @@ function isWhatSet ($strict = false) { // Should we abort here? if (($strict === true) && ($isset === false)) { // Output backtrace - debug_report_bug('what is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'what is empty.'); } // END - if // Return it @@ -590,7 +590,7 @@ function isActionSet ($strict = false) { // Should we abort here? if (($strict === true) && ($isset === false)) { // Output backtrace - debug_report_bug('action is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'action is empty.'); } // END - if // Return it @@ -626,7 +626,7 @@ function isModuleSet ($strict = false) { // Should we abort here? if (($strict === true) && ($isset === false)) { // Output backtrace - debug_report_bug('module is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'module is empty.'); } // END - if // Return it @@ -661,7 +661,7 @@ function isOutputModeSet ($strict = false) { // Should we abort here? if (($strict === true) && ($isset === false)) { // Output backtrace - debug_report_bug('output_mode is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'output_mode is empty.'); } // END - if // Return it @@ -807,7 +807,7 @@ function isAdminHashSet ($admin) { * 14.:js.php:57, require(1) */ if (!isset($GLOBALS['cache_array']['admin'])) { - debug_report_bug('Cache not set.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cache not set.'); } // END - if // Check for admin hash @@ -885,7 +885,7 @@ function getCurrentUserId () { // Userid must be set before it can be used if (!isCurrentUserIdSet()) { // Not set - debug_report_bug('User id is not set.'); + debug_report_bug(__FUNCTION__, __LINE__, 'User id is not set.'); } // END - if // Return the userid diff --git a/mailid.php b/mailid.php index 06acf208ca..79e308753b 100644 --- a/mailid.php +++ b/mailid.php @@ -110,7 +110,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Invalid mail type - debug_report_bug('Invalid mail type ' . $ltype . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Invalid mail type ' . $ltype . ' detected.'); break; } // END - switch @@ -162,7 +162,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Invalid mail type - debug_report_bug('Invalid mail type ' . $ltype . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Invalid mail type ' . $ltype . ' detected.'); break; } diff --git a/mailid_top.php b/mailid_top.php index 29a08b5f24..ec0417eafc 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -110,7 +110,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Unknown type - debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.'); break; } @@ -166,7 +166,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Unknown type - debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.'); break; } @@ -214,7 +214,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Unknown type - debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.'); break; } // END - switch @@ -328,7 +328,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe loadTemplate($templ, false, $content); } else { // Cannot confirm! - debug_report_bug('No code given.'); + debug_report_bug(__FILE__, __LINE__, 'No code given.'); } break; @@ -348,7 +348,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe break; default: // Unknown mode - debug_report_bug('Unknown mode ' . $mode . ' detected.'); + debug_report_bug(__FILE__, __LINE__, 'Unknown mode ' . $mode . ' detected.'); break; } // END - switch } else { -- 2.30.2