Fixes for ref-level 0
authorRoland Häder <roland@mxchange.org>
Wed, 17 Sep 2008 14:25:29 +0000 (14:25 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 17 Sep 2008 14:25:29 +0000 (14:25 +0000)
inc/databases.php
inc/modules/member/what-payout.php
inc/modules/member/what-points.php
inc/mysql-manager.php
inc/reset/reset_daily.php

index 516745515ba6d1134c8cf436a8fda292f7c7da08..e4e9589db2d276f011f26d2ecfe150bf8fba9e84 100644 (file)
@@ -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);
index 496ca955f7987cc0ce35858b117557c03971bce0..9b92f19014450021cc4ac512617dc1897b32ae60 100644 (file)
@@ -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)
        {
index 780d05a23d87c746531fee85396b9a6e98e2cb3a..11a8db0a0e12904f10b9ab8acfa35e66de1fccc7 100644 (file)
@@ -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);
index 79fcc639933dfe75f3a4648fd43923d552ff89a3..c4803ae00bd7d0d40acc5bb3457978d65a50a505 100644 (file)
@@ -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",
index 250730be760b6b571b5ab45adb40cc0bc42c40f9..c763c0ecc5176e2e73d5777cfa65fd6841cc43ae 100644 (file)
@@ -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