More SQLs rewritten fix_menu.php is now 'pool-ed'
authorRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 03:35:07 +0000 (03:35 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 03:35:07 +0000 (03:35 +0000)
inc/extensions/ext-menu.php
inc/functions.php
inc/libs/bonus_functions.php
inc/libs/rewrite_functions.php
inc/modules/admin/what-config_register2.php
inc/modules/guest/what-register.php
inc/modules/member/what-order.php
inc/modules/member/what-transfer.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/mysql-manager.php

index 81cbb4137c341fa939aecdb247524a618d4d4581..73ba5e07d3a30fd2606bbf7903086f7f83df5305 100644 (file)
@@ -87,7 +87,7 @@ switch (getExtensionMode()) {
 
                        case '0.0.2': // SQL queries for v0.0.2
                                // Load the fix include
-                               loadIncludeOnce('inc/fix_menu.php');
+                               addIncludeToPool('extension', 'inc/fix_menu.php');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Doppelte Men&uuml;punkte bereinigt.");
index 7b074a4a556feeb40c14ad00ef90e2e90e04129f..6bf29c4d55a029c564f6c86a177eea2e803b1fe8 100644 (file)
@@ -636,12 +636,12 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
        if (empty($isHtml)) $isHtml = 'N';
        if (isDebugModeEnabled()) {
                // In debug mode we want to display the mail instead of sending it away so we can debug this part
-               outputHtml("<pre>
-".htmlentities(trim($mailHeader))."
-To      : " . $toEmail."
-Subject : " . $subject."
-Message : " . $message."
-</pre>\n");
+               outputHtml('<pre>
+Headers : ' . htmlentities(trim($mailHeader)) . '
+To      : ' . $toEmail . '
+Subject : ' . $subject . '
+Message : ' . $message . '
+</pre>');
        } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) {
                // Send mail as HTML away
                sendHtmlEmail($toEmail, $subject, $message, $mailHeader);
index 4c99ef6a3e51e920c5d6cd653d6701252fd6f78f..678c68c6ba03267cdd30680996cf7c51810eb09f 100644 (file)
@@ -93,7 +93,10 @@ function addTurboBonus ($mid, $userid, $type) {
 
        // Add points to his account directly
        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `turbo_bonus`=`turbo_bonus`+%s WHERE `userid`=%s LIMIT 1",
-               array(bigintval($userid), $points), __FUNCTION__, __LINE__);
+               array(
+                       bigintval($userid),
+                       $points
+               ), __FUNCTION__, __LINE__);
 
        // Rember this whole data for displaying ranking list
        SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`, `mail_id`, `bonus_id`, `level`, `points`, `timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())",
@@ -121,7 +124,13 @@ function addBonusRanks ($data, $type, $userid) {
 
        // Load current user's data
        $result = SQL_QUERY_ESC("SELECT `level`, `points`, `timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND `userid`=%s LIMIT 1",
-               array($type, $data, $userid), __FUNCTION__, __LINE__);
+               array(
+                       $type,
+                       $data,
+                       $userid
+               ), __FUNCTION__, __LINE__);
+
+       // Entry found?
        if (SQL_NUMROWS($result) == 1) {
                // Load data
                $GLOBALS['ranking_content'] = merge_array($GLOBALS['ranking_content'], SQL_FETCHARRAY($result));
@@ -139,8 +148,8 @@ function addBonusRanks ($data, $type, $userid) {
        } // END - if
 
        // Load rankings
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE %s=%s ORDER BY `level` ASC LIMIT %s",
-               array($type, $data, getConfig('bonus_lines')), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE %s=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}",
+               array($type, $data), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Start generating the ranking list
                $max = SQL_NUMROWS($result);
@@ -262,7 +271,7 @@ function handleBonusPoints ($mode) {
                                $dummy = subtractPointsFromJackpot($points);
                        }
                        break;
-       }
+       } // END - switch
 }
 
 // Purges expired fast-click bonus entries
@@ -276,5 +285,5 @@ function purgeExpiredTurboBonus() {
        } // END - if
 }
 
-//
+// [EOF]
 ?>
