Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / mails / bonus_mails.php
index 92de0ae6b59a68be1c624ef9d93f7fcea6f7f08b..6fb1ef0d1d171748e5a77c97c80d9aed8faafcbc 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Versendet Erinnerungsmails                       *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $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 *
@@ -77,18 +72,8 @@ switch (getBonusActive()) {
 } // END - switch
 
 if (!empty($sql)) {
-       // Init additional WHERE statement
-       $whereStatement = '';
-
-       // Is ext-holiday installed?
-       // @TODO Rewrite these if() blocks to a filter
-       if (isExtensionActive('holiday')) {
-               // Exclude those as well
-               $whereStatement .= " AND `d`.`holiday_active`='N'";
-       } // END - if
-
        // The SQL command needs to be finisched here (only confirmed accounts!)
-       $sql .= ')' . $whereStatement . runFilterChain('user_exclusion_sql', " AND `d`.`status`='CONFIRMED'") . ' ORDER BY `d`.`last_online` ASC';
+       $sql .= ')' . runFilterChain('user_exclusion_sql', " AND `d`.`status`='CONFIRMED'") . ' ORDER BY `d`.`last_online` ASC';
 
        // Normal notification mails or bonus mails?
        $sentBonusMails = ((getBonusNotifyPoints() > 0) && ($mode == 'enable') && (isExtensionActive('bonus')));
@@ -98,12 +83,13 @@ if (!empty($sql)) {
        $receiver = ''; $userids = array();
 
        // Check for accounts to be notified
-       $result_main = SQL_QUERY($sql, __FILE__, __LINE__);
-       if (!SQL_HASZERONUMS($result_main)) {
+       $result_main = sqlQuery($sql, __FILE__, __LINE__);
+
+       if (!ifSqlHasZeroNumRows($result_main)) {
                // Okay lets notify all users!
-               while ($content = SQL_FETCHARRAY($result_main)) {
+               while ($content = sqlFetchArray($result_main)) {
                        // Update account
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_user_data`
 SET
        `bonus_rallye_%s_notify`=UNIX_TIMESTAMP()
@@ -135,12 +121,12 @@ LIMIT 1",
                        $url = 'modules.php?module=index&what=login';
 
                        // Insert mail
-                       addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBonusNotifyPoints(), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main));
+                       addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBonusNotifyPoints(), getConfig('bonus_notify_wait'), $url, 0, 'normal', sqlNumRows($result_main));
                } // END - if
        } // END - if
 
        // Free memory
-       SQL_FREERESULT($result_main);
+       sqlFreeResult($result_main);
 } // END - if
 
 //