From 76740e48546bb3fdb9fca65d8d205765f2bd4d68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 15 Jul 2011 22:15:20 +0000 Subject: [PATCH] Queries fixed --- inc/daily/daily_birthday.php | 4 ++-- inc/filters.php | 2 +- inc/libs/bonus_functions.php | 4 ++-- inc/libs/task_functions.php | 4 ++-- inc/modules/admin/what-config_beg.php | 2 +- inc/modules/admin/what-list_beg.php | 2 +- inc/modules/admin/what-list_bonus.php | 4 ++-- inc/modules/member/what-beg2.php | 2 +- inc/modules/member/what-bonus.php | 2 +- inc/monthly/monthly_beg.php | 2 +- inc/monthly/monthly_bonus.php | 2 +- inc/mysql-manager.php | 14 ++++++++++++-- mailid.php | 2 +- 13 files changed, 28 insertions(+), 18 deletions(-) diff --git a/inc/daily/daily_birthday.php b/inc/daily/daily_birthday.php index 42273b6f31..25ba924b18 100644 --- a/inc/daily/daily_birthday.php +++ b/inc/daily/daily_birthday.php @@ -59,8 +59,8 @@ $year = getYear(); $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... diff --git a/inc/filters.php b/inc/filters.php index 3cd5180845..57ebf505ba 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -293,7 +293,7 @@ function FILTER_UPDATE_LOGIN_DATA () { } // END - if // Recheck if logged in - if (!isMember()) { + if ((!isMember()) || ((isAdmin()) && (!isDebugModeEnabled()))) { return false; } // END - if diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index fe9d30de02..6418d1e543 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -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( - bigintval($userid), - $points + $points, + bigintval($userid) ), __FUNCTION__, __LINE__); // Rember this whole data for displaying ranking list diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index 47d9f1cd55..b1451b999f 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -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 - $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}'; + $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}'; } // 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 - $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}'; + $lastOnline = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}'; } // END - if addSql("SELECT diff --git a/inc/modules/admin/what-config_beg.php b/inc/modules/admin/what-config_beg.php index 786d5c4385..5377816005 100644 --- a/inc/modules/admin/what-config_beg.php +++ b/inc/modules/admin/what-config_beg.php @@ -62,7 +62,7 @@ if (isFormSent()) { $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"'; diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index b109511d02..9d18924ea3 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -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 - $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 diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index ab6f753a30..2dace09bf4 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -73,12 +73,12 @@ if (isBonusRallyeActive()) { // 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 - `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 diff --git a/inc/modules/member/what-beg2.php b/inc/modules/member/what-beg2.php index 9f265539f9..dbeb5affa2 100644 --- a/inc/modules/member/what-beg2.php +++ b/inc/modules/member/what-beg2.php @@ -56,7 +56,7 @@ $ONLINE = ''; 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... diff --git a/inc/modules/member/what-bonus.php b/inc/modules/member/what-bonus.php index afd5af2f32..7630af452a 100644 --- a/inc/modules/member/what-bonus.php +++ b/inc/modules/member/what-bonus.php @@ -72,7 +72,7 @@ $ONLINE = ''; // 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'... diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 5372ce06be..dfc0eb7863 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -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 - $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 diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index ff5981a30a..ab81c37f9d 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -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 - $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 diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index d54e46a233..48db0063ba 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1605,7 +1605,9 @@ function reduceRecipientReceivedMails ($column, $id, $count) { } // 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) { @@ -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 - 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(), diff --git a/mailid.php b/mailid.php index dfefdcac9f..f93838a1ba 100644 --- a/mailid.php +++ b/mailid.php @@ -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 - if (!isAdmin()) { + if ((!isAdmin()) || (isDebugModeEnabled())) { // Is not admin, so update last activity updateLastActivity($userId); } // END - if -- 2.39.5