index c7ed9f91f5c66374cb3ba9162f3e1e3a7f07213d..83d131c421de7dfa1d6bd70f0bf3c44dd159aa08 100644 (file)
@@ -68,13 +68,13 @@ function rewriteLinksInCode ($HTML) {
        $target2 = preg_quote($target, '/');
 
        // Action variable
-       $action = $target."\$1/act/";
+       $action = $target . '$1/act/';
 
        // Convert &amp;|&action=...
        $output = preg_replace('/' . $target2 . '(.*)&amp;action=/i', $action, $output);
 
        // "The same procedure as last variable"... now for &amp;what=
-       $what = $target."\$1/wht/";
+       $what = $target.'$1/wht/';
        $output = preg_replace('/' . $target2 . '(.*)&amp;what=/i', $what, $output);
 
        // Repair missed &amp;what=??? entries
index 726fae8205ef74d51272fc82d5741766dce3d052..2fe8f5bc132fe76839209650cacc0e377167be9b 100644 (file)
@@ -49,10 +49,10 @@ if (isFormSent()) {
 } else {
        // Remember stuff in constants
        $content['display_refid']      = addSelectionBox('yn', getConfig('display_refid')     , 'display_refid');
-       $content['ip_timeout']         = createTimeSelections(getConfig('ip_timeout')       , 'ip_timeout', 'Dhm');
+       $content['ip_timeout']         = createTimeSelections(getConfig('ip_timeout')         , 'ip_timeout', 'Dhm');
        $content['check_double_email'] = addSelectionBox('yn', getConfig('check_double_email'), 'check_double_email');
        $content['check_double_pass']  = addSelectionBox('yn', getConfig('check_double_pass') , 'check_double_pass');
-       $content['register_default']   =addSelectionBox('yn', getConfig('register_default')  , 'register_default');
+       $content['register_default']   = addSelectionBox('yn', getConfig('register_default')  , 'register_default');
 
        // Load normal template
        loadTemplate('admin_config_register2', false, $content);
index 39cd91546eb6c1ef1e0d51f099c6487a9366f684..b53d0bdaedbb9d31c3163d716c566c41b02abd05 100644 (file)
@@ -290,8 +290,8 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
                if (getConfig('ref_payout') > 0) $locked = 'locked_points';
 
                // @TODO Rewrite this to addPointsDirectly()
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `".$locked."`) VALUES (%s,0,'%s')",
-                       array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `".$locked."`) VALUES (%s,0,'{?points_register?}')",
+                       array(bigintval($userid)), __FILE__, __LINE__);
 
                // Update mediadata as well
                if ((getExtensionVersion('mediadata') >= '0.0.4') && ($locked == 'points')) {
index c2139f52eab7b237f2fd240fc0c6817f225514c1..da97a0a3d36b2930c7f4b968f82ad37379398680 100644 (file)
@@ -470,8 +470,12 @@ LEFT JOIN
 ON
        d.userid=h.userid
 WHERE
-       d.userid=%s AND d.receive_mails > 0 AND d.`status`='CONFIRMED' AND d.`holiday_active`='Y' AND
-       h.holiday_start < UNIX_TIMESTAMP() AND h.holiday_end > UNIX_TIMESTAMP()
+       d.userid=%s AND
+       d.receive_mails > 0 AND
+       d.`status`='CONFIRMED' AND
+       d.`holiday_active`='Y' AND
+       h.holiday_start < UNIX_TIMESTAMP() AND
+       h.holiday_end > UNIX_TIMESTAMP()
 LIMIT 1",
                                                        array(bigintval($ucat)), __FILE__, __LINE__);
 
index 7f0f3268deb4d3350fcec7f1a3d5de708fbdabdd..5c4db42a09e3f96e6f854eea4569b756227a2d50 100644 (file)
@@ -389,8 +389,8 @@ KEY (`party_userid`)
                SQL_FREERESULT($result);
 
                // As the last table transfer data from outgoing table to temporary
