Next wave of lesser getMessage() usage and more EL
[mailer.git] / inc / mysql-manager.php
index 362fa1f780bf587cc14baf6c8844f1b2547aa897..e6d61fbcbe25e36d0312babafc41704ac8bf3bcf 100644 (file)
@@ -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."*<br />");
+       //* 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]."*<br />");
+               //* 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];
@@ -302,6 +302,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
        $LINK_ADD = '';
        $OUT = '';
        $ADD = '';
+       $prefix = '';
 
        // First we have to do some analysis...
        if (substr($file, 0, 7) == 'action-') {
@@ -344,11 +345,19 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
 
        // Begin the navigation line
        if ((!isset($GLOBALS['nav_depth'])) && ($return === false)) {
+               // Init nav_depth
                $GLOBALS['nav_depth'] = '0';
-               $prefix = '<div class="you_are_here">{--YOU_ARE_HERE--}&nbsp;<strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $LINK_ADD . '%}">Home</a></strong>';
-       } else {
-               if ($return === false) $GLOBALS['nav_depth']++;
-               $prefix = '';
+
+               // Run the pre-filter chain
+               $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ''));
+
+               // Add pre-content
+               $prefix = $ret['content'];
+
+               $prefix .= '<div class="you_are_here">{--YOU_ARE_HERE--}&nbsp;<strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $LINK_ADD . '%}">Home</a></strong>';
+       } elseif ($return === false) {
+               // Count depth
+               $GLOBALS['nav_depth']++;
        }
 
        $prefix .= '&nbsp;-&gt;&nbsp;';
@@ -364,20 +373,20 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
                $OUT = $prefix . '<strong><a class="you_are_here" href="{%url=modules.php?module=' . $modCheck . '&amp;' . $type . '=' . $search . $LINK_ADD . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
 
                // Can we close the you-are-here navigation?
-               //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*<br />");
+               //* DEBUG: */ debugOutput(__LINE__.'*'.$type.'/'.getWhat().'*');
                if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
-                       //* DEBUG: */ print(__LINE__.'+'.$type."+<br />");
+                       //* DEBUG: */ debugOutput(__LINE__.'+'.$type.'+');
                        // Add closing div and br-tag
-                       $OUT .= '</div><br />';
+                       $OUT .= '</div>';
                        $GLOBALS['nav_depth'] = '0';
 
-                       // Run the filter chain
+                       // Run the post-filter chain
                        $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ''));
 
                        // Add additional content
                        $OUT .= $ret['content'];
                } // END - if
