Queries fixed
authorRoland Häder <roland@mxchange.org>
Fri, 15 Jul 2011 22:15:20 +0000 (22:15 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 15 Jul 2011 22:15:20 +0000 (22:15 +0000)
13 files changed:
inc/daily/daily_birthday.php
inc/filters.php
inc/libs/bonus_functions.php
inc/libs/task_functions.php
inc/modules/admin/what-config_beg.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/member/what-beg2.php
inc/modules/member/what-bonus.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/mysql-manager.php
mailid.php

index 42273b6f314564adfb3c0d85e8244a3b8f54181e..25ba924b186edfd266d730195b0c4c37808ce1f6 100644 (file)
@@ -59,8 +59,8 @@ $year  = getYear();
 $lastOnline = '';
 
 // Shall I include only active members?
 $lastOnline = '';
 
 // Shall I include only active members?
-if ((getConfig('birthday_active')  == 'Y') && (isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
-       $add = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+if ((getConfig('birthday_active')  == 'Y') && (isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
+       $add = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
 } // END - if
 
 // Only confirmed members shall receive birthday mails...
 } // END - if
 
 // Only confirmed members shall receive birthday mails...
index 3cd51808454fe7031598e8ed8029df251309668f..57ebf505ba3d46276105a947fc2cc74a586d9191 100644 (file)
@@ -293,7 +293,7 @@ function FILTER_UPDATE_LOGIN_DATA () {
        } // END - if
 
        // Recheck if logged in
        } // END - if
 
        // Recheck if logged in
-       if (!isMember()) {
+       if ((!isMember()) || ((isAdmin()) && (!isDebugModeEnabled()))) {
                return false;
        } // END - if
 
                return false;
        } // END - if
 
index fe9d30de02272a2a14ea232f3875f5d08478cc20..6418d1e5431e9c5cc50a9cba5f361abd1ba72f17 100644 (file)
@@ -95,8 +95,8 @@ 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(
        // 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
+                       $points,
+                       bigintval($userid)
                ), __FUNCTION__, __LINE__);
 
        // Rember this whole data for displaying ranking list
                ), __FUNCTION__, __LINE__);
 
        // Rember this whole data for displaying ranking list
index 47d9f1cd55552040cb6d6c625010e1294cac918a..b1451b999f5fa11c56540321c997b67afece807c 100644 (file)
@@ -347,7 +347,7 @@ ORDER BY
                // Autopurge installed?
                if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                // Autopurge installed?
                if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
                } // END - if
 
                addSql("SELECT
                } // END - if
 
                addSql("SELECT
@@ -376,7 +376,7 @@ ORDER BY
                // Autopurge installed?
                if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                // Autopurge installed?
                if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
                } // END - if
 
                addSql("SELECT
                } // END - if
 
                addSql("SELECT
index 786d5c43852a2797943417491e59779ccc81687f..537781600552fd7ad5ac5e904dd6c5e96d6a5314 100644 (file)
@@ -62,7 +62,7 @@ if (isFormSent()) {
        $content['wait_selection']   = createConfigurationTimeSelections('beg_notify_wait'   , 'ms' );
 
        // Init all Y/N selections
        $content['wait_selection']   = createConfigurationTimeSelections('beg_notify_wait'   , 'ms' );
 
        // Init all Y/N selections
-       foreach (array('rallye', 'active', 'mode', 'rallye_enable_notify', 'rallye_disable_notify', 'new_member_notify', 'include_own') as $entry) {
+       foreach (array('rallye', 'active', 'rallye_enable_notify', 'rallye_disable_notify', 'new_member_notify', 'include_own') as $entry) {
                $content[$entry . '_y'] = '';
                $content[$entry . '_n'] = '';
                $content[$entry . '_' . strtolower(getConfig('beg_' . $entry))] = ' checked="checked"';
                $content[$entry . '_y'] = '';
                $content[$entry . '_n'] = '';
                $content[$entry . '_' . strtolower(getConfig('beg_' . $entry))] = ' checked="checked"';
index b109511d02c8b0acb972af91c03b95ad5be904cc..9d18924ea3cdc430f85c3798ee7024e457fe67c5 100644 (file)
@@ -59,7 +59,7 @@ if (isBegRallyeEnabled()) {
        // Autopurge installed?
        if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
                // Use last online timestamp to keep inactive members away from here
        // Autopurge installed?
        if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
                // Use last online timestamp to keep inactive members away from here
-               $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+               $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
        } // END - if
 
        // Check if at least one is in the active rallye
        } // END - if
 
        // Check if at least one is in the active rallye
index ab6f753a30538dc3055a6088c942bbe3e5b2188c..2dace09bf4e719390edaa52a6ab4990b428b3876 100644 (file)
@@ -73,12 +73,12 @@ if (isBonusRallyeActive()) {
        // Autopurge installed?
        if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
                // Use last online timestamp to keep inactive members away from here
        // Autopurge installed?
        if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
                // Use last online timestamp to keep inactive members away from here
-               $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+               $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
        } // END - if
 
        // Check if at least one is in the active rallye
        $result = SQL_QUERY("SELECT
        } // END - if
 
        // Check if at least one is in the active rallye
        $result = SQL_QUERY("SELECT
-       `userid`, `email`, `gender`, `surname`, `family`, ".$USE." AS `points`, `last_online`
+       `userid`, `email`, `gender`, `surname`, `family`, " . $USE . " AS `points`, `last_online`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
index 9f265539f9d9ada84c192f7743983ae32419bba8..dbeb5affa2c198f35a48f1aebcc178102030d185 100644 (file)
@@ -56,7 +56,7 @@ $ONLINE = '';
 
 if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
        // Use last online timestamp to keep inactive members away from here
 
 if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
        // Use last online timestamp to keep inactive members away from here
-       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
 } // END - if
 
 // Let's check if there are some points left we can pay...
 } // END - if
 
 // Let's check if there are some points left we can pay...
index afd5af2f32b7f0fc169bcb3c35f46b862fd8cc79..7630af452acf3d02368c3ef9ed1fbb6e4ee73da4 100644 (file)
@@ -72,7 +72,7 @@ $ONLINE = '';
 // Autopurge installed?
 if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
        // Use last online timestamp to keep inactive members away from here
 // Autopurge installed?
 if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
        // Use last online timestamp to keep inactive members away from here
-       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
 } // END - if
 
 // Let's check if there are some points left we can 'pay'...
 } // END - if
 
 // Let's check if there are some points left we can 'pay'...