-               $result = SQL_QUERY_ESC("SELECT `trans_id`, `to_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `id` LIMIT %s",
-                       array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `trans_id`, `to_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `id` LIMIT {?transfer_max?}",
+                       array(getUserId()), __FILE__, __LINE__);
                while ($DATA = SQL_FETCHROW($result)) {
                        $DATA[] = 'OUT';
                        $DATA = implode("','", $DATA);
index f9949262771bccc73fb1287a3d7c25b34c081927..857e65636e696eb93998eddbb6d12826e8a08548 100644 (file)
@@ -58,7 +58,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC
        // Shall we exclude webmaster's own userid?
        if ((getConfig('beg_include_own') != 'Y') && (getConfig('beg_userid') > 0)) {
                // Exclude it
-               $whereStatement1 = sprintf(" AND `userid` != %s", getConfig('beg_userid'));
+               $whereStatement1 = " AND `userid` != {?beg_userid?}";
        } // END - if
 
        // Let's check if there are some points left we can 'pay'...
@@ -66,7 +66,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC
                // Use last online stamp only when autopurge for inactive members is activated
                if ((getConfig('ap_inactive_since') > 0) && (getConfig('beg_active') == 'Y')) {
                        // Okay, include last online timestamp
-                       $whereStatement1 .= sprintf(" AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+                       $whereStatement1 .= " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
                } // END - if
        } // END - if
 
@@ -76,9 +76,11 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
-       `status`='CONFIRMED'" . $whereStatement1 . " AND `beg_points` > 0
+       `status`='CONFIRMED'" . $whereStatement1 . " AND
+       `beg_points` > 0
 ORDER BY
-       `beg_points` DESC, `userid` ASC
+       `beg_points` DESC,
+       `userid` ASC
 LIMIT {?beg_ranks?}", __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result_main) > 0) {
index 446b3e26ddbe92191eab94a05ea879762c83b44b..2bbe3d92017db5fa7d33de7f7904cc447c5629df 100644 (file)
@@ -60,7 +60,7 @@ if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && (get
                // Use last online stamp only when autopurge for inactive members is activated
                if (getConfig('ap_inactive_since') > 0) {
                        // Okay, include last online timestamp
-                       $whereStatement1 = sprintf("WHERE `status`='CONFIRMED' AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+                       $whereStatement1 = "WHERE `status`='CONFIRMED' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
                        $whereStatement2 = getConfig('bonus_ranks');
                } // END - if
        } // END - if
@@ -88,7 +88,7 @@ ORDER BY
        `points` DESC,
        `userid` ASC
 LIMIT %s",
-       array($whereStatement2), __FILE__, __LINE__);
+               array($whereStatement2), __FILE__, __LINE__);
 
        // Some entries were found?
        if (SQL_NUMROWS($result_main) > 0) {
@@ -100,7 +100,7 @@ LIMIT %s",
                                addPointsDirectly('monthly_bonus', $content['userid'], $content['points']);
 
                                // Translate gender/points
-                               $content['gender']       = translateGender($content['gender']);
+                               $content['gender'] = translateGender($content['gender']);
                                $content['points'] = translateComma($content['points']);
 
                                // Load email template and email it away
@@ -110,8 +110,13 @@ LIMIT %s",
                } // END - while
 
                // Reset accounts
-               $result = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data`
-SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0", __FILE__, __LINE__);
+               $result = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data`
+SET
+       `turbo_bonus`=0,
+       `login_bonus`=0,
+       `bonus_order`=0,
+       `bonus_stats`=0,
+       `bonus_ref`=0', __FILE__, __LINE__);
        } // END - if
 
        // Free memory
index 9aa35d0f2d7b07d3d9e39e2b69fda346afd3902b..311fdb0a19483dedccb8b8e199d737f1974f5084 100644 (file)
@@ -134,10 +134,10 @@ function checkModulePermissions ($mod = '') {
        // Check for prefix is a extension...
        $modSplit = explode('_', $mod);
        $extension = ''; $mod_chk = $mod;
-       //* DEBUG: */ outputHtml(__LINE__."*".count($modSplit)."*/".$mod."*<br />");
+       //* DEBUG: */ print(__LINE__."*".count($modSplit)."*/".$mod."*<br />");
        if (count($modSplit) == 2) {
                // Okay, there is a seperator (_) in the name so is the first part a module?
-               //* DEBUG: */ outputHtml(__LINE__."*".$modSplit[0]."*<br />");
+               //* DEBUG: */ print(__LINE__."*".$modSplit[0]."*<br />");
                if (isExtensionActive($modSplit[0])) {
                        // The prefix is an extension's name, so let's set it
                        $extension = $modSplit[0]; $mod = $modSplit[1];
@@ -381,9 +381,9 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru
                        $OUT = $prefix . "<strong><a class=\"you_are_here\" href=\"{?URL?}/modules.php?module=" . $modCheck . '&amp;' . $type . '=' . $search.$LINK_ADD . "\">" . $ret . "</a></strong>\n";
 
                        // Can we close the you-are-here navigation?
-                       //* DEBUG: */ outputHtml(__LINE__."*".$type.'/'.getWhat()."*<br />");
+                       //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*<br />");
                        if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
-                               //* DEBUG: */ outputHtml(__LINE__.'+'.$type."+<br />");
+                               //* DEBUG: */ print(__LINE__.'+'.$type."+<br />");
                                // Add closing div and br-tag
                                $OUT .= "</div><br />\n";
                                $GLOBALS['nav_depth'] = 0;
@@ -428,12 +428,12 @@ function addMenu ($mode, $action, $what) {
        $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort` ASC",
                array($mode), __FUNCTION__, __LINE__);
 
