From: Roland Häder Date: Mon, 11 Jul 2011 18:52:30 +0000 (+0000) Subject: Several code cleanups: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=98e44adab9035e30efe78181b76d78c6e13ba574 Several code cleanups: - Debug lines rewritten to use logDebugMessage() instead of plain print() - Several calls of addFatalMessage() rewritten to debug_report_bug() - $data in all filters renamed to $filterData - Message id cleanup - Other minor fixes/improvements - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index d17cf67b65..4e633e8469 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -55,9 +55,9 @@ ./inc/functions.php:2200: // @TODO Rename column data_type to e.g. mail_status ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); -./inc/language/de.php:1073: // @TODO Rewrite these two constants -./inc/language/de.php:1089: // @TODO Rewrite these three constants -./inc/language/de.php:763:// @TODO Are these constants longer used? +./inc/language/de.php:1068: // @TODO Rewrite these two constants +./inc/language/de.php:1084: // @TODO Rewrite these three constants +./inc/language/de.php:760:// @TODO Are these constants longer used? ./inc/language-functions.php:255: // @TODO These are all valid languages, again hard-coded ./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function. ./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no * @@ -80,10 +80,10 @@ ./inc/libs/register_functions.php:367: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable ./inc/libs/sponsor_functions.php:159: // @TODO Rewrite this to API function ./inc/libs/sponsor_functions.php:430: // @TODO Rewrite this to API function -./inc/libs/surfbar_functions.php:1000: // @TODO Invalid salt should be refused -./inc/libs/surfbar_functions.php:1081: // @TODO Try to rewrite the following unset() -./inc/libs/surfbar_functions.php:1596: // @TODO This can be somehow rewritten -./inc/libs/surfbar_functions.php:711:// @TODO Can't we use our new expression language instead of this ugly code? +./inc/libs/surfbar_functions.php:1018: // @TODO Invalid salt should be refused +./inc/libs/surfbar_functions.php:1099: // @TODO Try to rewrite the following unset() +./inc/libs/surfbar_functions.php:1614: // @TODO This can be somehow rewritten +./inc/libs/surfbar_functions.php:729:// @TODO Can't we use our new expression language instead of this ugly code? ./inc/libs/task_functions.php:247: // @TODO These can be rewritten to filter ./inc/libs/task_functions.php:51:// @TODO Move all extension-dependent queries into filters ./inc/libs/theme_functions.php:93: // @TODO Can't this be rewritten to an API function? @@ -192,8 +192,8 @@ ./inc/template-functions.php:1077: // @TODO Deprecate this thing ./inc/template-functions.php:1170: // @TODO This can be easily moved out after the merge from EL branch to this is complete ./inc/template-functions.php:1203: // @TODO Add a little more infos here -./inc/template-functions.php:1514:// @TODO Lame description for this function -./inc/template-functions.php:1536: // @TODO Move this in a filter +./inc/template-functions.php:1517:// @TODO Lame description for this function +./inc/template-functions.php:1539: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy ./inc/template-functions.php:266: // @TODO Remove this sanity-check if all is fine ./inc/template-functions.php:594:// @TODO $simple/$constants are deprecated diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 05e488a615..acf69a5410 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -125,7 +125,7 @@ class CacheSystem { $this->writeLine('' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problems with cache directory detected, getStatusCode()=' . $this->getStatusCode()); } } @@ -226,7 +226,7 @@ class CacheSystem { } // END - foreach } else { // Cannot create file - addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problem with cache detected, no resource! pointer[]=' . gettype($this->pointer)); } } @@ -251,7 +251,7 @@ class CacheSystem { // Remove pointer and status unset($this->status[$this->name]); $this->pointer = false; - //* DEBUG: */ debugOutput(__METHOD__ . '(' . __LINE__.'): '.$this->name.' - FINALIZED!'); + //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, 'name=' . $this->name . ' - FINALIZED!'); } // END - if } @@ -377,7 +377,7 @@ class CacheSystem { } // END - if } else { // Cannot write to cache! - addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problem with cache detected: Unexpected status ' . $this->status[$this->name]); } } @@ -401,7 +401,7 @@ class CacheSystem { } // END - foreach } else { // Cannot write array! - addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problem with cache detected: pointer is not resource! pointer[]=' . gettype($this->pointer)); } } @@ -438,7 +438,7 @@ class CacheSystem { } // END - if } else { // Cannot write to cache! - addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problem with cache detected: Unexpected status ' . $this->status[$this->name]); } } @@ -457,10 +457,10 @@ class CacheSystem { // Write cache line to file $this->writeLine($this->rewriteEntry($ext_name, $ext_ver, 'version', true)); } // END - if - //* DEBUG: */ debugOutput(__METHOD__ . '(' . __LINE__ . '): '.$this->name.' - '.$ext_name.'='.$ext_ver); + //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, 'name=' . $this->name . ',ext_name=' . $ext_name . ',ext_ver=' . $ext_ver); } else { // Cannot create file - addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); + debug_report_bug(__METHOD__, __LINE__, 'Problem with cache detected: pointer is not resource! pointer[]=' . gettype($this->pointer)); } } diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 03f3079edc..975cefd78d 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -216,7 +216,7 @@ function SQL_RESULT ($resource, $row, $field = '0') { // SQL connect function SQL_CONNECT ($host, $login, $password, $F, $L) { // Try to connect - $linkResource = mysql_connect($host, $login, $password) or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error()); + $linkResource = mysql_connect($host, $login, $password) or debug_report_bug(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error()); // Set the link resource SQL_SET_LINK($linkResource); @@ -228,7 +228,7 @@ function SQL_SELECT_DB ($dbName, $F, $L) { if (!SQL_IS_LINK_UP()) return false; // Return the result - return mysql_select_db($dbName, SQL_GET_LINK()) or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error()); + return mysql_select_db($dbName, SQL_GET_LINK()) or debug_report_bug(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error()); } // SQL close link @@ -239,8 +239,7 @@ function SQL_CLOSE ($F, $L) { } // END - if // Close database link and forget the link - $close = mysql_close(SQL_GET_LINK()) - or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):'.mysql_error()); + $close = mysql_close(SQL_GET_LINK()) or debug_report_bug(__FUNCTION__, __LINE__, $F . ' (' . $L . '):'.mysql_error()); // Close link SQL_SET_LINK(null); diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index acd902dd78..d1c46faf42 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -1349,19 +1349,19 @@ function initExtensionRuningUpdates () { // Getter for EXT_UPDATE_DEPENDS flag function getExtensionUpdateDependencies () { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); return $GLOBALS['ext_update_depends'][getCurrentExtensionName()]; } // Getter for next iterator depency function getExtensionUpdateDependenciesIterator () { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); return ($GLOBALS['ext_update_depends'][getCurrentExtensionName()][getExtensionUpdateIterator()]); } // Counter for extension update depencies function countExtensionUpdateDependencies () { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); return count($GLOBALS['ext_update_depends'][getCurrentExtensionName()]); } @@ -1382,7 +1382,7 @@ function removeExtensionDependency ($ext_name) { // Init iterator for update depencies function initExtensionUpdateIterator () { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()] = '0'; } @@ -1392,13 +1392,13 @@ function getExtensionUpdateIterator () { if (!isset($GLOBALS['ext_depend_iterator'][getCurrentExtensionName()])) initExtensionUpdateIterator(); // Return it - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().'/'.$GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName().'/'.$GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]); return $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]; } // Increments the update iterator function incrementExtensionUpdateIterator () { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]++; } diff --git a/inc/filter/active_filter.php b/inc/filter/active_filter.php index 7a7c1b248b..02f058572b 100644 --- a/inc/filter/active_filter.php +++ b/inc/filter/active_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for adding link to "active list" -function FILTER_ADD_LINK_ACTIVE_LIST ($data) { +function FILTER_ADD_LINK_ACTIVE_LIST ($filterData) { // Is ext-active/online there? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((isExtensionActive('active')) && (isExtensionActive('online'))) { @@ -59,7 +59,7 @@ function FILTER_ADD_LINK_ACTIVE_LIST ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/admins_filter.php b/inc/filter/admins_filter.php index 677f1d295b..d38acb9af7 100644 --- a/inc/filter/admins_filter.php +++ b/inc/filter/admins_filter.php @@ -55,14 +55,14 @@ function FILTER_ADD_EXTRA_SQL_DATA ($add = '') { } // Reset the login failures -function FILTER_RESET_ADMINS_LOGIN_FAILURES ($data) { +function FILTER_RESET_ADMINS_LOGIN_FAILURES ($filterData) { // Store it in session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - setSession('mailer_admin_failures' , getAdminLoginFailures($data['id'])); - setSession('mailer_admin_last_failure', getAdminLastFailure($data['id'])); + setSession('mailer_admin_failures' , getAdminLoginFailures($filterData['id'])); + setSession('mailer_admin_last_failure', getAdminLastFailure($filterData['id'])); // Prepare update data - $postData['login'][getCurrentAdminId()] = $data['login']; + $postData['login'][getCurrentAdminId()] = $filterData['login']; $postData['login_failures'][getCurrentAdminId()] = '0'; $postData['last_failure'][getCurrentAdminId()] = null; @@ -74,14 +74,14 @@ function FILTER_RESET_ADMINS_LOGIN_FAILURES ($data) { // Return the data for further processing //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Count the login failure -function FILTER_COUNT_ADMINS_LOGIN_FAILURE ($data) { +function FILTER_COUNT_ADMINS_LOGIN_FAILURE ($filterData) { // Prepare update data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $postData['login'][getCurrentAdminId()] = $data['login']; + $postData['login'][getCurrentAdminId()] = $filterData['login']; $postData['login_failures'][getCurrentAdminId()] = '`login_failures`+1'; $postData['last_failure'][getCurrentAdminId()] = 'NOW()'; @@ -93,17 +93,17 @@ function FILTER_COUNT_ADMINS_LOGIN_FAILURE ($data) { // Return the data for further processing //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Rehashes the given plain admin password and stores it the database -function FILTER_REHASH_ADMINS_PASSWORD ($data) { +function FILTER_REHASH_ADMINS_PASSWORD ($filterData) { // Generate new hash //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $newHash = generateHash($data['plain_pass']); + $newHash = generateHash($filterData['plain_pass']); // Prepare update data - $postData['login'][getCurrentAdminId()] = $data['login']; + $postData['login'][getCurrentAdminId()] = $filterData['login']; $postData['password'][getCurrentAdminId()] = $newHash; // Change it in the admin @@ -111,14 +111,14 @@ function FILTER_REHASH_ADMINS_PASSWORD ($data) { // Update cookie/session and data array setAdminMd5(encodeHashForCookie($newHash)); - $data['pass_hash'] = $newHash; + $filterData['pass_hash'] = $newHash; // Always make sure the cache is destroyed rebuildCache('admin'); // Return the data for further processing //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/bonus_filter.php b/inc/filter/bonus_filter.php index d4cf091b80..33c1290338 100644 --- a/inc/filter/bonus_filter.php +++ b/inc/filter/bonus_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for adding login bonus to the user's account -function FILTER_ADD_LOGIN_BONUS ($data) { +function FILTER_ADD_LOGIN_BONUS ($filterData) { // Is the user data valid? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isMember()) { @@ -81,19 +81,21 @@ LIMIT 1', // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Filter for generating admin mail links for bonus mails -function FILTER_GENERATE_BONUS_MAIL_LINKS ($data) { +function FILTER_GENERATE_BONUS_MAIL_LINKS ($filterData) { // Is the type 'bid'? - if ($data['type'] == 'bid') { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + if ($filterData['type'] == 'bid') { // Load template - $data['__output'] .= loadTemplate('admin_links_bonus_mail', true, $data); + $filterData['__output'] .= loadTemplate('admin_links_bonus_mail', true, $filterData); } // END - if // Return data - return $data; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; } // [EOF] diff --git a/inc/filter/booking_filter.php b/inc/filter/booking_filter.php index 1b88ed5f16..75e564c628 100644 --- a/inc/filter/booking_filter.php +++ b/inc/filter/booking_filter.php @@ -41,14 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Filter for adding booking record -function FILTER_ADD_BOOKING_RECORD ($data) { +function FILTER_ADD_BOOKING_RECORD ($filterData) { // Add a record //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - addBookingRecord($data['subject'], $data['userid'], $data['points'], $data['mode']); + addBookingRecord($filterData['subject'], $filterData['userid'], $filterData['points'], $filterData['mode']); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/cache_filter.php b/inc/filter/cache_filter.php index 704d3e8f3c..c2facdbf99 100644 --- a/inc/filter/cache_filter.php +++ b/inc/filter/cache_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Destroy the cache on extension changes -function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) { +function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($filterData) { // Return the data anyway if there is no cache extension //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isCacheInstanceValid()) { @@ -57,11 +57,11 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) { // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Destroy the cache on changing admin -function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($data) { +function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isCacheInstanceValid()) { @@ -75,11 +75,11 @@ function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($data) { // Return the data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Destroy all cache files -function FILTER_CACHE_DESTROY_ALL ($data) { +function FILTER_CACHE_DESTROY_ALL ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isCacheInstanceValid()) { @@ -97,11 +97,11 @@ function FILTER_CACHE_DESTROY_ALL ($data) { } // END - foreach //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Filter for purging 'filter' cache -function FILTER_CACHE_DESTROY_FILTER ($data) { +function FILTER_CACHE_DESTROY_FILTER ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((!isCacheInstanceValid()) || ((isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') != 'Y'))) { @@ -114,7 +114,7 @@ function FILTER_CACHE_DESTROY_FILTER ($data) { } // END - if //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/coupon_filter.php b/inc/filter/coupon_filter.php index 098c83ec8f..4aa7b8e82f 100644 --- a/inc/filter/coupon_filter.php +++ b/inc/filter/coupon_filter.php @@ -41,14 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Filter to change column name for the right "points account" -function FILTER_COUPON_CHANGE_POINTS_COLUMN_NAME ($data) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); +function FILTER_COUPON_CHANGE_POINTS_COLUMN_NAME ($filterData) { // Get the column name from extension's name and 'locked' - $data['column'] = getPointsColumnNameFromExtensionNameLocked('coupon', $data['locked']); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + $filterData['column'] = getPointsColumnNameFromExtensionNameLocked('coupon', $filterData['locked']); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/mediadata_filter.php b/inc/filter/mediadata_filter.php index 54bc2c710e..4b28c25e3a 100644 --- a/inc/filter/mediadata_filter.php +++ b/inc/filter/mediadata_filter.php @@ -41,14 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Filter for updating media data -function FILTER_UPDATE_MEDIADATA_ENTRY ($data) { +function FILTER_UPDATE_MEDIADATA_ENTRY ($filterData) { // Execute the filter function //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $data['added'] = ($data['added'] === true && updateMediadataEntry(array('total_points'), $data['mode'], $data['points'])); + $filterData['added'] = ($filterData['added'] === true && updateMediadataEntry(array('total_points'), $filterData['mode'], $filterData['points'])); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/online_filter.php b/inc/filter/online_filter.php index 869e89f444..e438cc3651 100644 --- a/inc/filter/online_filter.php +++ b/inc/filter/online_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for updates/extends on the online list -function FILTER_UPDATE_ONLINE_LIST ($data) { +function FILTER_UPDATE_ONLINE_LIST ($filterData) { // Do not update online list when extension is deactivated //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isExtensionActive('online', true)) { @@ -124,7 +124,7 @@ LIMIT 1", // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/order_filter.php b/inc/filter/order_filter.php index 87e17902ea..1e508f73a5 100644 --- a/inc/filter/order_filter.php +++ b/inc/filter/order_filter.php @@ -41,15 +41,17 @@ if (!defined('__SECURITY')) { } // END - if // Filter for returning given user's order points -function FILTER_ORDER_POINTS ($data) { +function FILTER_ORDER_POINTS ($filterData) { // Is ext-user installed and active? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (isExtensionActive('user')) { // Get the points and add them to the existing - $data['points'] += countSumTotalData($data['userid'], 'user_points', 'order_points'); + $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'order_points'); } // END - if // Return the data for next filter - return $data; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; } // [EOF] diff --git a/inc/filter/other_filter.php b/inc/filter/other_filter.php index 029483e975..4bed3d6c86 100644 --- a/inc/filter/other_filter.php +++ b/inc/filter/other_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for debugging SQLs -function FILTER_DISPLAY_DEBUG_SQL ($data) { +function FILTER_DISPLAY_DEBUG_SQL ($filterData) { // Shall we display SQL queries? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((isAdmin()) && (isDisplayDebugSqlEnabled()) && (!isGetRequestParameterSet('frame')) && ($GLOBALS['header_sent'] == 2)) { @@ -51,7 +51,7 @@ function FILTER_DISPLAY_DEBUG_SQL ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/politician_stop_filter.php b/inc/filter/politician_stop_filter.php index 56ed51f167..c657bdba49 100644 --- a/inc/filter/politician_stop_filter.php +++ b/inc/filter/politician_stop_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for displaying politician_stop snippet -function FILTER_DISPLAY_POLITICIAN_STOP_SNIPPET ($data) { +function FILTER_DISPLAY_POLITICIAN_STOP_SNIPPET ($filterData) { // Shall we include the politician_stop snippet? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((!isGetRequestParameterSet('frame')) && (isExtensionActive('politician_stop')) && (getModule() != 'admin') && ($GLOBALS['header_sent'] == 2)) { @@ -51,7 +51,7 @@ function FILTER_DISPLAY_POLITICIAN_STOP_SNIPPET ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/rallye_filter.php b/inc/filter/rallye_filter.php index 5e7d925e6c..eddeca486d 100644 --- a/inc/filter/rallye_filter.php +++ b/inc/filter/rallye_filter.php @@ -41,14 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Filter for extra-autpurge -function FILTER_RALLYE_EXTRA_AUTOPURGE ($data) { +function FILTER_RALLYE_EXTRA_AUTOPURGE ($filterData) { // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!) //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); purgeExpiredReferalRallyes(); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/removeip_filter.php b/inc/filter/removeip_filter.php index 850038abb6..35dd8d9080 100644 --- a/inc/filter/removeip_filter.php +++ b/inc/filter/removeip_filter.php @@ -41,13 +41,13 @@ if (!defined('__SECURITY')) { } // END - if // Filter for adding anonymity notice to the output stream -function FILTER_ADD_ANONYMITY_NOTICE ($data) { +function FILTER_ADD_ANONYMITY_NOTICE ($filterData) { // Init content //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $content = $data; + $content = $filterData; // Extension removeip activated? - if ((isExtensionActive('removeip')) && (getConfig('removeip_' . strtolower($data['access_level']) . '_show') == 'Y')) { + if ((isExtensionActive('removeip')) && (getConfig('removeip_' . strtolower($filterData['access_level']) . '_show') == 'Y')) { // Add anoymity/privacy infos $content['content'] .= addAnonymityLevel() . "
\n"; } // END - if diff --git a/inc/filter/surfbar_filter.php b/inc/filter/surfbar_filter.php index 0bd4beb262..e0470d3f0a 100644 --- a/inc/filter/surfbar_filter.php +++ b/inc/filter/surfbar_filter.php @@ -43,6 +43,7 @@ if (!defined('__SECURITY')) { // Filter for changing URL status function FILTER_SURFBAR_CHANGE_URL_STATUS ($filterData) { // Prepare content for notification routines + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); $filterData['data'][$filterData['url_id']]['url_userid'] = $filterData['data'][$filterData['url_id']]['url_userid']; $filterData['data'][$filterData['url_id']]['frametester'] = '{%pipe,generateFrametesterUrl=' . $filterData['data'][$filterData['url_id']]['url'] . '%}'; $filterData['data'][$filterData['url_id']]['reward'] = '{%config,translateComma=surfbar_static_reward%}'; @@ -61,23 +62,26 @@ function FILTER_SURFBAR_CHANGE_URL_STATUS ($filterData) { SURFBAR_NOTIFY_USER('url_' . strtolower($filterData['data'][$filterData['url_id']]['url_status']) . '_' . $filterData['new_status'], $filterData['data'][$filterData['url_id']]); // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } // Filter for validating status function FILTER_SURFBAR_CHANGE_URL_VALIDATE_DATA ($filterData) { // Is the new status set? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((!is_string($filterData['new_status'])) || (empty($filterData['new_status']))) { // Abort here, but fine! - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newStatus[' . gettype($filterData['new_status']) . ']=' . $filterData['new_status'] . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newStatus[' . gettype($filterData['new_status']) . ']=' . $filterData['new_status'] . ' - EXIT!'); $filterData['abort'] = true; - } elseif ($data[$urlId]['url_status'] != $filterData['prev_status']) { + } elseif ($filterData[$urlId]['url_status'] != $filterData['prev_status']) { // Status is not like prevStatus - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $data[$urlId]['url_status'] . '!=' . $filterData['prev_status'] . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterData[$urlId]['url_status'] . '!=' . $filterData['prev_status'] . ' - EXIT!'); $filterData['abort'] = false; } // END - if // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } diff --git a/inc/filter/theme_filter.php b/inc/filter/theme_filter.php index d969424337..4c8de5c308 100644 --- a/inc/filter/theme_filter.php +++ b/inc/filter/theme_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for generic handling of theme change -function FILTER_HANDLE_THEME_CHANGE ($data) { +function FILTER_HANDLE_THEME_CHANGE ($filterData) { // Check if new theme is selcted //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((isPostRequestParameterSet('new_theme')) && (postRequestParameter('new_theme') != getCurrentTheme())) { @@ -63,12 +63,13 @@ function FILTER_HANDLE_THEME_CHANGE ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // Filter for settings theme from user profile, must be executed only if FILTER_FETCH_USER_DATA() ran before -function FILTER_SET_USERS_THEME ($data) { +function FILTER_SET_USERS_THEME ($filterData) { // Is the user data valid? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (!isMember()) { // Do only run for logged in members debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); @@ -79,7 +80,7 @@ function FILTER_SET_USERS_THEME ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/timezone_filter.php b/inc/filter/timezone_filter.php index aa4268ea1a..699e4ce16b 100644 --- a/inc/filter/timezone_filter.php +++ b/inc/filter/timezone_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for setting the timezone -function FILTER_INIT_TIMEZONE ($data) { +function FILTER_INIT_TIMEZONE ($filterData) { // Just set it if the required function is there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if (function_exists('date_default_timezone_set')) { @@ -51,7 +51,7 @@ function FILTER_INIT_TIMEZONE ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/uberwach_filter.php b/inc/filter/uberwach_filter.php index faa0fe1658..cf733222e5 100644 --- a/inc/filter/uberwach_filter.php +++ b/inc/filter/uberwach_filter.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Filter for displaying uberwach snippet -function FILTER_DISPLAY_UBERWACH_SNIPPET ($data) { +function FILTER_DISPLAY_UBERWACH_SNIPPET ($filterData) { // Shall we include the uberwach snippet? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); if ((!isGetRequestParameterSet('frame')) && (isExtensionActive('uberwach')) && (getModule() != 'admin') && ($GLOBALS['header_sent'] == 2)) { @@ -51,7 +51,7 @@ function FILTER_DISPLAY_UBERWACH_SNIPPET ($data) { // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $data; + return $filterData; } // [EOF] diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index d0b8cdc5c4..71920260f0 100644 --- a/inc/filter/user_filter.php +++ b/inc/filter/user_filter.php @@ -41,12 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Filter for returning given user's points -function FILTER_USER_POINTS ($data) { +function FILTER_USER_POINTS ($filterData) { // Get the points and add them to the existing - $data['points'] += countSumTotalData($content['userid'], 'user_points', 'points'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + $filterData['points'] += countSumTotalData($content['userid'], 'user_points', 'points'); // Return the data for next filter - return $data; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; } // [EOF] diff --git a/inc/filters.php b/inc/filters.php index c6c27638b7..5a52b5e742 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -54,7 +54,7 @@ function FILTER_FLUSH_FILTERS () { // Is a database link here and not in installation mode? if ((!SQL_IS_LINK_UP()) && (!isInstalling())) { // Abort here - addFatalMessage(__FUNCTION__, __LINE__, '{--FILTER_FLUSH_FAILED_NO_DATABASE--}'); + debug_report_bug(__FUNCTION__, __LINE__, 'No database link is up. Cannot flush filters.'); return false; } // END - if @@ -137,7 +137,7 @@ function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) { $content = $data; // Handle failed logins here if not in guest - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "type=".$data['type'].",action=".getAction().",what=".getWhat().",level=".$data['access_level']."
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $data['type'] . ',action=' . getAction() . ',what=' . getWhat() . ',level=' . $data['access_level']); if ((($data['type'] == 'what') || ($data['type'] == 'action') && ((!isWhatSet()) || (getWhat() == 'overview') || (getWhat() == getIndexHome()))) && ($data['access_level'] != 'guest') && ((isExtensionInstalledAndNewer('sql_patches', '0.4.7')) || (isExtensionInstalledAndNewer('admins', '0.7.6')))) { // Handle failure $content['content'] .= handleLoginFailures($data['access_level']); diff --git a/inc/functions.php b/inc/functions.php index 6c44c5f1ca..bb9301f583 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -105,7 +105,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' // Is the webmaster! $toEmail = getWebmaster(); } - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TO=' . $toEmail); // Check for PHPMailer or debug-mode if ((!checkPhpMailerUsage()) || (isDebugModeEnabled())) { @@ -1569,7 +1569,7 @@ function rebuildCache ($cache, $inc = '', $force = false) { // Is the include there? if (isIncludeReadable($inc)) { // And rebuild it from scratch - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "inc={$inc} - LOADED!
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'inc=' . $inc . ' - LOADED!'); loadInclude($inc); } else { // Include not found @@ -1744,7 +1744,7 @@ function shutdown () { SQL_CLOSE(__FUNCTION__, __LINE__); } elseif (!isInstallationPhase()) { // No database link - addFatalMessage(__FUNCTION__, __LINE__, '{--NO_DB_LINK_SHUTDOWN--}'); + debug_report_bug(__FUNCTION__, __LINE__, 'Database link is already down, while shutdown is running.'); } // Stop executing here @@ -1988,7 +1988,7 @@ function initCacheInstance () { // Did it work? if ($GLOBALS['cache_instance']->getStatusCode() != 'done') { // Failed to initialize cache sustem - addFatalMessage(__FUNCTION__, __LINE__, '(' . __LINE__ . '): {--CACHE_CANNOT_INITIALIZE--}'); + debug_report_bug(__FUNCTION__, __LINE__, 'Cache system returned with unexpected error. getStatusCode()=' . $GLOBALS['cache_instance']->getStatusCode()); } // END - if } diff --git a/inc/install-inc.php b/inc/install-inc.php index 681e7c14aa..18af33b97d 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -200,9 +200,11 @@ if ((!isInstalled()) || (!isAdminRegistered())) { // You have submitted data then we have to reset the SQLs initSqls(); - // Restore PHPs error handler to prevent ours to handle errors, - // e.g. failed connection attempts. We want to handle them on - // our own. + /* + * Restore PHPs error handler to prevent ours to handle errors, + * e.g. failed connection attempts. We want to handle them on + * our own. + */ restore_error_handler(); // Connect to database server @@ -215,7 +217,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) { // Check for dumps if ((!isFileReadable(postRequestParameter('spath') . 'install/tables.sql')) || (!isFileReadable(postRequestParameter('spath') . 'install/menu-'.getLanguage().'.sql'))) { // Installation area not found - addFatalMessage(__FILE__, __LINE__, '{--INSTALL_MISSING_DUMPS--}'); + debug_report_bug(__FILE__, __LINE__, 'SQL dumps not found. Please extract ALL files from the archive or checkout all files out from SVN.'); return; } // END - if diff --git a/inc/language/de.php b/inc/language/de.php index a5d7e6530e..8f0dc5d699 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -145,9 +145,6 @@ addMessages(array( 'ADMIN_MENU_IS_ACTIVE' => "Menüpunkt ist aktiviert", 'ADMIN_CREATE_ACTION_FIRST' => "Bitte erstellen Sie zuerst die action-xxxxx.php Datei. Dann können Sie sie hier auswählen.", 'ADMIN_IS_FIRST_MENU' => "Ist das erste Hauptmenü", - 'NO_DB_LINK' => "Keine Verbindung zur Datenbank.", - 'NO_DB_LINK_SHUTDOWN' => "Keine Verbindung zur Datenbank beim Schliessen der Verbindung.", - 'MYSQL_DATA_MISSING' => "Die Konfiguration Ihrer Datenbankverbindung ist unnvollständig. Bitte in {?CACHE_PATH?}config-local.php mindestens den Hostnamen, Datenbanknamen und Login zur Datenbank eingeben.", 'REGISTER_PERSONAL_DATA' => "Persönliche Daten", 'REGISTER_CATEGORIES' => "Interessengebiete", 'REGISTER_MISC' => "Passwort, maximale Mails pro Tag etc.", @@ -876,8 +873,6 @@ addMessages(array( 'SORT_DESCENDING' => "Absteigend", 'INVALID_EMAIL_ENTERED' => "Ungütige EMail-Adresse eingegeben.", 'NEVER_HAPPENED' => "Nie", - 'WRONG_DB_SELECTED' => "Falsche oder fehlende Datenbank ausgewählt.", - 'NO_CONFIG_FOUND' => "Keine Konfigurationsdaten gefunden! (Leere Datenbank? Oder haben Sie die SQL-Dateien in andere Datenbank eingespielt?)", 'NO_CONFIG_FOUND_TITLE' => "Keine Konfigurationsdaten gefunden.", 'SORTING_KEY' => "Sortierung", 'ADMIN_ADD_REFERAL_BANNER_TITLE' => "Neuen Werbebanner hinzufügen", @@ -1116,7 +1111,6 @@ addMessages(array( 'FILTER_FAILED_ALREADY_ADDED' => "Die Filterfunktion %s ist bereits der Filterkette %s hinzugefügt.", 'FILTER_FAILED_NO_FILTER_FOUND' => "Die Filterkette %s konnte nicht gefunden werden.", 'FILTER_FAILED_NOT_REMOVED' => "Die Filterfunktion %s konnte nicht aus der Filterkette %s entfernt werden, da sie nicht existiert.", - 'FILTER_FLUSH_FAILED_NO_DATABASE' => "Kann die Filterketten nicht speichern. Datenbank fehlt.", // Status changes 'ADMIN_STATUS_CHANGED' => "Es wurden %s von %s Einträgen geändert.", @@ -1126,9 +1120,7 @@ addMessages(array( 'ADMIN_MENU_WHAT_404_TITLE' => "Untermenü '%s' deaktiviert, da keine Scriptdatei auf dem Server gefunden wurde.", // Cache messages - 'CACHE_PROBLEMS_DETECTED' => "Probleme mit dem Cache-Subsystem erkannt.", 'CACHE_CANNOT_LOAD' => "Kann nicht Cache-Datei %s laden.", - 'CACHE_CANNOT_INITIALIZE' => "Konnte das Caching-System nicht initialisieren. Bitte die Dokumentation DOCS/de/cache/README.txt lesen.", 'CACHE_CANNOT_UNLINK' => "Kann nicht die Cache-Datei %s vom Server entfernen.", // Expert settings diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 5c86862ddf..ee670c7e64 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -248,11 +248,6 @@ addMessages(array( 'MEMBER_SURFBAR_ACTION_PAUSE_TITLE' => "Halten Sie die URL in der Surfbar kurz an, wenn sie gerade nicht erreichbar ist. Dies geschieht nicht automatisch.", 'MEMBER_SURFBAR_ACTION_UNPAUSE_TITLE' => "Lassen Sie die URL in der Surfbar weiterlaufen, wenn Sie dies möchten. Wir müssen die URL jedoch erneut freigeben.", - // Internal errors - 'MEMBER_SURFBAR_EXECUTE_ACTION_404' => "Auszuführende Funktion %s nicht gefunden.", - 'ADMIN_SURFBAR_NOTIFY_SUBJECT_404' => "Admin-Betreffzeile %s nicht gefunden.", - 'MEMBER_SURFBAR_NOTIFY_SUBJECT_404' => "Mitglieder-Betreffzeile %s nicht gefunden.", - // Guest texts 'GUEST_SURFBAR_LOGIN_HEADER' => "Login zur Surfbar:", )); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 3414e4fabe..92a13150ae 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -42,7 +42,7 @@ if (!defined('__SECURITY')) { // Payback refback for refid and reduce it for current user function addRefbackPoints ($userid, $ref, $points, $ref_points) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . $ref . ',points=' . $points . ',ref_points=' . $ref_points . ',return=' . $return . ' - ENTERED!'); return $return; } // "Getter" for refback percents function getRefbackPercents ($userid, $ref) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . $ref . ',refback_percents=' . $GLOBALS['refback_percents'][$userid][$ref] . ' - EXIT!'); return $GLOBALS['refback_percents'][$userid][$ref]; } // "Getter" for userid array which will return only one entry function getArrayFromRefbackLevel ($refid, $level) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ',userIds()=' . count($userIds) . ' - EXIT!'); return $userIds; } // Update "refback table" function updateRefbackTable ($userid) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + if (!isset($GLOBALS['refback_refid'][$GLOBALS['refback_level']-1])) { + $GLOBALS['refback_refid'][$GLOBALS['refback_level']-1] = '0'; + } // END - if + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refback_level=' . {$GLOBALS['refback_level'] . ',ref=' . $GLOBALS['refback_refid'][$GLOBALS['refback_level']-1] . ' - EXIT!'); } // "Getter" for array for user refs in given level function getArrayFromRefbackUserRefs ($userid, $level) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refs()=' . count($refs) . ' - EXIT!'); return $refs; } // "Getter" for refback entry function getArrayFromUserRefbackData ($id) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $id . ',data()=' . count($data) . ' - EXIT!'); return $data; } // Update refback percents (but with some sanity-checks! function updateMemberRefbackPercents ($id, $percents) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); + //* logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $id . ',percents=' . $percents . ' - EXIT!'); return $status; } diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index f22ac3899e..fdf5473283 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -49,27 +49,27 @@ function SURFBAR_ADMIN_ADD_URL ($url, $limit, $reload) { // Do some pre-checks if (!isAdmin()) { // Not an admin - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Not admin.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Not admin.", $url, $limit, $reload)); return false; } elseif (!isUrlValid($url)) { // URL invalid - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid URL.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid URL.", $url, $limit, $reload)); return false; } elseif (SURFBAR_LOOKUP_BY_URL($url, 0)) { // URL already found in surfbar! - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Already added.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Already added.", $url, $limit, $reload)); return false; } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) { // No more allowed! - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : No more URLs allowed.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: No more URLs allowed.", $url, $limit, $reload)); return false; } elseif ('' . ($limit + 0) . '' != '' . $limit . '') { // Invalid limit entered - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid limit entered.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid limit entered.", $url, $limit, $reload)); return false; } elseif ('' . ($reload + 0) . '' != '' . $reload . '') { // Invalid amount entered - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid reload entered.", $url, $limit, $reload)); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid reload entered.", $url, $limit, $reload)); return false; } @@ -82,15 +82,19 @@ function SURFBAR_ADMIN_MIGRATE_URL ($url, $userid) { // Do some pre-checks if (!isAdmin()) { // Not an admin + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Not admin, url=' . $url . ',userid=' . $userid); return false; } elseif (!isUrlValid($url)) { // URL invalid + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Invalid URL, url=' . $url . ',userid=' . $userid); return false; } elseif (SURFBAR_LOOKUP_BY_URL($url, $userid)) { // URL already found in surfbar! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Already added, url=' . $url . ',userid=' . $userid); return false; } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($userid)) { // No more allowed! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Maximum exceeded, url=' . $url . ',userid=' . $userid); return false; } @@ -103,12 +107,15 @@ function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) { // Is this an admin or invalid array? if (!isAdmin()) { // Not admin or invalid ids array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin'); return false; } elseif (!is_array($IDs)) { // No array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array'); return false; } elseif (count($IDs) == 0) { // Empty array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty'); return false; } @@ -130,12 +137,15 @@ function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) { // Is this an admin or invalid array? if (!isAdmin()) { // Not admin or invalid ids array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin'); return false; } elseif (!is_array($IDs)) { // No array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array'); return false; } elseif (count($IDs) == 0) { // Empty array + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty'); return false; } @@ -162,18 +172,23 @@ function SURFBAR_MEMBER_ADD_URL ($url, $limit) { // Do some pre-checks if (!isMember()) { // Not a member + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not member'); return false; } elseif ((!isUrlValid($url)) && (!isAdmin())) { // URL invalid + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid, url=' . $url . ',limit=' . $limit); return false; } elseif (SURFBAR_LOOKUP_BY_URL($url, getMemberId())) { // URL already found in surfbar! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Already found, url=' . $url . ',limit=' . $limit); return false; } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getMemberId())) { // No more allowed! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Maximum exceeded, url=' . $url . ',limit=' . $limit); return false; } elseif (''.($limit + 0).'' != ''.$limit.'') { // Invalid amount entered + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid limit, url=' . $url . ',limit=' . $limit); return false; } @@ -219,15 +234,19 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $urlArray) { // Is this a member? if (!isMember()) { // No member! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not member'); return false; } elseif ((!isset($formData['id'])) || (!isset($formData['action']))) { // Important form elements are missing! + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid form data, required field id/action not found'); return false; } elseif (!isset($urlArray[$formData['id']])) { - // id not found in cache + // Id not found in cache + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Field id not found in cache'); return false; } elseif (!SURFBAR_VALIDATE_MEMBER_ACTION_STATUS($formData['action'], $urlArray[$formData['id']]['url_status'])) { // Action not allowed for current URL status + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Action not allowed to perform. action=' . $formData['action'] . ',url_status=' . $urlArray[$formData['id']]['url_status'] . 'id=' . $formData['id']); return false; } @@ -255,8 +274,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $urlArray) { $performed = call_user_func_array($functionName, $urlData); } else { // Log invalid request - logDebugMessage(__FUNCTION__, __LINE__, "action={$formData['action']},id={$formData['id']},function={$functionName}"); - addFatalMessage(__FUNCTION__, __LINE__, "Invalid member action! action=%s,id=%s,function=%s", array($formData['action'], $formData['id'], $functionName)); + debug_report_bug(__FUNCTION__, __LINE__, 'Invalid member action! action=' . $formData['action'] . ',id=' . $formData['id'] . ',function=' . $functionName); } // Return status @@ -408,7 +426,7 @@ function SURFBAR_MEMBER_EXECUTE_ACTION ($action, $urlData) { } // END - if } else { // Not found - addFatalMessage(__FUNCTION__, __LINE__, '{--MEMBER_SURFBAR_EXECUTE_ACTION_404--}', $functionName); + debug_report_bug(__FUNCTION__, __LINE__, 'Callback function ' . $functionName . ' not found.'); } // Return status @@ -904,7 +922,7 @@ LIMIT 1", $total = SURFBAR_GET_TOTAL_URLS(); // Do we have some URLs in lock? Admins can always surf on own URLs! - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userLocks=".SURFBAR_GET_USER_LOCKS().",total={$total}", false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userLocks=' . SURFBAR_GET_USER_LOCKS() . ',total=' . $total); $isFull = ((SURFBAR_GET_USER_LOCKS() == $total) && ($total > 0)); // Return result @@ -1247,12 +1265,12 @@ ORDER BY while ($content = SQL_FETCHARRAY($result)) { // Get total points $points = getTotalPoints($content['url_userid']); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']},points={$points}", false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $content['url_userid'] . ',points=' . $points); // Shall we add this to ignore? if ($points <= $limit) { // Ignore this one! - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']} has depleted points amount!", false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $content['url_userid'] . ' has depleted points amount!'); $userids['url_userid'][$content['url_userid']] = $content['url_userid']; $userids['points'][$content['url_userid']] = $points; $userids['notified'][$content['url_userid']] = $content['notified']; @@ -1263,7 +1281,7 @@ ORDER BY SQL_FREERESULT($result); // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UIDs::count=".count($userids)." (with own userid=".getMemberId().')', false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UIDs::count=' . count($userids) . ' (with own userid=' . getMemberId() . ')'); // Return result return $userids; @@ -1850,7 +1868,7 @@ function SURFBAR_INIT () { // Private getter for data elements function SURFBAR_GET_DATA ($element) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "element={$element}", false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ' - CALLED!'); // Default is null $data = null; @@ -1867,7 +1885,7 @@ function SURFBAR_GET_DATA ($element) { } // Return result - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . $element . ']=[' . gettype($data) . ']' . $data, false); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . $element . ']=[' . gettype($data) . ']' . $data . ' - EXIT!'); return $data; } diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 4307dc6bda..e3e1a739a2 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -295,7 +295,7 @@ function yoomediaTranslateIndex ($type, $index) { $return = $GLOBALS['translation_tables']['yoomedia'][$type][$index]; } else { // Not found - logDebugMessage(__FUNCTION__, __LINE__, "type={$type},index={$index} not found."); + logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',index=' . $index . ' not found'); } // Return value diff --git a/inc/modules/admin/what-list_cats.php b/inc/modules/admin/what-list_cats.php index 2dffa041f5..8ea0db4b69 100644 --- a/inc/modules/admin/what-list_cats.php +++ b/inc/modules/admin/what-list_cats.php @@ -72,7 +72,9 @@ if (isGetRequestParameterSet('userid')) { // Set selection $selection = '{--NO--}'; - if (SQL_NUMROWS($result_user) == 1) $selection = '{--YES--}'; + if (SQL_NUMROWS($result_user) == 1) { + $selection = '{--YES--}'; + } // END - if // Add more elements $content['cnt'] = $count; diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index d10f8b3dc0..818bdc0c06 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -110,15 +110,15 @@ if ((!isInstalling()) && (!isInstallationPhase())) { loadIncludeOnce('inc/load_cache.php'); } else { // Wrong database? - addFatalMessage(__FILE__, __LINE__, '{--WRONG_DB_SELECTED--}'); + debug_report_bug(__FILE__, __LINE__, 'Wrong database selected.'); } } else { // No link to database! - addFatalMessage(__FILE__, __LINE__, '{--NO_DB_LINK--}'); + debug_report_bug(__FILE__, __LINE__, 'Database link is not yet up.'); } } else { // Maybe you forgot to enter your database login? - addFatalMessage(__FILE__, __LINE__, '{--MYSQL_DATA_MISSING--}'); + debug_report_bug(__FILE__, __LINE__, 'Database login is missing.'); } } else { // Default output is 'direct' for HTML output diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 424ac96caf..afed52db34 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1038,10 +1038,10 @@ function getReferalLevelPercents ($level) { * for default value will cause no referal will get points ever!!!) */ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $addMode = 'REFERAL') { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',sendNotify=' . intval($sendNotify) . ',refid=' . $refid . ',addMode=' . $addMode . ' - ENTERED!'); // By default nothing has been added $added = false; - //* DEBUG: */ debugOutput('----------------------- ' . __FUNCTION__ . ' - ENTRY ------------------------
  • '); // Convert mode to upper-case $addMode = strtoupper($addMode); @@ -1182,7 +1182,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify } // END - if } // END - if - //* DEBUG: */ debugOutput('
----------------------- '.__FUNCTION__.': added=' . intval($added) . ' - EXIT ------------------------
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',sendNotify=' . intval($sendNotify) . ',refid=' . $refid . ',addMode=' . $addMode . ' - EXIT!'); return $added; } @@ -1887,7 +1887,7 @@ function generateReceiverList ($categoryId, $receiver, $mode = '') { // "Getter" for array for user refs and points in given level function getUserReferalPoints ($userid, $level) { - //* DEBUG: */ debugOutput('----------------------- '.__FUNCTION__.' - ENTRY ------------------------
  • '); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ' - ENTERED!'); // Default is no refs and no nickname $refs = array(); @@ -1957,7 +1957,7 @@ ORDER BY SQL_FREERESULT($result); // Return result - //* DEBUG: */ debugOutput('
----------------------- '.__FUNCTION__.' - EXIT ------------------------
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ' - EXIT!'); return $refs; } diff --git a/inc/session-functions.php b/inc/session-functions.php index f71f3e0796..f7d86451ed 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -86,7 +86,7 @@ function setSession ($var, $value) { // Check wether a session variable is set function isSessionVariableSet ($var) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "var={$var}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'var=' . $var . ' set in session'); return (isset($GLOBALS['_SESSION'][$var])); } diff --git a/inc/template-functions.php b/inc/template-functions.php index 4280695bdb..db267b1137 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -447,24 +447,24 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0', $loadU } // END - if // Load user's data - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UID={$userid},template={$template},content[]=".gettype($content)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UID=' . $userid . ',template=' . $template . ',content[]=' . gettype($content)); if ((isValidUserId($userid)) && (is_array($content))) { // If nickname extension is installed, fetch nickname as well if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) { // Load by nickname - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "NICKNAME!
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - NICKNAME!'); fetchUserData($userid, 'nickname'); } elseif (isNicknameUsed($userid)) { // Non-number characters entered but no ext-nickname found debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . $userid . ': is no id number and ext-nickname is gone.'); } else { // Load by userid - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "NO-NICK!
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - USERID!'); fetchUserData($userid); } // Merge data if valid - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "content()=".count($content)." - PRE
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'content()=' . count($content) . ' - PRE!'); if ((isUserDataValid()) && ($loadUserData === true)) { // It is valid $content = merge_array($content, getUserDataArray()); @@ -473,7 +473,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0', $loadU unset($content['password']); } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "content()=".count($content)." - AFTER
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'content()=' . count($content) . ' - AFTER!'); } // END - if // Base directory @@ -634,10 +634,10 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true $test = substr($found, 0, strlen($match)); // Does this entry exist? - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "found={$found},match={$match},set={$set}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'found=' . $found . ',match=' . $match . ',set=' . $set); if ($test == $match) { // Match found - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "fuzzyFound!
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'fuzzyFound!'); $fuzzyFound = true; break; } // END - if @@ -649,14 +649,14 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true // Take all string elements if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key.'_' . $matches[4][$key]]))) { // Replace it in the code - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "key={$key},match={$match}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',match=' . $match); $newMatch = str_replace('[', "['", str_replace(']', "']", $match)); $code = str_replace($match, '".' . $newMatch . '."', $code); $matchesFound[$key . '_' . $matches[4][$key]] = 1; $matchesFound[$match] = 1; } elseif (!isset($matchesFound[$match])) { // Not yet replaced! - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "match={$match}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'match=' . $match); $code = str_replace($match, '".' . $match . '."', $code); $matchesFound[$match] = 1; } @@ -1428,7 +1428,10 @@ function determinePageTitle () { $pageTitle = '{--NO_CONFIG_FOUND_TITLE--}'; // Do not add the fatal message in installation mode - if ((!isInstalling()) && (!isConfigurationLoaded())) addFatalMessage(__FUNCTION__, __LINE__, '{--NO_CONFIG_FOUND--}'); + if ((!isInstalling()) && (!isConfigurationLoaded())) { + // Please report this + debug_report_bug(__FUNCTION__, __LINE__, 'No configuration data found!'); + } // END - if } // Return title