From cb0ddf186efd5b223638476e74cffb2d3c415407 Mon Sep 17 00:00:00 2001 From: quix0r Date: Wed, 23 Jun 2010 21:38:33 +0000 Subject: [PATCH] New debugging function debugOutput() introduced, some rewrites to EL: - New debugging function debugOutput() added, this function does output any XHTML message in a div-block to the browser. - Some more rewrites to EL - TODOs.txt updated --- DOCS/TODOs.txt | 43 ++++--- birthday_confirm.php | 2 +- inc/classes/cachesystem.class.php | 8 +- inc/config-functions.php | 10 +- inc/db/lib-mysql3.php | 6 +- inc/extensions-functions.php | 12 +- inc/filters.php | 18 +-- inc/fix_menu.php | 2 +- inc/functions.php | 89 +++++++------- inc/gen_refback.php | 16 ++- inc/inc-functions.php | 20 ++-- inc/language-functions.php | 2 +- inc/libs/admins_functions.php | 4 +- inc/libs/rallye_functions.php | 16 ++- inc/libs/surfbar_functions.php | 2 +- inc/libs/wernis_functions.php | 4 +- inc/modules/admin/admin-inc.php | 10 +- inc/modules/admin/overview-inc.php | 4 +- inc/modules/admin/what-del_email.php | 4 +- inc/modules/admin/what-list_rallyes.php | 94 ++++++++------- inc/modules/admin/what-list_refs.php | 2 +- inc/modules/guest/what-register.php | 2 +- inc/mysql-manager.php | 109 ++++++++++-------- inc/pool/pool-bonus.php | 16 ++- inc/pool/pool-user.php | 22 ++-- inc/reset/reset_daily.php | 8 +- inc/revision-functions.php | 2 +- inc/sql-functions.php | 2 +- inc/wrapper-functions.php | 9 +- .../html/admin/admin_list_rallye_usr_row.tpl | 9 +- .../de/html/admin/admin_list_rallyes_row.tpl | 14 +-- 31 files changed, 293 insertions(+), 268 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index be9e927d47..334942e56b 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -41,22 +41,22 @@ ./inc/extensions-functions.php:143: // @TODO Do we still need this? setExtensionUpdateNotes(''); ./inc/extensions-functions.php:423:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) ./inc/extensions-functions.php:539: // @TODO Extension is loaded, what next? -./inc/functions.php:1052:// @TODO $simple/$constants are deprecated -./inc/functions.php:1079: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates -./inc/functions.php:2412: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/functions.php:2561: // @TODO Add a little more infos here -./inc/functions.php:2644: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? -./inc/functions.php:2667: // @TODO Rewrite this old lost code to a template +./inc/functions.php:1078:// @TODO $simple/$constants are deprecated +./inc/functions.php:1105: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates +./inc/functions.php:2382: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/functions.php:2531: // @TODO Add a little more infos here +./inc/functions.php:2615: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? +./inc/functions.php:2638: // @TODO Rewrite this old lost code to a template ./inc/functions.php:266: // @TODO Remove this sanity-check if all is fine ./inc/functions.php:269: // @TODO Try to rewrite all $DATA to $content -./inc/functions.php:2757: // @TODO Are these convertions still required? -./inc/functions.php:2775:// @TODO Rewrite this function to use readFromFile() and writeToFile() -./inc/functions.php:3651:// @TODO Lame description for this function -./inc/functions.php:3670: // @TODO Move this in a filter -./inc/functions.php:3794: // @TODO This is still very static, rewrite it somehow -./inc/functions.php:478: // @TODO Do only use $content, not $DATA or raw variables -./inc/functions.php:548: // @TODO Extension 'msg' does not exist -./inc/functions.php:611:// @TODO Rewrite this to an extension 'smtp' +./inc/functions.php:2728: // @TODO Are these convertions still required? +./inc/functions.php:2746:// @TODO Rewrite this function to use readFromFile() and writeToFile() +./inc/functions.php:3622:// @TODO Lame description for this function +./inc/functions.php:3641: // @TODO Move this in a filter +./inc/functions.php:3765: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:482: // @TODO Do only use $content, not $DATA or raw variables +./inc/functions.php:555: // @TODO Extension 'msg' does not exist +./inc/functions.php:618:// @TODO Rewrite this to an extension 'smtp' ./inc/install-functions.php:63: // @TODO DEACTIVATED: changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); ./inc/language/de.php:1143:// @TODO Rewrite these two constants ./inc/language/de.php:1158:// @TODO Rewrite these three constants @@ -77,7 +77,7 @@ ./inc/libs/rallye_functions.php:708:// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId() ./inc/libs/rallye_functions.php:779: $EXPIRE = 3; // @TODO The hard-coded value... ./inc/libs/rallye_functions.php:865:// @TODO Please document this function -./inc/libs/rallye_functions.php:923: // Load count @TODO Can't we rewrite this to our API? +./inc/libs/rallye_functions.php:921: // Load count @TODO Can't we rewrite this to our API? ./inc/libs/refback_functions.php:61: // @TODO Try to rewrite the following unset() ./inc/libs/register_functions.php:299: // @TODO Rewrite these all to a single filter ./inc/libs/register_functions.php:375: // @TODO Rewrite this to a filter @@ -137,7 +137,6 @@ ./inc/modules/admin/what-list_links.php:57: // @TODO Try to rewrite this to a filter ./inc/modules/admin/what-list_links.php:89: // @TODO Find a way to rewrite this. See some lines above for different queries ./inc/modules/admin/what-list_links.php:98: // @TODO Rewrite this to includes/filter -./inc/modules/admin/what-list_rallyes.php:258: // @TODO Rewritings: opoints->curr_points,old->refs in template ./inc/modules/admin/what-list_refs.php:110: // @TODO Try to rewrite some to EL ./inc/modules/admin/what-list_task.php:146: // @TODO Rewrite these templates to one and add $OUT ./inc/modules/admin/what-list_task.php:180: // @TODO Rewritings: admin->assigned_admin,userid->userid,type->task_type_msg in template @@ -191,13 +190,13 @@ ./inc/modules/member/what-unconfirmed.php:143: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/order.php:76: // @TODO Unused: 2,4 ./inc/monthly/monthly_bonus.php:69: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1590: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() -./inc/mysql-manager.php:1690: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:2070: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:2111:// @TODO Fix inconsistency between last_module and getWhat() +./inc/mysql-manager.php:1627: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() +./inc/mysql-manager.php:1727: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:2107: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:2148:// @TODO Fix inconsistency between last_module and getWhat() ./inc/mysql-manager.php:229: // @TODO Nothing helped??? ./inc/mysql-manager.php:264: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:563: // @TODO Try to rewrite this to one or more functions +./inc/mysql-manager.php:589: // @TODO Try to rewrite this to one or more functions ./inc/mysql-manager.php:94:// @TODO Can we cache this? ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye ./inc/reset/reset_birthday.php:92: // @TODO 4 is hard-coded here, should we move it out in config? @@ -206,7 +205,7 @@ ./inc/wrapper-functions.php:134:// @TODO Implement $decompress ./inc/wrapper-functions.php:455:// @TODO Do some more sanity check here ./inc/wrapper-functions.php:793: * @TODO Do we really need this check? If yes, try to fix this: -./mailid.php:135: // @TODO Rewrite this to a filter +./mailid.php:138: // @TODO Rewrite this to a filter ./mailid.php:95: // @TODO Rewrite this to a filter ./mailid_top.php:132: // @TODO Rewrite this to a filter ./mailid_top.php:179: // @TODO Rewrite this to a filter diff --git a/birthday_confirm.php b/birthday_confirm.php index 7b5bffac08..b06b0c71d1 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -79,7 +79,7 @@ LIMIT 1", $userid, $chk ), __FILE__, __LINE__); -//* DEBUG: */ outputHtml("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestParameter('check')).'/'.SQL_NUMROWS($result).")
"); +//* DEBUG: */ debugOutput("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestParameter('check')).'/'.SQL_NUMROWS($result) . ')'); // Prepare content $content = array(); diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 4c4878aa57..929b8cbb7d 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -90,10 +90,10 @@ class CacheSystem { // Pre-fetch cache here if found if ($this->isCacheReadable()) $this->getArrayFromCache(); - //* DEBUG: */ print($cacheName.'='.intval($this->isCacheReadable()).'/'.intval(is_writeable($this->fqfn)).'/'.intval($this->extensionVersionMatches('cache')).'
'); + //* DEBUG: */ debugOutput('cacheName='.$cacheName.',isCacheReadable='.intval($this->isCacheReadable()).',is_writeable='.intval(is_writeable($this->fqfn)).',extensionMatches='.intval($this->extensionVersionMatches('cache'))); $this->status[$cacheName] = ($this->isCacheReadable() && (is_writeable($this->fqfn)) && ($this->extensionVersionMatches('cache'))); } // END - if - //* DEBUG: */ print($cacheName.'='.intval($this->status[$cacheName]).'
'); + //* DEBUG: */ debugOutput('cacheName='.$cacheName.',status='.intval($this->status[$cacheName])); // Return status return $this->status[$cacheName]; @@ -221,7 +221,7 @@ class CacheSystem { // Remove pointer and status unset($this->status[$this->name]); $this->pointer = false; - //* DEBUG: */ outputHtml(__METHOD__ . '(' . __LINE__."): {$this->name} - FINALIZED!
"); + //* DEBUG: */ debugOutput(__METHOD__ . '(' . __LINE__.'): '.$this->name.' - FINALIZED!'); } // END - if } @@ -427,7 +427,7 @@ class CacheSystem { // Write cache line to file fwrite($this->pointer, $this->rewriteEntry($ext_name, $ext_ver, 'version', true)); } // END - if - //* DEBUG: */ outputHtml(__METHOD__ . '(' . __LINE__."): {$this->name} - {$ext_name}={$ext_ver}
"); + //* DEBUG: */ debugOutput(__METHOD__ . '(' . __LINE__ . '): '.$this->name.' - '.$ext_name.'='.$ext_ver); } else { // Cannot create file addFatalMessage(__METHOD__, __LINE__, '(' . __LINE__ . '): {--CACHE_PROBLEMS_DETECTED'); diff --git a/inc/config-functions.php b/inc/config-functions.php index b32fcf713f..918ce0fb39 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -94,7 +94,7 @@ function setConfigEntry ($configEntry, $value) { // Checks wether the given config entry is set function isConfigEntrySet ($configEntry) { - //* DEBUG: */ print __FUNCTION__.':'.$configEntry.'='.intval(isset($GLOBALS['config'][$configEntry])).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$configEntry.'='.intval(isset($GLOBALS['config'][$configEntry]))); return (isset($GLOBALS['config'][$configEntry])); } @@ -198,7 +198,7 @@ function updateOldConfigFile () { // Is the line found? if ((substr($line, 0, strlen($old)) == $old) && (!isset($done[$old]))) { // Entry found! - //* DEBUG: */ outputHtml(secureString($line) . " - FOUND!
"); + //* DEBUG: */ debugOutput(secureString($line) . ' - FOUND!'); // Eval the line... eval($line); @@ -223,9 +223,9 @@ function updateOldConfigFile () { } // END - if /// ... and write it to the new config - //* DEBUG: */ outputHtml('function=' . $function . ',new=' . $new . ',comment=' . $comment . "
"); + //* DEBUG: */ debugOutput('function=' . $function . ',new=' . $new . ',comment=' . $comment); changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0); - //* DEBUG: */ outputHtml("CHANGED!
"); + //* DEBUG: */ debugOutput('CHANGED!'); // Mark it as done $done[$old] = 1; @@ -256,7 +256,7 @@ function updateOldConfigFile () { } // Debug output only - //* DEBUG: */ outputHtml(secureString($line) . " - MySQL!
"); + //* DEBUG: */ debugOutput(secureString($line) . ' - MySQL!'); // Split parts so we can check them and prepare them $parts = explode('=>', $line); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 64db7499ab..8880bef74a 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -79,7 +79,7 @@ function SQL_QUERY ($sqlString, $F, $L) { $querytimeBefore = microtime(true); // Run SQL command - //* DEBUG: */ print('F=' . basename($F) . ',L=' . $L . 'sql=' . htmlentities($GLOBALS['last_sql']) . '
'); + //* DEBUG: */ debugOutput('F=' . basename($F) . ',L=' . $L . 'sql=' . htmlentities($GLOBALS['last_sql'])); $result = mysql_query($GLOBALS['last_sql'], SQL_GET_LINK()) or debug_report_bug($F, $L, 'file='. $F . ',line=' . $L . ':mysql_error()=' . mysql_error() . "\n". 'Query string:' . $GLOBALS['last_sql']); @@ -411,7 +411,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,file=%s,line=%s", $sql, $F, $L)); } elseif ($noIndex === false) { // And column name as well - //* DEBUG: */ print __LINE__.':tableArray=
' . print_r($tableArray, true) . '
'; + //* DEBUG: */ debugOutput(__LINE__.':tableArray=
' . print_r($tableArray, true) . '
'); $keyName = str_replace('`', '', $tableArray[5]); // Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above @@ -448,7 +448,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { // Walk through all while ($content = SQL_FETCHARRAY($result)) { // Is it found? - //* DEBUG: */ print(__LINE__.':columnName='.$keyName.',content=
' . print_r($content, true) . '
'); + //* DEBUG: */ debugOutput(__LINE__.':columnName='.$keyName.',content=
' . print_r($content, true) . '
'); if (($content['Key_name'] == $keyName) && ($tableArray[3] == 'ADD')) { // Skip this query! //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ADD: Skiped: %s", $sql)); diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 8d981e3e24..fd17c33bd1 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -279,7 +279,7 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru // Reset extension name setCurrentExtensionName($ext_name); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ print getCurrentExtensionName().':
' . print_r($test, true) . '
'; + //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); } // END - if } elseif ($ext_ver != getCurrentExtensionVersion()) { // Ok, update this extension now @@ -320,10 +320,10 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru // Remains true if extension registration reports no failures //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ print getCurrentExtensionName().':
' . print_r($test, true) . '
'; + //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); $test = (($test === true) && (getExtensionReportsFailure() === false)); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ print getCurrentExtensionName().':
' . print_r($test, true) . '
'; + //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); // Does everthing before wents ok? if ($test === true) { @@ -415,7 +415,7 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru // Return status code //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ' - EXIT!'); - //* DEBUG: */ print getCurrentExtensionName().':
'.print_r($ret, true).'
'; + //* DEBUG: */ debugOutput(getCurrentExtensionName().':
'.print_r($ret, true).'
'); return $ret; } @@ -648,7 +648,7 @@ function updateExtension ($ext_name, $ext_ver, $dry_run = false) { initExtensionSqls(); // Check if version is updated - //* DEBUG: */ print getCurrentExtensionName().'/'.$ext_name.':'.getThisExtensionVersion().'/'.$ext_ver.'/'.intval(is_array($history)).'
'; + //* DEBUG: */ debugOutput(getCurrentExtensionName().'/'.$ext_name.':'.getThisExtensionVersion().'/'.$ext_ver.'/'.intval(is_array($history))); if (((getThisExtensionVersion() != $ext_ver) || (getExtensionDryRun())) && (is_array($history))) { // Search for starting point $start = array_search($ext_ver, $history); @@ -1546,7 +1546,7 @@ function getExtensionMode () { // Setter for dry-run function enableExtensionDryRun ($dry_run = true) { - //* DEBUG: */ print __FUNCTION__.': '.getCurrentExtensionName().'='.intval($dry_run).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.': '.getCurrentExtensionName().'='.intval($dry_run)); $GLOBALS['ext_dry_run'] = (bool) $dry_run; } diff --git a/inc/filters.php b/inc/filters.php index 6b33ba7f8a..1d96aa316c 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -79,15 +79,15 @@ function FILTER_FLUSH_FILTERS () { // Walk through all filters foreach ($filterArray as $filterFunction => $active) { // Is this filter loaded? - //* DEBUG: */ print 'FOUND:'.$filterName.'/'.$filterFunction.'='.$active.'
'; + //* DEBUG: */ debugOutput('FOUND:'.$filterName.'/'.$filterFunction.'='.$active); if (((!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) && ($active != 'R')) || ($active == 'A')) { // Add this filter (all filters are active by default) - //* DEBUG: */ print 'ADD:'.$filterName.'/'.$filterFunction.'
'; + //* DEBUG: */ debugOutput('ADD:'.$filterName.'/'.$filterFunction); $insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction); $inserted++; } elseif ($active == 'R') { // Remove this filter - //* DEBUG: */ print 'REMOVE:'.$filterName.'/'.$filterFunction.'
'; + //* DEBUG: */ debugOutput('REMOVE:'.$filterName.'/'.$filterFunction); $removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction); $removed++; } @@ -435,8 +435,8 @@ function FILTER_COMPILE_CONFIG ($code, $compiled = false) { // Should we compile it? if ($compiled === true) { // Run the code - $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . "\";"; - //* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:
' . str_replace('$', '$', htmlentities($eval)) . '
'); + $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . '";'; + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
' . str_replace('$', '$', htmlentities($eval)) . '
'); eval($eval); } // END - if @@ -449,7 +449,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { // Compile {%cmd,callback,extraFunction=some_value%} to get expression code snippets // See switch() command below for supported commands preg_match_all('/\{%(([a-zA-Z0-9-_,]+)(=([^\}]+)){0,1})*%\}/', $code, $matches); - //* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:
'.print_r($matches, true).'
'); + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.print_r($matches, true).'
'); // Default is from outputHtml() $outputMode = getOutputMode(); @@ -500,7 +500,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { ); // Call it - //* DEBUG: */ print __FUNCTION__ . '[' . __LINE__ . ']: function=' . $commandFunction . "
\n"; + //* DEBUG: */ debugOutput(__FUNCTION__ . '[' . __LINE__ . ']: function=' . $commandFunction); $code = call_user_func($commandFunction, $data); } else { // Unsupported command detected @@ -513,7 +513,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { if ((getOutputMode() != '0') || ($outputMode != '0')) $code = decodeEntities($code); // Return compiled code - //* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:
'.($code).'
'); + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.($code).'
'); return $code; } @@ -652,7 +652,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // Set default 'what' value - //* DEBUG: */ outputHtml('-'.getModule().'/'.getWhat()."-
"); + //* DEBUG: */ debugOutput('-' . getModule() . '/' . getWhat() . '-'); if ((!isWhatSet()) && (!isActionSet()) && (getOutputMode() != 1) && (getOutputMode() != -1)) { if (getModule() == 'admin') { // Set 'action' value to 'login' in admin menu diff --git a/inc/fix_menu.php b/inc/fix_menu.php index 1fb3d21da5..469e22dee8 100644 --- a/inc/fix_menu.php +++ b/inc/fix_menu.php @@ -66,7 +66,7 @@ foreach (array('guest','member','admin') as $menu) { // Sub menu $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', true, sprintf(" AND `what`='%s'", $entry['what'])); } - //* DEBUG: */ print 'menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries.'
'; + //* DEBUG: */ debugOutput('menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries); // Only remove if we have at least 2 entries from same menu if ($entries > 1) { diff --git a/inc/functions.php b/inc/functions.php index 98533a8799..cfde41fa53 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -184,7 +184,7 @@ function doFinalCompilation ($code, $insertComments = true) { $newContent = ''; // Compile it - //* DEBUG: */ print '
'.htmlentities($code).'
'; + //* DEBUG: */ debugOutput('
'.htmlentities($code).'
'); $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code))) . '";'; //* DEBUG: */ if ($insertComments) die('
'.linenumberCode($eval).'
'); eval($eval); @@ -454,7 +454,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { } // 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 (($userid > 0) && (is_array($content))) { // If nickname extension is installed, fetch nickname as well if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) { @@ -1460,7 +1460,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = // Calculate 2-seconds timestamp $stamp = round($timestamp); - //* DEBUG: */ print('*' . $stamp .'/' . $timestamp . '*
'); + //* DEBUG: */ debugOutput('*' . $stamp .'/' . $timestamp . '*'); // Do we have a leap year? $SWITCH = '0'; @@ -1473,25 +1473,25 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = // First of all years... $Y = abs(floor($timestamp / (31536000 + $SWITCH))); - //* DEBUG: */ print("Y={$Y}
"); + //* DEBUG: */ debugOutput('Y=' . $Y); // Next months... $M = abs(floor($timestamp / 2628000 - $Y * 12)); - //* DEBUG: */ print("M={$M}
"); + //* DEBUG: */ debugOutput('M=' . $M); // Next weeks $W = abs(floor($timestamp / 604800 - $Y * ((365 + $SWITCH / getConfig('ONE_DAY')) / 7) - ($M / 12 * (365 + $SWITCH / getConfig('ONE_DAY')) / 7))); - //* DEBUG: */ print("W={$W}
"); + //* DEBUG: */ debugOutput('W=' . $W); // Next days... $D = abs(floor($timestamp / 86400 - $Y * (365 + $SWITCH / getConfig('ONE_DAY')) - ($M / 12 * (365 + $SWITCH / getConfig('ONE_DAY'))) - $W * 7)); - //* DEBUG: */ print("D={$D}
"); + //* DEBUG: */ debugOutput('D=' . $D); // Next hours... $h = abs(floor($timestamp / 3600 - $Y * (365 + $SWITCH / getConfig('ONE_DAY')) * 24 - ($M / 12 * (365 + $SWITCH / getConfig('ONE_DAY')) * 24) - $W * 7 * 24 - $D * 24)); - //* DEBUG: */ print("h={$h}
"); + //* DEBUG: */ debugOutput('h=' . $h); // Next minutes.. $m = abs(floor($timestamp / 60 - $Y * (365 + $SWITCH / getConfig('ONE_DAY')) * 24 * 60 - ($M / 12 * (365 + $SWITCH / getConfig('ONE_DAY')) * 24 * 60) - $W * 7 * 24 * 60 - $D * 24 * 60 - $h * 60)); - //* DEBUG: */ print("m={$m}
"); + //* DEBUG: */ debugOutput('m=' . $m); // And at last seconds... $s = abs(floor($timestamp - $Y * (365 + $SWITCH / getConfig('ONE_DAY')) * 24 * 3600 - ($M / 12 * (365 + $SWITCH / getConfig('ONE_DAY')) * 24 * 3600) - $W * 7 * 24 * 3600 - $D * 24 * 3600 - $h * 3600 - $m * 60)); - //* DEBUG: */ print("s={$s}
"); + //* DEBUG: */ debugOutput('s=' . $s); // Is seconds zero and time is < 60 seconds? if (($s == '0') && ($timestamp < 60)) { @@ -1732,7 +1732,7 @@ function extractHostnameFromUrl (&$script) { if (isInString('/', $host)) $host = substr($host, 0, strpos($host, '/')); // Generate relative URL - //* DEBUG: */ print('SCRIPT=' . $script.'
'); + //* DEBUG: */ debugOutput('SCRIPT=' . $script); if (substr(strtolower($script), 0, 7) == 'http://') { // But only if http:// is in front! $script = substr($script, (strlen($url) + 7)); @@ -1741,7 +1741,7 @@ function extractHostnameFromUrl (&$script) { $script = substr($script, (strlen($url) + 8)); } - //* DEBUG: */ print('SCRIPT=' . $script.'
'); + //* DEBUG: */ debugOutput('SCRIPT=' . $script); if (substr($script, 0, 1) == '/') $script = substr($script, 1); // Return host name @@ -1855,7 +1855,7 @@ function sendRawRequest ($host, $request) { $resolver = new HostnameResolver(); // Open connection - //* DEBUG: */ die('SCRIPT=' . $script.'
'); + //* DEBUG: */ die('SCRIPT=' . $script); if ($useProxy === true) { // Resolve hostname into IP address $ip = $resolver->resolveHostname(compileRawCode(getConfig('proxy_host'))); @@ -1955,8 +1955,8 @@ function sendRawRequest ($host, $request) { } } // END - foreach - //* DEBUG: */ print('Request:
'.print_r($request, true).'
'); - //* DEBUG: */ print('Response:
'.print_r($response, true).'
'); + //* DEBUG: */ debugOutput('Request:
'.print_r($request, true).'
'); + //* DEBUG: */ debugOutput('Response:
'.print_r($response, true).'
'); // Proxy agent found or something went wrong? if (!isset($response[0])) { @@ -1998,7 +1998,7 @@ function setupProxyTunnel ($host, $resource) { // Add last new-line $proxyTunnel .= getConfig('HTTP_EOL'); - //* DEBUG: */ print('proxyTunnel=
' . $proxyTunnel.'
'); + //* DEBUG: */ debugOutput('proxyTunnel=
' . $proxyTunnel.'
'); // Write request fwrite($fp, $proxyTunnel); @@ -2040,11 +2040,11 @@ function isEmailValid ($email) { function isUrlValid ($URL, $compile=true) { // Trim URL a little $URL = trim(urldecode($URL)); - //* DEBUG: */ outputHtml($URL.'
'); + //* DEBUG: */ debugOutput($URL); // Compile some chars out... if ($compile === true) $URL = compileUriCode($URL, false, false, false); - //* DEBUG: */ outputHtml($URL.'
'); + //* DEBUG: */ debugOutput($URL); // Check for the extension filter if (isExtensionActive('filter')) { @@ -2070,7 +2070,7 @@ function generateMemberAdminActionLinks ($userid, $status = '') { foreach ($targetArray as $tar) { $OUT .= '' . __LINE__ . '): ' . $constName."-CACHE!
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): ' . $constName."-CACHE!
"); $res = ($GLOBALS['cache_array']['const'][$constName] === true); } else { // Check constant - //* DEBUG: */ outputHtml(__FUNCTION__ . '(' . __LINE__ . '): ' . $constName."-RESOLVE!
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): ' . $constName."-RESOLVE!
"); if (defined($constName)) { // Found! - //* DEBUG: */ outputHtml(__FUNCTION__ . '(' . __LINE__ . '): ' . $constName."-FOUND!
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): ' . $constName."-FOUND!
"); $res = (constant($constName) === true); } // END - if @@ -2535,8 +2535,9 @@ function debug_report_bug ($F, $L, $message = '', $sendEmail = true) { // Add output $debug .= 'Please report this bug at
http://bugs.mxchange.org and include the logfile from ' . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . 'debug.log in your report (you can now attach files):
';
 	$debug .= debug_get_printable_backtrace();
-	$debug .= '
Request-URI: ' . getRequestUri() . '
'; - $debug .= 'Thank you for finding bugs.'; + $debug .= ''; + $debug .= '
Request-URI: ' . getRequestUri() . '
'; + $debug .= '
Thank you for finding bugs.
'; // Send an email? (e.g. not wanted for evaluation errors) if (($sendEmail === true) && (!isInstallationPhase())) { @@ -2727,7 +2728,7 @@ function isUrlValidSimple ($url) { // @TODO Are these convertions still required? $pat = str_replace('.', "\.", $pat); $pat = str_replace('@', "\@", $pat); - //* DEBUG: */ outputHtml($key."= " . $pat . '
'); + //* DEBUG: */ debugOutput($key."= " . $pat); } // END - if // Check if expression matches @@ -2756,12 +2757,12 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) { $tmp = $FQFN . '.tmp'; // Open the source file - $fp = fopen($FQFN, 'r') or outputHtml('READ: ' . $FQFN . '
'); + $fp = fopen($FQFN, 'r') or debug_report_bug('Cannot read. file=' . basename($FQFN)); // Is the resource valid? if (is_resource($fp)) { // Open temporary file - $fp_tmp = fopen($tmp, 'w') or outputHtml('WRITE: ' . $tmp . '
'); + $fp_tmp = fopen($tmp, 'w') or debug_report_bug('Cannot write. tmp=' . basename($tmp) . ',file=' . $FQFN); // Is the resource again valid? if (is_resource($fp_tmp)) { @@ -2810,7 +2811,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) { } } else { // File not found, not readable or writeable - outputHtml('404: ' . $FQFN . '
'); + debug_report_bug('File not readable/writeable. file=' . basename($FQFN)); } // An error was detected! @@ -3303,7 +3304,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Exclude '.', '..' and entries in $excludeArray automatically if (in_array($baseFile, $excludeArray, true)) { // Exclude them - //* DEBUG: */ outputHtml('excluded=' . $baseFile . '
'); + //* DEBUG: */ debugOutput('excluded=' . $baseFile); continue; } // END - if @@ -3317,9 +3318,9 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Check if the base filenname matches an exclusion pattern and if the pattern is not empty if ((!empty($excludePattern)) && (preg_match($excludePattern, $baseFile, $match))) { // These Lines are only for debugging!! - //* DEBUG: */ outputHtml('baseDir:' . $baseDir . '
'); - //* DEBUG: */ outputHtml('baseFile:' . $baseFile . '
'); - //* DEBUG: */ outputHtml('FQFN:' . $FQFN . '
'); + //* DEBUG: */ debugOutput('baseDir:' . $baseDir); + //* DEBUG: */ debugOutput('baseFile:' . $baseFile); + //* DEBUG: */ debugOutput('FQFN:' . $FQFN); // Exclude this one continue; diff --git a/inc/gen_refback.php b/inc/gen_refback.php index e9073dae38..51f01e2622 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -68,10 +68,14 @@ SQL_FREERESULT($result); SQL_QUERY('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__); // Begin with all users in level one -$result_direct = SQL_QUERY('SELECT u.userid -FROM `{?_MYSQL_PREFIX?}_user_data` AS u -WHERE u.refid=0 -ORDER BY u.userid ASC', __FILE__, __LINE__); +$result_direct = SQL_QUERY('SELECT + u.userid +FROM + `{?_MYSQL_PREFIX?}_user_data` AS u +WHERE + u.refid=0 +ORDER BY + u.userid ASC', __FILE__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result_direct) > 0) { @@ -81,7 +85,7 @@ if (SQL_NUMROWS($result_direct) > 0) { $GLOBALS['refback_level'] = 1; // Update refback table - //* DEBUG: */ outputHtml("userid={$content['userid']}
"); + //* DEBUG: */ debugOutput('userid=' . $content['userid']); updateRefbackTable($content['userid']); } // END - while } // END - if @@ -89,5 +93,5 @@ if (SQL_NUMROWS($result_direct) > 0) { // Free result SQL_FREERESULT($result_direct); -// +// [EOF] ?> diff --git a/inc/inc-functions.php b/inc/inc-functions.php index 989eb238d4..ee80859443 100644 --- a/inc/inc-functions.php +++ b/inc/inc-functions.php @@ -44,19 +44,19 @@ if (!defined('__SECURITY')) { // Init INC_POOL function initIncludePool ($pool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); $GLOBALS['inc_pool'][$pool] = array(); } // Setter for INC_POOL function setIncludePool ($pool, $includePool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); $GLOBALS['inc_pool'][$pool] = (array) $includePool; } // Getter for INC_POOL function getIncludePool ($pool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); if (isset($GLOBALS['inc_pool'][$pool])) { // Return found pool (array) return $GLOBALS['inc_pool'][$pool]; @@ -68,25 +68,25 @@ function getIncludePool ($pool) { // Count INC_POOL function countIncludePool ($pool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); return count($GLOBALS['inc_pool'][$pool]); } // Merge INC_POOL into given function mergeIncludePool ($pool, $includePool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); setIncludePool($pool, merge_array(getIncludePool($pool), $includePool)); } // Add single include file to INC_POOL function addIncludeToPool ($pool, $inc) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); $GLOBALS['inc_pool'][$pool][] = (string) $inc; } // Remove an include file from INC_POOL function removeIncludeFromPool ($pool, $inc) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool); // First look it up $key = array_search($inc, getIncludePool($pool)); @@ -102,12 +102,12 @@ function removeIncludeFromPool ($pool, $inc) { // Load the whole include pool function loadIncludePool ($pool) { - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.' - START
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool.' - START'); foreach (getIncludePool($pool) as $inc) { - //* DEBUG: */ print __FUNCTION__.':inc='.$inc.'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':inc='.$inc); loadIncludeOnce($inc); } // END - foreach - //* DEBUG: */ print __FUNCTION__.':pool='.$pool.' - END
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':pool='.$pool.' - END'); // Remove it initIncludePool($pool); diff --git a/inc/language-functions.php b/inc/language-functions.php index a12389d839..f1d7f0ac93 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -156,7 +156,7 @@ function isLanguageIncludeReadable ($ext_name = 'none') { // Look for file if no extension name is provided $GLOBALS['lang_inc'][$ext_name] = isIncludeReadable($languageInclude); - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'='.$languageInclude.'='.intval(isIncludeReadable($languageInclude)).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'='.$languageInclude.'='.intval(isIncludeReadable($languageInclude))); } // END - if // Return it diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index b613105fa4..dd8d99dcbf 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -110,14 +110,14 @@ function adminsCheckAdminAcl ($action, $what) { } // Check ACL and (maybe) allow - //* DEBUG: */ print 'default='.$default.',acl_mode='.$acl_mode.',parent='.intval($parent).'
'; + //* DEBUG: */ debugOutput('default='.$default.',acl_mode='.$acl_mode.',parent='.intval($parent)); if (($default == 'allow') || (($default == 'deny') && ($acl_mode == 'allow')) || ($parent === true) || (($default == '***') && ($acl_mode == 'failed') && ($parent === false))) { // Access is granted $ret = true; } // END - if // Return value - //* DEBUG: */ outputHtml(__FUNCTION__."[".__LINE__."]:act={$action},wht={$whatOR},default={$default},acl_mode={$acl_mode}
"); + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:act='.$action.',wht='.$what.',default='.$default.',acl_mode='.$acl_mode); return $ret; } diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index acb09444c5..ae14ace7c0 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -292,7 +292,7 @@ LIMIT 1", $userid = '---'; // List only users with at least one ref! - //* DEBUG: */ print("*".$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints."*
"); + //* DEBUG: */ debugOutput('*'.$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints.'*'); if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $userid = $content['userid']; } else { $cnt = ''; } // Save values to array @@ -870,14 +870,14 @@ function getReferalRallyeRefsCount ($currUserid, $old = '0') { $cnt = '0'; foreach ($GLOBALS['cache_array']['refsystem']['userid'] as $id => $userid) { // Do we have a ref for this user? - //* DEBUG: */ print("id={$id},userid={$userid},userid={$userid},old={$old},level={$GLOBALS['cache_array']['refsystem']['level'][$id]}
"); + //* DEBUG: */ debugOutput('id='.$id.',userid='.$userid.',userid='.$userid.',old='.$old.',level='.$GLOBALS['cache_array']['refsystem']['level'][$id]); if (($currUserid == $userid) && ($GLOBALS['cache_array']['refsystem']['level'][$id] == 1)) { - //* DEBUG: */ print("userid matches!
"); + //* DEBUG: */ debugOutput('userid matches!'); foreach ($GLOBALS['cache_array']['refdepths']['level'] as $level) { if (($level == $GLOBALS['cache_array']['refsystem']['level'][$id]) && ($level == 1)) { // Level does exist so abort here $cnt = $GLOBALS['cache_array']['refsystem']['counter'][$id]; - //* DEBUG: */ print("*".$userid.'/'.$cnt."*
"); + //* DEBUG: */ debugOutput('*'.$userid.'/'.$cnt.'*'); break; } elseif ($level > 1) { // Not interesting here... @@ -890,9 +890,7 @@ function getReferalRallyeRefsCount ($currUserid, $old = '0') { } // END - if } // END - foreach - //* DEBUG: */ print("
");
-		//* DEBUG: */ print(print_r($GLOBALS['cache_array']['refsystem'], true));
-		//* DEBUG: */ print("
"); + //* DEBUG: */ debugOutput('
'.print_r($GLOBALS['cache_array']['refsystem'], true).'
'); //* DEBUG: */ shutdown(); if ($cnt > 0) { @@ -900,7 +898,7 @@ function getReferalRallyeRefsCount ($currUserid, $old = '0') { incrementStatsEntry('cache_hits'); // Remove old refs - //* DEBUG: */ print('+'.$cnt.'/'.$old."+
"); + //* DEBUG: */ debugOutput('+'.$cnt.'/'.$old.'+'); $cnt -= $old; } // END - if } else { @@ -933,7 +931,7 @@ WHERE } // Return count - //* DEBUG: */ print("*".$userid.'/'.$old.'/'.$cnt."*
"); + //* DEBUG: */ debugOutput('*'.$userid.'/'.$old.'/'.$cnt.'*'); return $cnt; } diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 33a2f58ff8..543f145bdb 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -1015,7 +1015,7 @@ function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) { // Lockdown the userid/id combination (reload lock) function SURFBAR_LOCKDOWN_ID ($urlId) { - //* DEBUG: */ outputHtml('LOCK!'); + //* DEBUG: */ debugOutput('LOCK!'); ///* DEBUG: */ return; // Just add it to the database SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`, `locks_url_id`) VALUES (%s, %s)", diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index adffe64f90..83cdb59cef 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -344,7 +344,7 @@ function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = '', // Take fees and factor function WERNIS_TAKE_FEE ($points, $mode) { // Payout or withdraw are allowed modes! - //* DEBUG: */ outputHtml("mode={$mode},points={$points}
"); + //* DEBUG: */ debugOutput('mode='.$mode.',points='.$points); if (!in_array($mode, array('payout', 'withdraw'))) { // Log error and abort logDebugMessage(__FUNCTION__, __LINE__, "userid={getMemberId()},mode={$mode},points={$points}"); @@ -370,7 +370,7 @@ function WERNIS_TAKE_FEE ($points, $mode) { } // Return value - //* DEBUG: */ outputHtml("mode={$mode},points={$points}
"); + //* DEBUG: */ debugOutput('mode='.$mode.',points='.$points); return $points; } diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index cff7e7e2dc..14d8cbb144 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -124,7 +124,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { if ($adminHash != '-1') { // Now, we need to encode the password in the same way the one is encoded in database $testHash = encodeHashForCookie($adminHash); - //* DEBUG: */ outputHtml('adminLogin='.$adminLogin.',
passHash='.$passHash.',
adminHash='.$adminHash.',
testHash='.$testHash.'
'); + //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash); // If they both match, the login data is valid if ($testHash == $passHash) { @@ -137,7 +137,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { } // END - if // Return status - //* DEBUG: */ outputHtml('ret='.$ret); + //* DEBUG: */ debugOutput('ret='.$ret); return $ret; } @@ -146,7 +146,7 @@ function doAdminAction () { // Get default what $what = getWhat(); - //* DEBUG: */ outputHtml(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*
'); + //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*'); // Remove any spaces from variable if (empty($what)) { @@ -787,14 +787,14 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, } // END - if // If the key matches the idColumn variable, we need to temporary remember it - //* DEBUG: */ print 'key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value . '
'; + //* DEBUG: */ debugOutput('key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value); if ($key == $idColumn) { // Found, so remember it $GLOBALS['admin_list_builder_id_value'] = $value; } // END - if // Handle the call in external function - //* DEBUG: */ print 'key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value . '
'; + //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value); $content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]); } // END - foreach diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index b9f2da4b28..81719aadbe 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -85,10 +85,10 @@ function outputStandardOverview (&$result_tasks) { // Get extension version $ext_ver = getExtensionVersion($ext_name); - //* DEBUG: */ outputHtml($ext_name."=".$ext_ver."
"); + //* DEBUG: */ debugOutput($ext_name.'='.$ext_ver); // Update extension if extension is installed and outdated - //* DEBUG: */ outputHtml('ext=' . $ext_name . ',ver=' . getThisExtensionVersion() . '/' . getExtensionVersion($ext_name)."
"); + //* DEBUG: */ debugOutput('ext=' . $ext_name . ',ver=' . getThisExtensionVersion() . '/' . getExtensionVersion($ext_name)); if (getThisExtensionVersion() > $ext_ver) { // Update the extension updateExtension($ext_name, $ext_ver); diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 6fb6f1c439..11de7d3bb7 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -106,7 +106,7 @@ LIMIT 1", // No points repayed! loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED')); } elseif (getConfig('repay_deleted_mails') != 'SHRED') { - //* DEBUG: */ outputHtml($stats_id.':'.$totalPoints.'/'.$links.'/'.$price."
"); + //* DEBUG: */ debugOutput($stats_id.':'.$totalPoints.'/'.$links.'/'.$price); // Shall we payback to user or jackpot? if (getConfig('repay_deleted_mails') == 'JACKPOT') { // Set jackpot @@ -114,7 +114,7 @@ LIMIT 1", } // END - if // Pay back points - //* DEBUG: */ outputHtml("PAYBACK:".$sender."
"); + //* DEBUG: */ debugOutput('PAYBACK:'.$sender); addPointsThroughReferalSystem('mail_deleted', $sender, $totalPoints, true, 0, false,'direct'); // Output message diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index d6bb58f5f3..7f6f64a147 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -150,12 +150,12 @@ SET `title`='%s', `descr`='%s', `template`='%s', - `start_time`='%s', - `end_time`='%s', - `min_users`='%s', - `min_prices`='%s' + `start_time`=%s, + `end_time`=%s, + `min_users`=%s, + `min_prices`=%s WHERE - `id`='%s' + `id`=%s LIMIT 1", array( $title, @@ -224,7 +224,7 @@ LIMIT 1", // Color switching $SW = 3 - $SW; - } + } // END - foreach // Load final template loadTemplate('admin_edit_rallyes', false, $OUT); @@ -234,7 +234,14 @@ LIMIT 1", } } elseif ((getRequestParameter('sub') == 'users') && (getRequestParameter('rallye') > 0)) { // List users and their refs before start and current - $result = SQL_QUERY_ESC("SELECT `userid`, `refs`, `curr_points` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s ORDER BY `userid` ASC", + $result = SQL_QUERY_ESC("SELECT + `userid`, `refs`, `curr_points` +FROM + `{?_MYSQL_PREFIX?}_rallye_users` +WHERE + `rallye_id`=%s +ORDER BY + `userid` ASC", array(bigintval(getRequestParameter('rallye'))), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { $OUT = ''; $SW = 2; @@ -252,18 +259,17 @@ LIMIT 1", // Get user points $points = countSumTotalData($row['userid'], 'user_points', 'points', 'userid', false, " AND `ref_depth`=1 LIMIT 1"); - //* DEBUG: */ outputHtml(basename(__FILE__).":userid={$row['userid']},points={$points},opoints={$row['curr_points']}
"); + //* DEBUG: */ debugOutput(basename(__FILE__).':userid='.$row['userid'].',points='.$points.',opoints='.$row['curr_points']); // Prepare content - // @TODO Rewritings: opoints->curr_points,old->refs in template $row = array( 'sw' => $SW , 'userid' => $row['userid'], 'bold_l' => $bl , 'bold_r' => $br , - 'old' => $row['refs'], + 'rews' => $row['refs'], 'cnt' => $cnt, - 'opoints' => translateComma($points - $row['curr_points']), + 'opoints' => ($points - $row['curr_points']), ); // Load row template and switch color @@ -287,7 +293,8 @@ LIMIT 1", } else { // Start listing rallyes $result = SQL_QUERY("SELECT - `id`, `admin_id`, `title`, `descr`, `template`, `start_time`, `end_time`, `auto_add_new_user`, `is_active`, `send_notify`, `notified`, `min_users`, `min_prices` + `id`, `admin_id`, `title`, `descr`, `template`, `start_time`, `end_time`, + `auto_add_new_user`, `is_active`, `send_notify`, `notified`, `min_users`, `min_prices` FROM `{?_MYSQL_PREFIX?}_rallye_data` ORDER BY @@ -302,12 +309,12 @@ ORDER BY $data['login'] = getAdminLogin($data['admin_id']); // Count joined userids - $joined = countSumTotalData($data['id'], 'rallye_users', 'id', 'rallye_id', true); + $users = countSumTotalData($data['id'], 'rallye_users', 'id', 'rallye_id', true); // Did some users joined this rallye? - if ($joined > 0) { + if ($users > 0) { // List joined users - $joined = '' . $joined . ''; + $users = '' . $users . ''; } // END - if // Alter some variables @@ -317,67 +324,66 @@ ORDER BY // Transfer data into array for the template $row = array( - 'select' => '', - 'admin_id' => $data['admin_id'], - 'admin_link' => generateAdminLink($data['admin_id']), - 'login' => $data['login'], - 'id' => $data['id'], - 'sw' => $SW, - 'title' => $data['title'], - 'template' => $data['template'], - 'joined' => $joined, - 'start_date' => generateDateTime($data['start_time'], 2), - 'end_date' => generateDateTime($data['end_time'] , 2), - 'active_lnk' => translateYesNo($data['is_active']), - 'notify_lnk' => translateYesNo($data['send_notify']), - 'auto_lnk' => translateYesNo($data['auto_add_new_user']), - 'notified' => translateYesNo($data['notified']), - 'prices_cnt' => translateComma(countSumTotalData($data['id'], 'rallye_prices', 'id', 'rallye_id', true)), - 'descr' => $data['descr'], - 'min_users' => $data['min_users'], - 'min_prices' => $data['min_prices'], + 'select' => '', + 'admin_id' => $data['admin_id'], + 'login' => $data['login'], + 'id' => $data['id'], + 'sw' => $SW, + 'title' => $data['title'], + 'template' => $data['template'], + 'users_content' => $users, + 'start_date' => generateDateTime($data['start_time'], 2), + 'end_date' => generateDateTime($data['end_time'] , 2), + 'is_active' => $data['is_active'], + 'send_notify' => $data['send_notify'], + 'auto_add_new_user' => $data['auto_add_new_user'], + 'notified' => $data['notified'], + 'prices_cnt' => countSumTotalData($data['id'], 'rallye_prices', 'id', 'rallye_id', true), + 'descr' => $data['descr'], + 'min_users' => $data['min_users'], + 'min_prices' => $data['min_prices'], ); // Is the rallye active or not? switch ($data['is_active']) { case 'Y': // Rallye is active so do not edit it! - $row['select'] = '
' . $row['id'] . '
'; + $row['select'] = '
' . $row['id'] . '
'; $row['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW'); - $row['active'] = '0'; + $row['active'] = '0'; break; case 'N': $row['active_title'] = getMessage('RALLYE_ACTIVATE_NOW'); - $row['active'] = 1; + $row['active'] = 1; break; - } + } // END - switch // Notification to members? switch ($data['send_notify']) { case 'Y': $row['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW'); - $row['notify'] = '0'; + $row['notify'] = '0'; break; case 'N': $row['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW'); - $row['notify'] = 1; + $row['notify'] = 1; break; - } + } // END - switch // Auto-add of new joined members? switch ($data['auto_add_new_user']) { case 'Y': $row['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW'); - $row['auto'] = '0'; + $row['auto'] = '0'; break; case 'N': $row['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW'); - $row['auto'] = 1; + $row['auto'] = 1; break; - } + } // END - switch // Output row $OUT .= loadTemplate('admin_list_rallyes_row', true, $row); diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php index 5cbf29c67b..852f687050 100644 --- a/inc/modules/admin/what-list_refs.php +++ b/inc/modules/admin/what-list_refs.php @@ -85,7 +85,7 @@ ORDER BY // Load all refs of this user $result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC", array($userid, $levels['level']), __FILE__, __LINE__); - //* DEBUG: */ outputHtml($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."
"); + //* DEBUG: */ debugOutput($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)); // Do we have levels? if (SQL_NUMROWS($result_refs) > 0) { diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index 6585515537..7bd3c02db3 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -54,7 +54,7 @@ if (!isExtensionActive('register')) { } // Is the form sent and all went fine? -//* DEBUG: */ print intval(isFormSent()) . '/' . intval(isRegistrationDataComplete()) . '/' . intval(isAdmin()) . '
'; +//* DEBUG: */ debugOutput('isFormSent=' . intval(isFormSent()) . ',isRegistrationDataComplete=' . intval(isRegistrationDataComplete()) . ',isAdmin=' . intval(isAdmin())); if ((isFormSent()) && (isRegistrationDataComplete())) { // Do the registration here doRegistration(); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 5c996cea14..499002bd0d 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -139,10 +139,10 @@ function checkModulePermissions ($module = '') { // Check for prefix is a extension... $modSplit = explode('_', $module); $extension = ''; $module_chk = $module; - //* DEBUG: */ print(__LINE__."*".count($modSplit)."*/".$module."*
"); + //* DEBUG: */ debugOutput(__LINE__.'*'.count($modSplit).'/'.$module.'*'); if (count($modSplit) == 2) { // Okay, there is a seperator (_) in the name so is the first part a module? - //* DEBUG: */ print(__LINE__."*".$modSplit[0]."*
"); + //* DEBUG: */ debugOutput(__LINE__.'*'.$modSplit[0].'*'); if (isExtensionActive($modSplit[0])) { // The prefix is an extension's name, so let's set it $extension = $modSplit[0]; $module = $modSplit[1]; @@ -373,9 +373,9 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) { $OUT = $prefix . '' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . ''; // Can we close the you-are-here navigation? - //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'*'.$type.'/'.getWhat().'*'); if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) { - //* DEBUG: */ print(__LINE__.'+'.$type."+
"); + //* DEBUG: */ debugOutput(__LINE__.'+'.$type.'+'); // Add closing div and br-tag $OUT .= ''; $GLOBALS['nav_depth'] = '0'; @@ -426,13 +426,13 @@ ORDER BY `sort` ASC", array($mode), __FUNCTION__, __LINE__); - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.':'.getWhat().'*'); if (SQL_NUMROWS($result_main) > 0) { // There are menus available, so we simply display them... :) $GLOBALS['rows'] = ''; while ($content = SQL_FETCHARRAY($result_main)) { - //* DEBUG: */ print(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . ':' . getWhat() . '*
'); - // Init/"translate" variables + //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . ':' . getWhat() . '*'); + // Disable the block-mode enableBlockMode(false); // Load menu header template @@ -469,7 +469,7 @@ ORDER BY $OUT = ''; // Full file name for checking menu - //* DEBUG: */ print(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!
'); + //* DEBUG: */ debugOutput(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!'); $inc = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']); if (isIncludeReadable($inc)) { // Mark currently selected menu - open @@ -526,12 +526,12 @@ ORDER BY if (isFileReadable($INC)) { // Load include file if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode); - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat().'*'); loadInclude($INC); - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat().'*'); if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode); } - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat().'*'); } // Free result @@ -540,7 +540,7 @@ ORDER BY // Count one up $main_cnt++; - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.':'.getWhat().'*'); if (SQL_NUMROWS($result_main) > $main_cnt) { // Add seperator $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode); @@ -575,7 +575,7 @@ ORDER BY ); // Load main template - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
"); + //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat().'*'); loadTemplate('menu_table', false, $content); } // END - if } @@ -743,7 +743,7 @@ function isAdmin ($adminLogin = '') { $ret = false; $passCookie = ''; $valPass = ''; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin); // If admin login is not given take current from cookies... if ((empty($adminLogin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) { @@ -751,7 +751,7 @@ function isAdmin ($adminLogin = '') { $adminLogin = getSession('admin_login'); $passCookie = getSession('admin_md5'); } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'/'.$passCookie.'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'/'.$passCookie); // Do we have cache? if (!isset($GLOBALS['is_admin'][$adminLogin])) { @@ -877,19 +877,30 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) { $add = ''; if ((!isAdmin()) && ($mode != 'admin')) $add = " AND `locked`='N'"; - //* DEBUG: */ print(__LINE__.':'.$mode.'/'.$action.'/'.$what."*
"); + //* DEBUG: */ debugOutput(__LINE__.':'.$mode.'/'.$action.'/'.$what.'*'); if (($mode != 'admin') && ($updateEntry === true)) { // Update guest or member menu $sql = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1", - array($mode, $action, $what), __FUNCTION__, __LINE__, false); + array( + $mode, + $action, + $what + ), __FUNCTION__, __LINE__, false); } elseif (($what != 'overview') && (!empty($what))) { // Other actions $sql = SQL_QUERY_ESC("SELECT `id`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY `action` DESC LIMIT 1", - array($mode, $action, $what), __FUNCTION__, __LINE__, false); + array( + $mode, + $action, + $what + ), __FUNCTION__, __LINE__, false); } else { // Admin login overview $sql = SQL_QUERY_ESC("SELECT `id`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND (`what`='' OR `what` IS NULL)".$add." ORDER BY `action` DESC LIMIT 1", - array($mode, $action), __FUNCTION__, __LINE__, false); + array( + $mode, + $action + ), __FUNCTION__, __LINE__, false); } // Run SQL command @@ -919,7 +930,7 @@ function getActionFromModuleWhat ($module, $what) { // Init status $data['action'] = ''; - //* DEBUG: */ print(__LINE__.'='.$module.'/'.$what.'/'.getAction()."=
"); + //* DEBUG: */ debugOutput(__LINE__.'='.$module.'/'.$what.'/'.getAction().'='); if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) { // sql_patches is missing so choose depending on mode if (isWhatSet()) { @@ -953,7 +964,7 @@ function getActionFromModuleWhat ($module, $what) { // Get it directly from URL return getAction(); } - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__ . '): ret=' . $data['action'] . '
'); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): ret=' . $data['action']); // Does the module have a menu? if (ifModuleHasMenu($module)) { @@ -1105,7 +1116,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen // Init count/sum $data['res'] = '0'; - //* DEBUG: */ print($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'
'); + //* DEBUG: */ debugOutput($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add); if ((empty($search)) && ($search != '0')) { // Count or sum whole table? if ($countRows === true) { @@ -1119,12 +1130,12 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen } } elseif (($countRows === true) || ($lookFor == 'userid')) { // Count rows - //* DEBUG: */ print("COUNT!
"); + //* DEBUG: */ debugOutput('COUNT!'); $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS res FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add, array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__); } else { // Add all rows - //* DEBUG: */ print("SUM!
"); + //* DEBUG: */ debugOutput('SUM!'); $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS res FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add, array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__); } @@ -1145,7 +1156,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen } // Return value - //* DEBUG: */ print 'ret=' . $data['res'] . '
'; + //* DEBUG: */ debugOutput('ret=' . $data['res']); return $data['res']; } // Getter fro ref level percents @@ -1197,7 +1208,7 @@ function getReferalLevelPercents ($level) { * for default value will cause no referal will get points ever!!!) */ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $rid = '0', $locked = false, $add_mode = 'ref') { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- '.__FUNCTION__.' - EXIT ------------------------
'); } // Updates the referal counter function updateReferalCounter ($userid) { // Make it sure referal level zero (member him-/herself) is at least selected if (empty($GLOBALS['cache_array']['ref_level'][$userid])) $GLOBALS['cache_array']['ref_level'][$userid] = 1; - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):userid='.$userid.',level='.$GLOBALS['cache_array']['ref_level'][$userid]); // Update counter SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `counter`=`counter`+1 WHERE `userid`=%s AND `level`='%s' LIMIT 1", array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__); // When no entry was updated then we have to create it here - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):updated=".SQL_AFFECTEDROWS().'
'); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):updated=' . SQL_AFFECTEDROWS()); if (SQL_AFFECTEDROWS() < 1) { // First count! SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)", array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__); - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):userid={$userid}
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):userid='.$userid); } // END - if // Init referal id @@ -1346,17 +1357,17 @@ function updateReferalCounter ($userid) { $ref = getUserData('refid'); } // END - if - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):userid={$userid},ref={$ref}
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):userid='.$userid.',ref='.$ref); // When he has a referal... if (($ref > 0) && ($ref != $userid)) { // Move to next referal level and count his counter one up! - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):ref={$ref} - ADVANCE!
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):ref='.$ref.' - ADVANCE!'); $GLOBALS['cache_array']['ref_level'][$userid]++; updateReferalCounter($ref); } elseif ((($ref == $userid) || ($ref == '0')) && (isExtensionInstalledAndNewer('cache', '0.1.2'))) { // Remove cache here - //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):ref={$ref} - CACHE!
"); + //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):ref='.$ref.' - CACHE!'); rebuildCache('refsystem', 'refsystem'); } @@ -1742,7 +1753,7 @@ function getWhatFromModule ($modCheck) { // Default is empty $what = ''; - //* DEBUG: */ print(__LINE__.'!'.$modCheck."!
"); + //* DEBUG: */ debugOutput(__LINE__.'!'.$modCheck.'!'); switch ($modCheck) { case 'admin': $what = 'overview'; @@ -2000,7 +2011,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') { // "Getter" for array for user refs and points in given level function getUserReferalPoints ($userid, $level) { - //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- '.__FUNCTION__.' - EXIT ------------------------
'); return $refs; } diff --git a/inc/pool/pool-bonus.php b/inc/pool/pool-bonus.php index 65b4e36774..c213c83e65 100644 --- a/inc/pool/pool-bonus.php +++ b/inc/pool/pool-bonus.php @@ -90,7 +90,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Load personal data if (fetchUserData($userid)) { // The final receiver does exists so we can continue... - //* DEBUG: */ print("OK!/L:".__LINE__."
"); + //* DEBUG: */ debugOutput('OK!/L:'.__LINE__); // Mark this user as "spammed" ;-) And place a line for him... if (removeReceiver($dummy, $key, $userid, $DATA['id'], $DATA['id'], true) == 'done') { @@ -123,7 +123,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Do we have send maximum mails? if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (countSelection($dummy) == 0)) { // Yes, we have - //* DEBUG: */ print("*EXIT/L:".__LINE__."
"); + //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__); break; } // END - if } // END - if @@ -135,12 +135,12 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Update entry (or add missing $P = $GLOBALS['pool_cnt']; if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2; - //* DEBUG: */ print("+MEDIA/L:".__LINE__.'/'.$P."+
"); + //* DEBUG: */ debugOutput('+MEDIA/L:'.__LINE__.'/'.$P.'+'); updateMediadataEntry(array('total_send', 'bonus_send'), 'add', $P); } // END - if // Close sending system - //* DEBUG: */ print("-L:".__LINE__.'/'.countSelection($dummy)."-
"); + //* DEBUG: */ debugOutput('-L:'.__LINE__.'/'.countSelection($dummy).'-'); if (countSelection($dummy) == 0) { // Queue reached! SQL_QUERY_ESC("UPDATE @@ -153,12 +153,12 @@ WHERE `id`=%s LIMIT 1", array(bigintval($DATA['id'])), __FILE__, __LINE__); - //* DEBUG: */ print("*L:".__LINE__."*
"); + //* DEBUG: */ debugOutput('*L:'.__LINE__.'*'); // Update mediadata if version is 0.0.4 or higher if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) { // Update entry (or add missing) - //* DEBUG: */ print("*MEDIA/L:".__LINE__."*
"); + //* DEBUG: */ debugOutput('*MEDIA/L:'.__LINE__.'*'); updateMediadataEntry(array('total_orders', 'bonus_orders'), 'add', 1); } // END - if } elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) { @@ -177,9 +177,7 @@ LIMIT 1", implode(';', $dummy), bigintval($DATA['id']) ), __FILE__, __LINE__); - //* DEBUG: */ print("*L:".__LINE__."
");
-				//* DEBUG: */ print(print_r($dummy, true));
-				//* DEBUG: */ print("
\n!!!
"); + //* DEBUG: */ debugOutput('*L:'.__LINE__.'
'.print_r($dummy, true).'
!!!'); break; } } // END - while diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php index 744fb6b3ee..d51453f469 100644 --- a/inc/pool/pool-user.php +++ b/inc/pool/pool-user.php @@ -93,14 +93,14 @@ if (SQL_NUMROWS($result_main) > 0) { // We can now send mails to them... foreach ($receiverS as $key => $userid) { // Lookup user id - //* DEBUG: */ outputHtml("*L:".__LINE__.'/'.SQL_NUMROWS($result_user)."*
"); + //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.SQL_NUMROWS($result_user).'*'); if (fetchUserData($userid)) { // Do we have a stats entry? $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1", array($DATA['id'], $DATA['sender'], $DATA['timestamp']), __FILE__, __LINE__); // If there's no stats entry add it! - //* DEBUG: */ outputHtml("!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!
"); + //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!'); if (SQL_NUMROWS($result_stats) == 0) { // No entry was found, so we add him! SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats` (`pool_id` , `userid`, `cat_id`, `payment_id`, `subject`, `url` , `max_rec` , `timestamp_ordered`, `timestamp_sstart`) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())", @@ -111,13 +111,13 @@ if (SQL_NUMROWS($result_main) > 0) { array(bigintval($DATA['id']), bigintval($DATA['sender']), bigintval($DATA['timestamp'])), __FILE__, __LINE__); } // END - if - //* DEBUG: */ outputHtml("!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!
"); + //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!'); if (SQL_NUMROWS($result_stats) == 1) { // We got one! list($stats_id) = SQL_FETCHROW($result_stats); // Mark this user as "spammed" ;-) And place a line for him... - //* DEBUG: */ outputHtml("?L:".__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender'].")/".$DATA['id'].'/'.$stats_id."?
"); + //* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender'].')/'.$DATA['id'].'/'.$stats_id.'?'); switch (removeReceiver($dummy, $key, bigintval($userid), bigintval($DATA['id']), bigintval($stats_id))) { case 'done': // Prepare the mail @@ -151,25 +151,25 @@ if (SQL_NUMROWS($result_main) > 0) { // Update mediadata if version is 0.0.4 or higher if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) { // Update entry (or add missing) - //* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*
"); + //* DEBUG: */ debugOutput('*MEDIA/L:'.__LINE__.'*'); updateMediadataEntry(array('total_send', 'normal_send'), 'add', 1); } // END - if // And count up the mail $GLOBALS['pool_cnt']++; - //* DEBUG: */ outputHtml("*EXIT/L:".__LINE__.'/'.$GLOBALS['pool_cnt']."*
"); + //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'*'); break; case 'already': // Entry already found, but we still count one up! $GLOBALS['pool_cnt']++; - //* DEBUG: */ outputHtml("*EXIT/L:".__LINE__.'/'.$GLOBALS['pool_cnt']."
"); + //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$GLOBALS['pool_cnt']); break; } } // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt']) - //* DEBUG: */ outputHtml("*L:".__LINE__.'/'.$GLOBALS['pool_cnt'].">=".$DATA['target_send'].'/'.getConfig('max_send').">=".$GLOBALS['pool_cnt'].'/'.$lastSentId."!=".$DATA['id']."*
"); + //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'>='.$DATA['target_send'].'/'.getConfig('max_send').'>='.$GLOBALS['pool_cnt'].'/'.$lastSentId.'!='.$DATA['id'].'*'); if ((($GLOBALS['pool_cnt'] >= $DATA['target_send'])) && ($lastSentId != $DATA['id'])) { // Prepare content $content = array( @@ -206,11 +206,11 @@ if (SQL_NUMROWS($result_main) > 0) { // Update mediadata if version is 0.0.4 or higher if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) { // Update entry (or add missing) - //* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*
"); + //* DEBUG: */ debugOutput('*MEDIA/L:'.__LINE__.'*'); updateMediadataEntry(array('total_orders', 'normal_orders'), 'add', 1); } // END - if - //* DEBUG: */ outputHtml("*EXIT/L:".__LINE__.'/'.$P."
"); + //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$P); break; } // Do we have send maximum mails? @@ -224,7 +224,7 @@ if (SQL_NUMROWS($result_main) > 0) { bigintval($DATA['id']) ), __FILE__, __LINE__); - //* DEBUG: */ outputHtml("*EXIT/L:".__LINE__."*
"); + //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'*'); break; } diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index 6071b76d86..2694fb51aa 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -79,14 +79,14 @@ WHERE ORDER BY `userid` ASC", __FILE__, __LINE__); -//* DEBUG: */ outputHtml(basename(__FILE__).":payout=0;daily|numRows=".SQL_NUMROWS($result_daily)."
"); +//* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;daily|numRows=' . SQL_NUMROWS($result_daily)); if (SQL_NUMROWS($result_daily) > 0) { // Init SQLs initSqls(); // Start checking accounts which are on 0 confirmed-to-go mails while ($content = SQL_FETCHARRAY($result_daily)) { - //* DEBUG: */ outputHtml(basename(__FILE__).":userid={$content['userid']}
"); + //* DEBUG: */ debugOutput(basename(__FILE__) . ':' . $content['userid']); $result_points = SQL_QUERY_ESC("SELECT `ref_depth`, `locked_points` @@ -99,14 +99,14 @@ ORDER BY `ref_depth` ASC", array(bigintval($content['userid'])), __FILE__, __LINE__); - //* DEBUG: */ outputHtml(basename(__FILE__).":payout=0;points|numRows=".SQL_NUMROWS($result_points)."
"); + //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . SQL_NUMROWS($result_points)); if (SQL_NUMROWS($result_points) > 0) { // Ok transfer points while ($content2 = SQL_FETCHARRAY($result_points)) { // Merge both arrays $content = merge_array($content, $content2); - //* DEBUG: */ outputHtml(basename(__FILE__).":userid={$content['userid']},depth={$content['ref_depth']},locked={$content['locked_points']}
"); + //* DEBUG: */ debugOutput(basename(__FILE__) . ':userid=' . $content['userid'].',depth='.$content['ref_depth'].',locked='.$content['locked_points']); addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET diff --git a/inc/revision-functions.php b/inc/revision-functions.php index 2b4b74702a..a87bfc4886 100644 --- a/inc/revision-functions.php +++ b/inc/revision-functions.php @@ -78,7 +78,7 @@ function getActualVersion ($type = 'Revision') { // Get array for mapping information $mapper = array_flip(getSearchFor()); - //* DEBUG: */ print('
mapper='.print_r($mapper, true).'
ins_vers=
'.print_r($ins_vers, true).'
'); + //* DEBUG: */ debugOutput('
mapper='.print_r($mapper, true).'
ins_vers=
'.print_r($ins_vers, true).'
'); // Is the content valid? if ((!is_array($ins_vers)) || (count($ins_vers) <= 0) || (!isset($ins_vers[$mapper[$type]])) || (trim($ins_vers[$mapper[$type]]) == '') || ($ins_vers[0]) == 'new') { diff --git a/inc/sql-functions.php b/inc/sql-functions.php index 0d70454396..712bc1967a 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -115,7 +115,7 @@ function countSqls () { // Checks wether the SQLs array is filled function isSqlsValid () { - //* DEBUG: */ print __FUNCTION__.':'.intval(isSqlsInitialized()).'/'.countSqls().'/'.getCurrentExtensionName().'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.intval(isSqlsInitialized()).'/'.countSqls().'/'.getCurrentExtensionName()); return ( ( isSqlsInitialized() diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 5bc89a05f3..ff399cbf86 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -722,7 +722,7 @@ function isExtensionInstalledAndNewer ($ext_name, $version) { } // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version]).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version])); return $GLOBALS['ext_installed_newer'][$ext_name][$version]; } @@ -737,7 +737,7 @@ function isExtensionInstalledAndOlder ($ext_name, $version) { } // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version]).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version])); return $GLOBALS['ext_installed_older'][$ext_name][$version]; } @@ -1044,5 +1044,10 @@ function getTotalConfirmedUser () { return $GLOBALS['total_confirmed_users']; } +// Wrapper for writing debug informations to the browser +function debugOutput ($message) { + outputHtml('
' . $message . '
'); +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_list_rallye_usr_row.tpl b/templates/de/html/admin/admin_list_rallye_usr_row.tpl index dd00d82559..de9f9d126c 100644 --- a/templates/de/html/admin/admin_list_rallye_usr_row.tpl +++ b/templates/de/html/admin/admin_list_rallye_usr_row.tpl @@ -4,9 +4,12 @@ href="{%url=modules.php?module=admin&what=list_user&userid=$content[userid]%}">$content[userid]$content[bold_r] - $content[bold_l]$content[old]$content[bold_r] + $content[bold_l]$content[rews]$content[bold_r] + - $content[bold_l]$content[cnt]$content[bold_r] + $content[bold_l]$content[cnt]$content[bold_r] + - $content[bold_l]$content[opoints]$content[bold_r] + $content[bold_l]{%pipe,translateComma=$content[opoints]%}$content[bold_r] + diff --git a/templates/de/html/admin/admin_list_rallyes_row.tpl b/templates/de/html/admin/admin_list_rallyes_row.tpl index abd0d8c084..c11b7d4b1b 100644 --- a/templates/de/html/admin/admin_list_rallyes_row.tpl +++ b/templates/de/html/admin/admin_list_rallyes_row.tpl @@ -10,7 +10,7 @@ {--RALLYE_ADMIN_ID--}:
- $content[admin_link] + {%pipe,generateAdminLink=$content[admin_id]%} {--RALLYE_TSTART--}:
@@ -28,29 +28,29 @@ {--RALLYE_AUTO_ADD--}:
- $content[auto_lnk] + {%pipe,translateYesNo=$content[auto_add_new_user]%} {--RALLYE_ACTIVE--}:
- $content[active_lnk] + {%pipe,translateYesNo=$content[is_active]%} {--RALLYE_NOTIFY--}:
- $content[notify_lnk] + {%pipe,translateYesNo=$content[send_notify]%} {--RALLYE_NOTIFIED--}:
- $content[notified] + {%pipe,translateYesNo=$content[notified]%} {--RALLYE_ASSIGNED_PRICES--}:
- $content[prices_cnt] + {%pipe,translateComma=$content[prices_cnt]%} {--RALLYE_ASSIGNED_USERS--}:
- $content[joined] + $content[users_content] -- 2.39.2