-       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
+       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
        if (SQL_NUMROWS($result_main) > 0) {
                // There are menus available, so we simply display them... :)
                $GLOBALS['rows'] = '';
                while ($content = SQL_FETCHARRAY($result_main)) {
-                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*<br />");
+                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*<br />");
                        // Init variables
                        enableBlockMode(false);
                        $action = $content['action'];
@@ -462,7 +462,7 @@ function addMenu ($mode, $action, $what) {
                                        $OUT = '';
 
                                        // Full file name for checking menu
-                                       //* DEBUG: */ outputHtml(__LINE__.":!!!!".$content['sub_what']."!!!<br />");
+                                       //* DEBUG: */ print(__LINE__.":!!!!".$content['sub_what']."!!!<br />");
                                        $inc = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']);
                                        if (isIncludeReadable($inc)) {
                                                // Mark currently selected menu - open
@@ -517,17 +517,17 @@ function addMenu ($mode, $action, $what) {
                                if (isFileReadable($INC)) {
                                        // Load include file
                                        if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode);
-                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
                                        loadInclude($INC);
-                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
                                        if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode);
                                }
-                               //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
+                               //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
                        }
 
                        $main_cnt++;
 
-                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
+                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
                        if (SQL_NUMROWS($result_main) > $main_cnt) {
                                // Add seperator
                                $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
@@ -562,7 +562,7 @@ function addMenu ($mode, $action, $what) {
                );
 
                // Load main template
-               //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
+               //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
                loadTemplate('menu_table', false, $content);
        } // END - if
 }
@@ -613,12 +613,12 @@ function isMember () {
                                $ret = true;
                        } else {
                                // Maybe got locked etc.
-                               //* DEBUG: */ outputHtml(__LINE__."!!!<br />");
+                               //* DEBUG: */ print(__LINE__."!!!<br />");
                                destroyUserSession();
                        }
                } else {
                        // Cookie data is invalid!
-                       //* DEBUG: */ outputHtml(__LINE__."***<br />");
+                       //* DEBUG: */ print(__LINE__."***<br />");
                        destroyUserSession();
                }
 
@@ -626,7 +626,7 @@ function isMember () {
                SQL_FREERESULT($result);
        } else {
                // Cookie data is invalid!
-               //* DEBUG: */ outputHtml(__LINE__."///<br />");
+               //* DEBUG: */ print(__LINE__."///<br />");
                destroyUserSession();
        }
 
