-function AUTOPURGE_ADD_POINTS($uid, $points) {
- global $jackpot;
-
- // Check if he has locked points or not
- $result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
- list($payout) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- if (($payout > 0) && (!empty($payout))) {
- // Yes, he has.
- $target = "locked_points";
- } elseif ($payout == "0") {
- // No, he has not
- $target = "points";
- }
-
- // Add points...
- if (empty($payout)) {
- // ... to jackpot account
- ADD_JACKPOT($points);
- if (empty($jackpot)) $jackpot = 0;
- $jackpot += $points;
- } else {
- // .. to user's account
- SQL_QUERY_ESC("UPDATE `{!MYSQL_PREFIX!}_user_points` SET %s=%s+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
- array($target, $target, $points, bigintval($uid)), __FILE__, __LINE__);
-
- // Update mediadata as well
- if ((GET_EXT_VERSION("mediadata") >= "0.0.4") && ($target == "points")) {
- // Update database
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $points);
- }
+// Add points in autopurge-mode
+function addPointsAutoPurge ($userid, $points) {
+ // Add points over the ref system directly now
+ addPointsDirectly('autopurge_add', $userid, $points);