X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fdaily%2Fdaily_user.php;h=f475f805308b2efdd4e659dfb527863977511bfd;hp=f7b9085e2a566b3e3e03955e9a9a0bf0b5923ab5;hb=63f159414369b5ea19a8ca75d8cd8033c45d8341;hpb=a454def0bfba8288ffc839d034c710f034cf4728 diff --git a/inc/daily/daily_user.php b/inc/daily/daily_user.php index f7b9085e2a..f475f80530 100644 --- a/inc/daily/daily_user.php +++ b/inc/daily/daily_user.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -77,6 +77,7 @@ FROM WHERE `ref_payout`=0 AND `status`='CONFIRMED' + " . runFilterChain('user_exclusion_sql', ' ') . " ORDER BY `userid` ASC", __FILE__, __LINE__); @@ -85,75 +86,88 @@ if (!SQL_HASZERONUMS($result_daily)) { // Init SQLs initSqls(); - // Start checking accounts which are on 0 confirmed-to-go mails - while ($content = SQL_FETCHARRAY($result_daily)) { - //* DEBUG: */ debugOutput(basename(__FILE__) . ':' . $content['userid']); - $result_points = SQL_QUERY_ESC("SELECT + // Run through all 'locked_(foo)_points columsn + foreach (runFilterChain('locked_points_columns_array', array('points')) as $columnName) { + // Start checking accounts which are on 0 confirmed-to-go mails + while ($content = SQL_FETCHARRAY($result_daily)) { + //* DEBUG: */ debugOutput(basename(__FILE__) . ':' . $content['userid']); + $result_points = SQL_QUERY_ESC("SELECT `ref_depth`, - `locked_points` + `locked_%s` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND - `locked_points` > 0.00000 + `locked_%s` > 0.00000 ORDER BY `ref_depth` ASC", - array(bigintval($content['userid'])), __FILE__, __LINE__); + array( + $columnName, + bigintval($content['userid']), + $columnName + ), __FILE__, __LINE__); - //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . SQL_NUMROWS($result_points)); - if (!SQL_HASZERONUMS($result_points)) { - // Ok transfer points - while ($content2 = SQL_FETCHARRAY($result_points)) { - // Merge both arrays - $content = merge_array($content, $content2); + //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . SQL_NUMROWS($result_points)); + if (!SQL_HASZERONUMS($result_points)) { + // Ok transfer points + while ($content2 = SQL_FETCHARRAY($result_points)) { + // Merge both arrays + $content = merge_array($content, $content2); - //* DEBUG: */ debugOutput(basename(__FILE__) . ':userid=' . $content['userid'].',depth='.$content['ref_depth'].',locked='.$content['locked_points']); - if ($content['ref_depth'] > 0) { - // Level 1+ - addSql(SQL_QUERY_ESC("UPDATE + //* DEBUG: */ debugOutput(basename(__FILE__) . ':userid=' . $content['userid'].',depth='.$content['ref_depth'].',columnName=' . $columnName . ',locked='.$content['locked_' . $columnName]); + if ($content['ref_depth'] > 0) { + // Level 1+ + addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET - `points`=`points`+%s, - `locked_points`=0.00000 + `%s`=`%s`+%s, + `locked_%s`=0.00000 WHERE `userid`=%s AND `ref_depth`=%s LIMIT 1", - array( - $content['locked_points'], - bigintval($content['userid']), + array( + $columnName, + $columnName, + $content['locked_' . $columnName], + $columnName, + bigintval($content['userid']), $content['ref_depth'] - ), __FILE__, __LINE__, false) - ); - } else { - // Level zero - addSql(SQL_QUERY_ESC("UPDATE + ), __FILE__, __LINE__, false) + ); + } else { + // Level zero + addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET - `points`=`points`+%s, - `locked_points`=0.00000 + `%s`=`%s`+%s, + `locked_%s`=0.00000 WHERE `userid`=%s AND `ref_depth` IS NULL LIMIT 1", - array( - $content['locked_points'], - bigintval($content['userid']) - ), __FILE__, __LINE__, false) - ); - } + array( + $columnName, + $columnName, + $content['locked_' . $columnName], + $columnName, + bigintval($content['userid']) + ), __FILE__, __LINE__, false) + ); + } - // Update mediadata as well - if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) { - // Update database - updateMediadataEntry(array('total_points'), 'add', $content['locked_points']); - } // END - if - } // END - while - } // END - if + // Update mediadata as well + if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) { + // Update database + updateMediadataEntry(array('total_points'), 'add', $content['locked_' . $columnName]); + } // END - if + } // END - while + } // END - if - // Free memory - SQL_FREERESULT($result_points); - } // END - while + // Free memory + SQL_FREERESULT($result_points); + } // END - while + } // END - foreach // Run all SQLs runFilterChain('run_sqls');