@@ -641,7 +641,7 @@ function isMember () {
 function isAdmin ($admin = '') {
        // Init variables
        $ret = false; $passCookie = ''; $valPass = '';
-       //* DEBUG: */ outputHtml(__LINE__."ADMIN:".$admin."<br />");
+       //* DEBUG: */ print(__LINE__."ADMIN:".$admin."<br />");
 
        // If admin login is not given take current from cookies...
        if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
@@ -649,7 +649,7 @@ function isAdmin ($admin = '') {
                $admin = getSession('admin_login');
                $passCookie = getSession('admin_md5');
        } // END - if
-       //* DEBUG: */ outputHtml(__LINE__."ADMIN:".$admin.'/'.$passCookie."<br />");
+       //* DEBUG: */ print(__LINE__."ADMIN:".$admin.'/'.$passCookie."<br />");
 
        // Search in array for entry
        if (isset($GLOBALS['admin_hash'])) {
@@ -783,7 +783,7 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) {
        $add = '';
        if ((!isAdmin()) && ($mode != 'admin')) $add = " AND `locked`='N'";
 
-       //* DEBUG: */ outputHtml(__LINE__.':'.$mode.'/'.$action.'/'.$what."*<br />");
+       //* DEBUG: */ print(__LINE__.':'.$mode.'/'.$action.'/'.$what."*<br />");
        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",
@@ -944,7 +944,7 @@ function getModeAction ($mode, $what) {
        // Init status
        $ret = '';
 
-       //* DEBUG: */ outputHtml(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=<br />");
+       //* DEBUG: */ print(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=<br />");
        if ((empty($what)) && ($mode != 'admin')) {
                $what = getConfig('index_home');
        } // END - if
@@ -965,7 +965,7 @@ function getModeAction ($mode, $what) {
                // Get it directly from URL
                return getAction();
        }
-       //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />");
 
        // Does the module have a menu?
        if (ifModuleHasMenu($mode)) {
@@ -1115,7 +1115,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $
 // Calculate sum (default) or count records of given criteria
 function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '') {
        $ret = 0;
-       //* DEBUG: */ outputHtml($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'<br />');
+       //* DEBUG: */ print($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'<br />');
        if ((empty($search)) && ($search != '0')) {
                // Count or sum whole table?
                if ($countRows === true) {
@@ -1129,12 +1129,12 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
                }
        } elseif (($countRows === true) || ($lookFor == 'userid')) {
                // Count rows
-               //* DEBUG: */ outputHtml("COUNT!<br />");
+               //* DEBUG: */ print("COUNT!<br />");
                $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
                        array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
        } else {
                // Add all rows
-               //* DEBUG: */ outputHtml("SUM!<br />");
+               //* DEBUG: */ print("SUM!<br />");
                $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
                        array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
        }
@@ -1206,7 +1206,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: */ outputHtml("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
+       //* DEBUG: */ print("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
 
@@ -1235,12 +1235,12 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
        // Count up referal depth
        if (!isset($GLOBALS['ref_level'])) {
                // Initialialize referal system
-               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal system initialized!<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal system initialized!<br />");
                $GLOBALS['ref_level'] = 0;
        } else {
                // Increase referal level
                $GLOBALS['ref_level']++;
-               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />");
        }
 
        // Default is 'normal' points
@@ -1253,7 +1253,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
        $result_user = SQL_QUERY_ESC("SELECT `refid`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
                array(bigintval($userid)), __FUNCTION__, __LINE__);
 
-       //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},numRows=".SQL_NUMROWS($result_user).",points={$points}<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},numRows=".SQL_NUMROWS($result_user).",points={$points}<br />");
        if (SQL_NUMROWS($result_user) == 1) {
                // This is the user and his ref
                list($ref, $email) = SQL_FETCHROW($result_user);
@@ -1261,32 +1261,32 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
 
                // Get percents
                $per = getReferalLevelPercents($GLOBALS['ref_level']);
-               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />");
 
                // Some percents found?
                if ($per > 0) {
                        // Calculate new points
-                       //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />");
+                       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />");
                        $ref_points = $points * $per / 100;
 
                        // Pay refback here if level > 0 and in ref-mode
                        if ((isExtensionActive('refback')) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($GLOBALS['cache_array']['add_userid'][$userid]))) {
-                               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />");
+                               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />");
                                $ref_points = addRefbackPoints($GLOBALS['cache_array']['add_userid'][$userid], $userid, $points, $ref_points);
-                               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />");
+                               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />");
                        } // END - if
 
                        // Update points...
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1",
                                array($data, $data, $ref_points, bigintval($userid), bigintval($GLOBALS['ref_level'])), __FUNCTION__, __LINE__);
-                       //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />");
+                       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />");
 
                        // No entry updated?
                        if (SQL_AFFECTEDROWS() < 1) {
                                // First ref in this level! :-)
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,'%s',%s)",
                                        array($data, bigintval($userid), bigintval($GLOBALS['ref_level']), $ref_points), __FUNCTION__, __LINE__);
-                               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")<br />");
+                               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")<br />");
                        } // END - if
 
                        // Points updated, maybe I shall send him an email?
@@ -1321,7 +1321,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                        // Maybe there's another ref?
                        if (($ref > 0) && ($points > 0) && ($ref != $userid) && ($add_mode == 'ref')) {
                                // Then let's credit him here...
-                               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref={$ref},points={$points} - ADVANCE!<br />");
+                               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref={$ref},points={$points} - ADVANCE!<br />");
                                addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $sendNotify, $ref, $locked);
                        } // END - if
                } // END - if