-       }
+       } // END - if
 
        // Return or output HTML code?
        if ($return === true) {
@@ -406,24 +415,44 @@ function addMenu ($mode, $action, $what) {
        } // END - if
 
        // Load SQL data and add the menu to the output stream...
-       $result_main = SQL_QUERY_ESC("SELECT `title`, `action`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$ADD." ORDER BY `sort` ASC",
+       $result_main = SQL_QUERY_ESC("SELECT
+       `title`, `what`, `action`, `visible`, `locked`
+FROM
+       `{?_MYSQL_PREFIX?}_%s_menu`
+WHERE
+       (`what`='' OR `what` IS NULL)
+       ".$ADD."
+ORDER BY
+       `sort` ASC",
                array($mode), __FUNCTION__, __LINE__);
 
-       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
+       //* 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()."*<br />");
-                       // Init/"translate" variables
+                       //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . ':' . getWhat() . '*');
+                       // Disable the block-mode
                        enableBlockMode(false);
-                       $content = translateMenuVisibleLocked($content);
 
                        // Load menu header template
                        $GLOBALS['rows'] .= loadTemplate($mode . '_menu_title', true, $content);
 
                        // Sub menu
-                       $result_sub = SQL_QUERY_ESC("SELECT `title` AS sub_title, `what` AS sub_what, `visible` AS sub_visible, `locked` AS sub_locked FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$ADD." ORDER BY `sort` ASC",
+                       $result_sub = SQL_QUERY_ESC("SELECT
+       `title` AS `sub_title`,
+       `what` AS `sub_what`,
+       `visible` AS `sub_visible`,
+       `locked` AS `sub_locked`
+FROM
+       `{?_MYSQL_PREFIX?}_%s_menu`
+WHERE
+       `action`='%s' AND
+       `what` != '' AND
+       `what` IS NOT NULL
+       ".$ADD."
+ORDER BY
+       `sort` ASC",
                                array($mode, $content['action']), __FUNCTION__, __LINE__);
 
                        // Do we have some entries?
@@ -436,14 +465,11 @@ function addMenu ($mode, $action, $what) {
                                        // Merge both arrays in one
                                        $content = merge_array($content, $content2);
 
-                                       // Translate visible/locked again
-                                       $content = translateMenuVisibleLocked($content, 'sub_');
-
                                        // Init content
                                        $OUT = '';
 
                                        // Full file name for checking menu
-                                       //* DEBUG: */ print(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!<br />');
+                                       //* 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
@@ -477,11 +503,11 @@ function addMenu ($mode, $action, $what) {
                                        $cnt++;
 
                                        // Rewrite array
-                                       $content =  array(
-                                               'menu'        => $OUT,
-                                               'what'        => $content['sub_what'],
-                                               'visible_css' => $content['sub_visible_css'],
-                                               'locked_css'  => $content['sub_locked_css']
+                                       $content = array(
+                                               'menu'    => $OUT,
+                                               'what'    => $content['sub_what'],
+                                               'visible' => $content['sub_visible'],
+                                               'locked'  => $content['locked'],
                                        );
 
                                        // Add regular menu row or bottom row?
@@ -500,12 +526,12 @@ 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: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat().'*');
                                        loadInclude($INC);
-                                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       //* 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()."*<br />");
+                               //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat().'*');
                        }
 
                        // Free result
@@ -514,7 +540,7 @@ function addMenu ($mode, $action, $what) {
                        // Count one up
                        $main_cnt++;
 
-                       //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
+                       //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.':'.getWhat().'*');
                        if (SQL_NUMROWS($result_main) > $main_cnt) {
                                // Add seperator
                                $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
@@ -549,7 +575,7 @@ function addMenu ($mode, $action, $what) {
                );
 
                // Load main template
-               //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
+               //* DEBUG: */ debugOutput(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat().'*');
                loadTemplate('menu_table', false, $content);
        } // END - if
 }
@@ -717,7 +743,7 @@ function isAdmin ($adminLogin = '') {
        $ret = false;
        $passCookie = '';
        $valPass = '';
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'<br />');
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin);
 
        // If admin login is not given take current from cookies...
        if ((empty($adminLogin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
@@ -725,7 +751,7 @@ function isAdmin ($adminLogin = '') {
                $adminLogin = getSession('admin_login');
                $passCookie = getSession('admin_md5');
        } // END - if
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'/'.$passCookie.'<br />');
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'/'.$passCookie);
 
        // Do we have cache?
        if (!isset($GLOBALS['is_admin'][$adminLogin])) {
@@ -851,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."*<br />");
+       //* 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
@@ -893,7 +930,7 @@ function getActionFromModuleWhat ($module, $what) {
        // Init status
        $data['action'] = '';
 
-       //* DEBUG: */ print(__LINE__.'='.$module.'/'.$what.'/'.getAction()."=<br />");
+       //* DEBUG: */ debugOutput(__LINE__.'='.$module.'/'.$what.'/'.getAction().'=');
        if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
                // sql_patches is missing so choose depending on mode
                if (isWhatSet()) {
@@ -927,7 +964,7 @@ function getActionFromModuleWhat ($module, $what) {
                // Get it directly from URL
                return getAction();
        }
-       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ret=' . $data['action'] . '<br />');
+       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ret=' . $data['action']);
 
        // Does the module have a menu?
        if (ifModuleHasMenu($module)) {
@@ -962,12 +999,12 @@ function getActionFromModuleWhat ($module, $what) {
 // Get category name back
 function getCategory ($cid) {
        // Default is not found
-       $data['cat'] = getMessage('_CATEGORY_404');
+       $data['cat'] = '{--_CATEGORY_404--}';
 
        // Is the category id set?
        if ($cid == '0') {
                // No category
-               $data['cat'] = getMessage('_CATEGORY_NONE');
+               $data['cat'] = '{--_CATEGORY_NONE--}';
        } elseif ($cid > 0) {
                // Lookup the category in database
                $result = SQL_QUERY_ESC("SELECT `cat` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
@@ -988,7 +1025,7 @@ function getCategory ($cid) {
 // Get a string of "mail title" and price back
 function getPaymentTitlePrice ($pid, $full=false) {
        // Default is not found
-       $ret = getMessage('_PAYMENT_404');
+       $ret = '{--_PAYMENT_404--}';
 
        // Load payment data
        $result = SQL_QUERY_ESC("SELECT `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
@@ -1079,7 +1116,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
        // Init count/sum
        $data['res'] = '0';
 
-       //* DEBUG: */ print($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'<br />');
+       //* DEBUG: */ debugOutput($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add);
        if ((empty($search)) && ($search != '0')) {
                // Count or sum whole table?
                if ($countRows === true) {
@@ -1093,12 +1130,12 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
                }
        } elseif (($countRows === true) || ($lookFor == 'userid')) {
                // Count rows
-               //* DEBUG: */ print("COUNT!<br />");
+               //* 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!<br />");
+               //* 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__);
        }
@@ -1119,7 +1156,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
        }
 
        // Return value
-       //* DEBUG: */ print 'ret=' . $data['res'] . '<br />';
+       //* DEBUG: */ debugOutput('ret=' . $data['res']);
        return $data['res'];
 }
 // Getter fro ref level percents
@@ -1171,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("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
+       //* DEBUG: */ debugOutput('----------------------- <font color="#00aa00">' . __FUNCTION__ . ' - ENTRY</font> ------------------------<ul><li>');
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
 
@@ -1200,12 +1237,12 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
        // Count up referal depth
        if (!isset($GLOBALS['ref_level'])) {
                // Initialialize referal system
-               //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): Referal system initialized!<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): Referal system initialized!');
                $GLOBALS['ref_level'] = '0';
        } else {
                // Increase referal level
                $GLOBALS['ref_level']++;
-               //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): Referal level increased. DEPTH='.$GLOBALS['ref_level']);
        }
 
        // Default is 'normal' points
@@ -1215,39 +1252,39 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
        if ($locked === true) $data = 'locked_points';
 
        // Check user account
-       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points}<br />");
+       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',points='.$points);
        if (fetchUserData($userid)) {
                // This is the user and his ref
                $GLOBALS['cache_array']['add_userid'][getUserData('refid')] = $userid;
 
                // Get percents
                $per = getReferalLevelPercents($GLOBALS['ref_level']);
-               //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',points='.$points.',depth='.$GLOBALS['ref_level'].',per='.$per.',mode='.$add_mode);
 
                // Some percents found?
                if ($per > 0) {
                        // Calculate new points
-                       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />");
+                       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',points='.$points.',per='.$per.',depth='.$GLOBALS['ref_level']);
                        $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: */ 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 />");
+                       if ((isExtensionActive('refback')) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == 'ref') && (isset($GLOBALS['cache_array']['add_userid'][$userid]))) {
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',data='.$GLOBALS['cache_array']['add_userid'][$userid].',ref_points='.$ref_points.',depth='.$GLOBALS['ref_level'].' - BEFORE!');
                                $ref_points = addRefbackPoints($GLOBALS['cache_array']['add_userid'][$userid], $userid, $points, $ref_points);
-                               //* 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 />");
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',data='.$GLOBALS['cache_array']['add_userid'][$userid].',ref_points='.$ref_points.',depth='.$GLOBALS['ref_level'].' - AFTER!');
                        } // 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",
+                       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: */ 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 />");
+                       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
 
                        // 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)",
+                               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: */ 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 />");
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
                        } // END - if
 
                        // Points updated, maybe I shall send him an email?
@@ -1277,38 +1314,38 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
 
                                // And sent it away
                                sendEmail($userid, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
-                               if (!isGetRequestParameterSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
+                               if (!isGetRequestParameterSet('mid')) loadTemplate('admin_settings_saved', false, '{--ADMIN_POINTS_ADDED--}');
                        }
 
                        // Maybe there's another ref?
                        if ((getUserData('refid') > 0) && ($points > 0) && (getUserData('refid') != $userid) && ($add_mode == 'ref')) {
                                // Then let's credit him here...
-                               //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},ref=".getUserData('refid').",points={$points} - ADVANCE!<br />");
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',ref='.getUserData('refid').',points='.$points.' - ADVANCE!');
                                addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), getUserData('refid'), $points, $sendNotify, getUserData('refid'), $locked);
                        } // END - if
                } // END - if
        } // END - if
 
-       //* DEBUG: */ print("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
+       //* DEBUG: */ debugOutput('</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: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}<br />");
+       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):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__ . '(<font color="#0000aa">' . __LINE__."</font>):updated=".SQL_AFFECTEDROWS().'<br />');
+       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):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__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid}<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid);
        } // END - if
 
        // Init referal id
