Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-unlock_emails.php
index 830cb69c2f2b6df82f07288b7f951d8557510998..848c797aaf538c72bfb6db90bb053c510373a3a8 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 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 *
@@ -44,7 +44,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 addYouAreHereLink('admin', __FILE__);
 
 // Check for mails
-$result_main = SQL_QUERY("SELECT
+$result_main = sqlQuery("SELECT
        `id`,
        `url`,
        `subject`,
@@ -61,7 +61,7 @@ WHERE
 ORDER BY
        `timestamp` ASC", __FILE__, __LINE__);
 
-if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
+if ((!ifSqlHasZeroNumRows($result_main)) || (isFormSent('lock'))) {
        if (isFormSent('accept')) {
                if (ifPostContainsSelections()) {
                        // Accept mail orders
@@ -73,7 +73,7 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
                                $content = getPoolDataFromId($id);
 
                                // Found some data?
-                               if (count($content) > 0) {
+                               if (isFilledArray($content)) {
                                        // Is the surfbar installed?
                                        // @TODO Rewrite these if-blocks to a filter
                                        if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) {
@@ -84,7 +84,7 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
                                        if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) {
                                                // Add points directly
-                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_order`=`bonus_order`+{?bonus_order?} WHERE `userid`=%s LIMIT 1",
+                                               sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_order`=`bonus_order`+{?bonus_order?} WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($content['sender'])), __FILE__, __LINE__);
 
                                                // Subtract bonus points from system
@@ -165,7 +165,7 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
        } elseif ((!isFormSent('lock')) && (!isFormSent('accept')) && (!isFormSent('reject'))) {
                // Mail orders are in pool so we can display them
                $OUT = '';
-               while ($content = SQL_FETCHARRAY($result_main)) {
+               while ($content = sqlFetchArray($result_main)) {
                        // Prepare data for the template
                        $content['timestamp'] = generateDateTime($content['timestamp'], 2);
 
@@ -174,7 +174,7 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
                } // END - while
 
                // Free memory
-               SQL_FREERESULT($result_main);
+               sqlFreeResult($result_main);
 
                // Remember in array
                $content['rows'] = $OUT;