@@ -1329,26 +1329,26 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
 
        // Free result
        SQL_FREERESULT($result_user);
-       //* DEBUG: */ outputHtml("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
+       //* DEBUG: */ print("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
 }
 
 // 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: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}<br />");
 
        // 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: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS()."<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS()."<br />");
        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: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid}<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid}<br />");
        } // END - if
 
        // Check for his referal
@@ -1360,16 +1360,16 @@ function updateReferalCounter ($userid) {
 
        // Free memory
        SQL_FREERESULT($result);
-       //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref={$ref}<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref={$ref}<br />");
 
        // When he has a referal...
        if (($ref > 0) && ($ref != $userid)) {
                // Move to next referal level and count his counter one up!
-               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />");
                $GLOBALS['cache_array']['ref_level'][$userid]++; updateReferalCounter($ref);
        } elseif ((($ref == $userid) || ($ref == 0)) && (getExtensionVersion('cache') >= '0.1.2')) {
                // Remove cache here
-               //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />");
+               //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />");
                rebuildCacheFile('refsystem', 'refsystem');
        }
 
@@ -1710,7 +1710,7 @@ function getWhatFromModule ($modCheck) {
        // Default is empty
        $what = '';
 
-       //* DEBUG: */ outputHtml(__LINE__.'!'.$modCheck."!<br />");
+       //* DEBUG: */ print(__LINE__.'!'.$modCheck."!<br />");
        switch ($modCheck) {
                case 'admin':
                        $what = 'overview';
@@ -1936,12 +1936,18 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
 
        if ((isExtensionActive('html_mail')) && ($mode == 'html')) {
                // Only include HTML receivers
-               $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.`html`='Y'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
-               array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.`html`='Y'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
+                       array(
+                               $cat,
+                               $receiver
+                       ), __FUNCTION__, __LINE__);
        } else {
                // Include all
-               $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
-               array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
+                       array(
+                               $cat,
+                               $receiver
+                       ), __FUNCTION__, __LINE__);
        }
 
        // Entries found?
@@ -2027,7 +2033,7 @@ function insertUserStatsRecord ($userid, $type, $data) {
 
 // "Getter" for array for user refs and points in given level
 function getUserReferalPoints ($userid, $level) {
-       //* DEBUG: */ outputHtml("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
+       //* DEBUG: */ print("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
        // Default is no refs and no nickname
        $add = '';
        $refs = array();
@@ -2100,7 +2106,7 @@ ORDER BY ur.refid ASC",
        SQL_FREERESULT($result);
 
        // Return result
-       //* DEBUG: */ outputHtml("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
+       //* DEBUG: */ print("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
        return $refs;
 }