@@ -1320,17 +1357,17 @@ function updateReferalCounter ($userid) {
                $ref = getUserData('refid');
        } // END - if
 
-       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},ref={$ref}<br />");
+       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):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__ . '(<font color="#0000aa">' . __LINE__."</font>):ref={$ref} - ADVANCE!<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):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__ . '(<font color="#0000aa">' . __LINE__."</font>):ref={$ref} - CACHE!<br />");
+               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):ref='.$ref.' - CACHE!');
                rebuildCache('refsystem', 'refsystem');
        }
 
@@ -1716,7 +1753,7 @@ function getWhatFromModule ($modCheck) {
        // Default is empty
        $what = '';
 
-       //* DEBUG: */ print(__LINE__.'!'.$modCheck."!<br />");
+       //* DEBUG: */ debugOutput(__LINE__.'!'.$modCheck.'!');
        switch ($modCheck) {
                case 'admin':
                        $what = 'overview';
@@ -1974,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("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
+       //* DEBUG: */ debugOutput('----------------------- <font color="#00aa00">'.__FUNCTION__.' - ENTRY</font> ------------------------<ul><li>');
        // Default is no refs and no nickname
        $add = '';
        $refs = array();
@@ -2026,12 +2063,12 @@ ORDER BY
                        } // END - if
 
                        // Activity is 'active' by default because if autopurge is not installed
-                       $row['activity'] = getMessage('MEMBER_ACTIVITY_ACTIVE');
+                       $row['activity'] = '{--MEMBER_ACTIVITY_ACTIVE--}';
 
                        // Is autopurge installed and the user inactive?
                        if ((isExtensionActive('autopurge')) && ((time() - getConfig('ap_inactive_since')) >= $row['last_online']))  {
                                // Inactive user!
-                               $row['activity'] = getMessage('MEMBER_ACTIVITY_INACTIVE');
+                               $row['activity'] = '{--MEMBER_ACTIVITY_INACTIVE--}';
                        } // END - if
 
                        // Remove some entries
@@ -2048,7 +2085,7 @@ ORDER BY
        SQL_FREERESULT($result);
 
        // Return result
-       //* DEBUG: */ print("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
+       //* DEBUG: */ debugOutput('</li></ul>----------------------- <font color="#aa0000">'.__FUNCTION__.' - EXIT</font> ------------------------<br />');
        return $refs;
 }