]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/user_functions.php
Referal system refactured (and some parts fixed), wrapper function introduced:
[mailer.git] / inc / libs / user_functions.php
index 69a31a77035cb8e99d96c2704d3e709a606da3d2..827ee9c2c6c6218ae71f8479e59016be4eeb36c8 100644 (file)
@@ -43,8 +43,8 @@ if (!defined('__SECURITY')) {
 // Add links for selecting some users
 function alpha ($sortby, $colspan, $return=false) {
        if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0);
-       $add = '&page='.getRequestParameter('page').'&offset='.getRequestParameter('offset');
-       if (isGetRequestParameterSet('mode')) $add .= '&mode='.getRequestParameter('mode');
+       $add = '&page=' . getRequestParameter('page').'&offset=' . getRequestParameter('offset');
+       if (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode');
 
        /* Creates the list of letters and makes them a link. */
        $alphabet = explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,');
@@ -99,7 +99,9 @@ function addSortLinks ($letter, $sortby, $colspan, $return=false) {
        elseif (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode');
 
        // Makes order by links..
-       if ($letter == 'front') $letter = '';
+       if ($letter == 'front') {
+               $letter = '';
+       } // END - if
 
        // Prepare array with all possible sorters
        $list = array(
@@ -443,7 +445,7 @@ function doNewUserPassword ($email, $userid) {
                $accountFound = fetchUserData($userid);
        } else {
                // Userid not set!
-               debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . $userid . ',email=' . $email . ': Important variables are empty.');
+               logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',email=' . $email . ': Important variables are empty.');
        }
 
        // Any entry found?
@@ -542,7 +544,7 @@ function insertUserStatsRecord ($userid, $statsType, $statsData) {
        // Does it exist?
        if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
                // Then insert it!
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`, `stats_type`, `stats_data`) VALUES (%s,'%s','%s')",
                        array(
                                bigintval($userid),
                                $statsType,
@@ -586,7 +588,6 @@ function doConfirmUserAccount ($hash) {
        `{?_MYSQL_PREFIX?}_user_data`
 SET
        `status`='CONFIRMED',
-       `ref_payout`={?ref_payout?},
        `user_hash`=NULL
 WHERE
        `user_hash`='%s' AND
@@ -620,9 +621,8 @@ LIMIT 1",
                                        } // END - if
 
                                        // Add one-time referal bonus over referal system or directly
-                                       // @TODO Try to rewrite the following unset()
-                                       unset($GLOBALS['ref_level']);
-                                       addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode'));
+                                       initReferalSystem();
+                                       addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), bigintval($userid));
                                } // END - if
                        } // END - if