From 3819d37a11c5a1c29745fd1139ab07cefbb5ecd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 17 Sep 2008 14:25:29 +0000 Subject: [PATCH] Fixes for ref-level 0 --- inc/databases.php | 2 +- inc/modules/member/what-payout.php | 2 +- inc/modules/member/what-points.php | 2 +- inc/mysql-manager.php | 7 +++++-- inc/reset/reset_daily.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 516745515b..e4e9589db2 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "351"); +define('CURR_SVN_REVISION', "352"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index 496ca955f7..9b92f19014 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -53,7 +53,7 @@ $TPTS = 0; while (list($lvl, $per) = SQL_FETCHROW($result_depths)) { // Load referral points - $result_points = SQL_QUERY_ESC("SELECT points FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=%s LIMIT 1", + $result_points = SQL_QUERY_ESC("SELECT points FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__); if (SQL_NUMROWS($result_points) == 1) { diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index 780d05a23d..11a8db0a0e 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -62,7 +62,7 @@ while (list($lvl, $per) = SQL_FETCHROW($result_depths)) { $REFS = 0; // Load referral points - $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=%s LIMIT 1", array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__); + $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__); if (SQL_NUMROWS($result_points) == 1) { list($points, $LOCKED) = SQL_FETCHROW($result_points); SQL_FREERESULT($result_points); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 79fcc63993..c4803ae00b 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1096,7 +1096,7 @@ function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", * rid = inc/modules/guest/what-confirm.php need this * locked = Shall I pay it to normal (false) or locked (true) points ammount? * add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct" - * will cause no referral will get points ever!!!) + * for default value will cause no referral will get points ever!!!) */ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") { @@ -1125,8 +1125,11 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock $percents = "percents"; if (isset($_CONFIG['db_percents'])) $percents = $_CONFIG['db_percents']; $table = "refdepths"; if (isset($_CONFIG['db_table'])) $table = $_CONFIG['db_table']; + // Default is "normal" points + $data = "points"; + // Which points, locked or normal? - $data = "points"; if ($locked) $data = "locked_points"; + if ($locked) $data = "locked_points"; // Check user account $result_user = SQL_QUERY_ESC("SELECT refid, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1", diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index 250730be76..c763c0ecc5 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -63,7 +63,7 @@ WHERE userid=%s AND locked_points != 0.00000 ORDER BY ref_depth", while (list($dep, $locked) = SQL_FETCHROW($result_points)) { $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s, locked_points=0.00000 -WHERE userid=%s AND ref_depth=%s LIMIT 1", +WHERE userid=%s AND ref_depth=%d LIMIT 1", array($locked, bigintval($uid), $dep), __FILE__, __LINE__); // Update mediadata as well -- 2.30.2