A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / libs / user_functions.php
index 64a95f39ef6fa149187ddd69909dc547a28ff762..029ab472ff5fbdb2c3f837c63051bc233ed405b2 100644 (file)
@@ -241,9 +241,6 @@ function determineRandomReferalId () {
                        if (SQL_NUMROWS($result) == 1) {
                                // Use that userid as new referal id
                                list($refid) = SQL_FETCHROW($result);
-
-                               // Reset all users, this makes this random referal id more challenging
-                               SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__);
                        } // END - if
 
                        // Free result
@@ -475,7 +472,7 @@ function doNewUserPassword ($email, $userid) {
 }
 
 // Get timestamp for given stats type and data
-function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') {
+function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = NULL) {
        // Default timestamp is zero
        $data['inserted'] = '0';
 
@@ -530,7 +527,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,
@@ -551,10 +548,10 @@ function doConfirmUserAccount ($hash) {
        );
 
        // Initialize the user id
-       $userid = '0';
+       $userid = NULL;
 
        // Search for an unconfirmed or confirmed account
-       $result = SQL_QUERY_ESC("SELECT `userid`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `userid`,`refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
                array($hash), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Ok, he want's to confirm now so we load some data
@@ -590,7 +587,7 @@ LIMIT 1",
                        sendEmail($userid, '{--GUEST_THANX_CONFIRM--}', $message);
 
                        // Maybe he got "referaled"?
-                       if (($refid > 0) && ($refid != $userid)) {
+                       if ((isValidUserId($refid)) && ($refid != $userid)) {
                                // Select the referal userid
                                if (fetchUserData($refid)) {
                                        // Update ref counter...
@@ -748,7 +745,7 @@ function doExpressionUser ($data) {
 }
 
 // Template call-back function for list_user admin function
-function doTemplateAdminListUserTitle ($template, $dummy = false) {
+function doTemplateAdminListUserTitle ($template, $clear = false) {
        // Init title with "all accounts"
        $code = '{--ADMIN_LIST_ALL_ACCOUNTS--}';