]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
Renamed more templates
[mailer.git] / inc / libs / bonus_functions.php
index e1e6fee8762ac691aa8394b39ce3ee945073eebb..525e0468b8bd9da8c2693f70dab0d763c0f7d342 100644 (file)
@@ -41,25 +41,28 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // This function must be run *BEFORE* a link is removed from table 'mailer_user_links' !
-function addTurboBonus ($mid, $userid, $type) {
+function addTurboBonus ($id, $userid, $type) {
        // Shall we add bonus points?
        if (!isBonusRallyeActive()) {
                return FALSE;
        } // END - if
 
        // Init variables
-       $sql = ''; $bonus = '0'; $mail = '0'; $column = '';
+       $sql     = '';
+       $bonusId = 'NULL';
+       $mailId  = 'NULL';
+       $column  = '';
 
        // Select SQL command
        switch ($type) {
                case 'bonusid':
                        $column = 'bonus_id';
-                       $bonus = $mid;
+                       $bonusId = $id;
                        break;
 
                case 'mailid' :
                        $column = 'mail_id';
-                       $mail = $mid;
+                       $mailId = $id;
                        break;
 
                default:
@@ -74,7 +77,7 @@ function addTurboBonus ($mid, $userid, $type) {
        } // END - if
 
        // Check for entry
-       $rank = countSumTotalData($mid, 'bonus_turbo', 'id', $column, TRUE) + 1;
+       $rank = countSumTotalData($id, 'bonus_turbo', 'id', $column, TRUE) + 1;
 
        // Which rank?
        if ($rank == 1) {
@@ -103,12 +106,13 @@ function addTurboBonus ($mid, $userid, $type) {
        SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`, `mail_id`, `bonus_id`, `level`, `points`, `timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())",
                array(
                        bigintval($userid),
-                       bigintval($mail),
-                       bigintval($bonus),
+                       $mailId,
+                       $bonusId,
                        $rank,
                        $points
                ), __FUNCTION__, __LINE__);
 
+       // @TODO Rewrite this to a filter
        if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) {
                handleBonusPoints($points, $userid);
        } // END - if
@@ -272,7 +276,7 @@ function purgeExpiredTurboBonus() {
 
        if (!SQL_HASZEROAFFECTED()) {
                // Send out email to admin
-               sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_autopurge_turbo', SQL_AFFECTEDROWS());
+               sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_purge_turbo', SQL_AFFECTEDROWS());
        } // END - if
 }