]> git.mxchange.org Git - mailer.git/blobdiff - inc/pool/pool-bonus.php
Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / pool / pool-bonus.php
index 8ed43487d7bb879d87ae1d8059b65e0fd2841bcc..eb263b9905241feda5c5aa0995d6539756be13b6 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,10 +43,10 @@ if (!defined('__SECURITY')) {
 // Don't run on daily reset
 if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
        // Skip here
-       return false;
-} elseif (!isExtensionActive('bonus')) {
-       // Abort if extension bonus is not active
-       return false;
+       return FALSE;
+} elseif ((!isExtensionActive('bonus')) || (!isExtensionActive('other'))) {
+       // Abort if extension bonus/other are not active
+       return FALSE;
 }
 
 // Only send bonus mail when bonus extension is active and maximum send-mails is not reached
@@ -54,14 +54,14 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
        // Default is ext-html_mail is gone
        $add = '';
 
-       // Do we need to send out bonus mails?
+       // Send out bonus mails?
        if (isExtensionActive('html_mail')) {
                //  With HTML support
                $add = ', `html_msg`';
        } // END - if
 
        // Run query
-       $result_main = SQL_QUERY("SELECT
+       $result_main = sqlQuery("SELECT
        `id`,
        `subject`,
        `text`,
@@ -82,15 +82,15 @@ ORDER BY
        `timestamp` DESC", __FILE__, __LINE__);
 
        // Some mails left?
-       if (!SQL_HASZERONUMS($result_main)) {
+       if (!ifSqlHasZeroNumRows($result_main)) {
                // Init SQLs here
                initSqls();
 
                // Send these mails away...
                $count2 = '';
-               while ($mailData = SQL_FETCHARRAY($result_main)) {
+               while ($mailData = sqlFetchArray($result_main)) {
                        // Message is active in queue
-                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='QUEUE' WHERE `id`=%s LIMIT 1",
+                       sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='QUEUE' WHERE `id`=%s LIMIT 1",
                                array(bigintval($mailData['id'])), __FILE__, __LINE__);
 
                        // Default is no users left
@@ -117,7 +117,7 @@ ORDER BY
                                        //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
 
                                        // Remove receiver from list
-                                       $status = removeReceiver($temporaryReceivers, $key, $userid, $mailData['id'], $mailData['id'], true);
+                                       $status = removeReceiver($temporaryReceivers, $key, $userid, $mailData['id'], $mailData['id'], TRUE);
 
                                        // Did it work?
                                        switch ($status) {
@@ -175,7 +175,7 @@ ORDER BY
                        //* DEBUG: */ debugOutput('-L:'.__LINE__.'/'.countSelection($temporaryReceivers).'-');
                        if (countSelection($temporaryReceivers) == 0) {
                                // Queue reached!
-                               SQL_QUERY_ESC("UPDATE
+                               sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_bonus`
 SET
        `data_type`='SEND',
@@ -195,7 +195,7 @@ LIMIT 1",
                                } // END - if
                        } elseif ($GLOBALS['pool_cnt'] >= getMaxSend()) {
                                // Update bonus pool
-                               SQL_QUERY_ESC("UPDATE
+                               sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_bonus`
 SET
        `data_type`='NEW',
@@ -209,7 +209,7 @@ LIMIT 1",
                                                implode(';', $temporaryReceivers),
                                                bigintval($mailData['id'])
                                        ), __FILE__, __LINE__);
-                               //* DEBUG: */ debugOutput('*L:'.__LINE__.'<pre>'.print_r($temporaryReceivers, true).'</pre>!!!');
+                               //* DEBUG: */ debugOutput('*L:'.__LINE__.'<pre>'.print_r($temporaryReceivers, TRUE).'</pre>!!!');
 
                                // Run any SQLs
                                runFilterChain('run_sqls');
@@ -219,7 +219,7 @@ LIMIT 1",
        } // END - if
 
        // Free memory
-       SQL_FREERESULT($result_main);
+       sqlFreeResult($result_main);
 
        // Remove variable
        unset($mailText);