index 5372ce06be98fb5841bca64d1c0bd6728d64937a..dfc0eb786365a794ecd9ff596b8c4abdf9e05c7a 100644 (file)
@@ -63,7 +63,7 @@ if ((getBegRanks() > 0) && (!isCssOutputMode())) {
        // Let's check if there are some points left we can pay...
        if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
                // Okay, include last online timestamp
        // Let's check if there are some points left we can pay...
        if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
                // Okay, include last online timestamp
-               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
        } // END - if
 
        // SQL string to check for accounts
        } // END - if
 
        // SQL string to check for accounts
index ff5981a30adfb9d5940d9be85f6ceac7d7055541..ab81c37f9d224ba6a3e353d00f3b629416891e45 100644 (file)
@@ -56,7 +56,7 @@ if ((getConfig('bonus_ranks') > 0) && (!isCssOutputMode())) {
        // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...)
        if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
                // Okay, include last online timestamp
        // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...)
        if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) {
                // Okay, include last online timestamp
-               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
+               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
        } // END - if
 
        // Add more bonus points here
        } // END - if
 
        // Add more bonus points here
index d54e46a23322e7a6d2fa4d47e21e218411d5853a..48db0063ba2e835b4f1430f1cc3080cb469e0fd5 100644 (file)
@@ -1605,7 +1605,9 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
                        }
 
                        // Reduce this users total received emails?
                        }
 
                        // Reduce this users total received emails?
-                       if ($num === 0) $userids[$data['userid']] = $data['userid'];
+                       if ($num === 0) {
+                               $userids[$data['userid']] = $data['userid'];
+                       } // END - if
                } // END - while
 
                if (count($userids) > 0) {
                } // END - while
 
                if (count($userids) > 0) {
@@ -1642,7 +1644,15 @@ function createNewTask ($subject, $notes, $taskType, $userid = NULL, $adminId =
 // @TODO Fix inconsistency between last_module and getWhat()
 function updateLastActivity($userid) {
        // Run the update query
 // @TODO Fix inconsistency between last_module and getWhat()
 function updateLastActivity($userid) {
        // Run the update query
-       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_module`='%s', `last_online`=UNIX_TIMESTAMP(), `REMOTE_ADDR`='%s' WHERE `userid`=%s LIMIT 1",
+       SQL_QUERY_ESC("UPDATE
+       `{?_MYSQL_PREFIX?}_user_data`
+SET
+       `last_module`='%s',
+       `last_online`=UNIX_TIMESTAMP(),
+       `REMOTE_ADDR`='%s'
+WHERE
+       `userid`=%s
+LIMIT 1",
                array(
                        getWhat(),
                        detectRemoteAddr(),
                array(
                        getWhat(),
                        detectRemoteAddr(),
index dfefdcac9fd38083901954544d36b433273ee54a..f93838a1bae4ddec241f994bad9fd01b09d195a4 100644 (file)
@@ -130,7 +130,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                // Status must be CONFIRMED
                                if (getUserData('status') == 'CONFIRMED') {
                                        // Update last activity if not admin
                                // Status must be CONFIRMED
                                if (getUserData('status') == 'CONFIRMED') {
                                        // Update last activity if not admin
-                                       if (!isAdmin()) {
+                                       if ((!isAdmin()) || (isDebugModeEnabled())) {
                                                // Is not admin, so update last activity
                                                updateLastActivity($userId);
                                        } // END - if
                                                // Is not admin, so update last activity
                                                updateLastActivity($userId);
                                        } // END - if